diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index 0e465cd815..8bbcdf96c9 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -124,6 +124,7 @@ by following the steps under the `SNMP Extend` heading. 1. [Puppet Agent](#puppet_agent) - SNMP extend 1. [PureFTPd](#pureftpd) - SNMP extend 1. [Raspberry PI](#raspberry-pi) - SNMP extend +1. [Redis](#redis) - SNMP extend 1. [SDFS info](#sdfs-info) - SNMP extend 1. [Seafile](#seafile) - SNMP extend 1. [SMART](#smart) - SNMP extend @@ -1575,6 +1576,24 @@ the user snmpd is using with `ps aux | grep snmpd` 5: Restart snmpd on PI host +# Redis + +SNMP extend script to monitor your Redis Server + +## SNMP Extend + +1: Download the script onto the desired host. `wget + https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/redis.py + -O /etc/snmp/redis.py` + +2: Make the script executable: `chmod +x /etc/snmp/redis.py` + +3: Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add: + +``` +extend redis /etc/snmp/redis.py +``` + # Seafile SNMP extend script to monitor your Seafile Server diff --git a/includes/html/graphs/application/redis_clients.inc.php b/includes/html/graphs/application/redis_clients.inc.php new file mode 100644 index 0000000000..aea40eab55 --- /dev/null +++ b/includes/html/graphs/application/redis_clients.inc.php @@ -0,0 +1,33 @@ + 'Connected', + 'blocked' => 'Blocked', + ); + +$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'clients')); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_commands.inc.php b/includes/html/graphs/application/redis_commands.inc.php new file mode 100644 index 0000000000..8ffaf5da1e --- /dev/null +++ b/includes/html/graphs/application/redis_commands.inc.php @@ -0,0 +1,32 @@ + 'Processed', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_connections.inc.php b/includes/html/graphs/application/redis_connections.inc.php new file mode 100644 index 0000000000..82f16a1bd6 --- /dev/null +++ b/includes/html/graphs/application/redis_connections.inc.php @@ -0,0 +1,33 @@ + 'Received', + 'rejected' => 'Rejected', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_defrag.inc.php b/includes/html/graphs/application/redis_defrag.inc.php new file mode 100644 index 0000000000..5124d2dc05 --- /dev/null +++ b/includes/html/graphs/application/redis_defrag.inc.php @@ -0,0 +1,34 @@ + 'Hits', + 'misses' => 'Misses', + 'key_hits' => 'Key Hits', + 'key_misses' => 'Key Misses', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_fragmentation.inc.php b/includes/html/graphs/application/redis_fragmentation.inc.php new file mode 100644 index 0000000000..cea7845500 --- /dev/null +++ b/includes/html/graphs/application/redis_fragmentation.inc.php @@ -0,0 +1,32 @@ + 'Bytes', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_keyspace.inc.php b/includes/html/graphs/application/redis_keyspace.inc.php new file mode 100644 index 0000000000..1af38b6352 --- /dev/null +++ b/includes/html/graphs/application/redis_keyspace.inc.php @@ -0,0 +1,33 @@ + 'Hits', + 'misses' => 'Misses', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_memory.inc.php b/includes/html/graphs/application/redis_memory.inc.php new file mode 100644 index 0000000000..6aa3d781f8 --- /dev/null +++ b/includes/html/graphs/application/redis_memory.inc.php @@ -0,0 +1,36 @@ + 'Active', + 'allocated' => 'Allocated', + 'resident' => 'Resident', + 'frag_bytes' => 'Frag Bytes', + 'rss_bytes' => 'RSS Bytes', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_net.inc.php b/includes/html/graphs/application/redis_net.inc.php new file mode 100644 index 0000000000..c43825f23e --- /dev/null +++ b/includes/html/graphs/application/redis_net.inc.php @@ -0,0 +1,33 @@ + 'Input', + 'output_bytes' => 'Output', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_objects.inc.php b/includes/html/graphs/application/redis_objects.inc.php new file mode 100644 index 0000000000..42a481f7d5 --- /dev/null +++ b/includes/html/graphs/application/redis_objects.inc.php @@ -0,0 +1,32 @@ + 'Pending', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_sync.inc.php b/includes/html/graphs/application/redis_sync.inc.php new file mode 100644 index 0000000000..de9feafc26 --- /dev/null +++ b/includes/html/graphs/application/redis_sync.inc.php @@ -0,0 +1,34 @@ + 'Full', + 'ok' => 'OK', + 'err' => 'Error', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/redis_usage.inc.php b/includes/html/graphs/application/redis_usage.inc.php new file mode 100644 index 0000000000..5371c06529 --- /dev/null +++ b/includes/html/graphs/application/redis_usage.inc.php @@ -0,0 +1,39 @@ + 'Allocated', + 'dataset' => 'Dataset', + 'lua' => 'LUA', + 'overhead' => 'Overhead', + 'peak' => 'Peak', + 'rss' => 'RSS', + 'scripts' => 'Scripts', + 'startup' => 'Startup', + ); + +$rrd_list = array(); +if (rrdtool_check_rrd_exists($rrd_filename)) { + $i = 0; + foreach ($array as $ds => $descr) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $descr; + $rrd_list[$i]['ds'] = $ds; + $i++; + } +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/pages/apps.inc.php b/includes/html/pages/apps.inc.php index a4760027db..59b828cf59 100644 --- a/includes/html/pages/apps.inc.php +++ b/includes/html/pages/apps.inc.php @@ -27,6 +27,18 @@ $graphs['memcached'] = array( 'data', 'items', ); +$graphs['redis'] = array( + 'clients', + 'objects', + 'fragmentation', + 'usage', + 'defrag', + 'keyspace', + 'sync', + 'commands', + 'connections', + 'net', +); $graphs['nginx'] = array( 'connections', 'req', diff --git a/includes/html/pages/device/apps/redis.inc.php b/includes/html/pages/device/apps/redis.inc.php new file mode 100644 index 0000000000..4bfeedec9e --- /dev/null +++ b/includes/html/pages/device/apps/redis.inc.php @@ -0,0 +1,33 @@ + 'Clients', + 'redis_memory' => 'Memory', + 'redis_commands' => 'Commands', + 'redis_connections' => 'Connections', + 'redis_defrag' => 'Defrag', + 'redis_fragmentation' => 'Fragmentation', + 'redis_keyspace' => 'Keyspace', + 'redis_net' => 'Net', + 'redis_objects' => 'Objects', + 'redis_sync' => 'Sync', + 'redis_usage' => 'Usage', +); + +foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = time(); + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + echo '