diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index fb40344f8b..f196c3b372 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -128,6 +128,7 @@ by following the steps under the `SNMP Extend` heading. 1. [PureFTPd](#pureftpd) - SNMP extend 1. [Raspberry PI](#raspberry-pi) - SNMP extend 1. [Redis](#redis) - SNMP extend +1. [RRDCached](#rrdcached) - SNMP extend 1. [SDFS info](#sdfs-info) - SNMP extend 1. [Seafile](#seafile) - SNMP extend 1. [SMART](#smart) - SNMP extend @@ -1651,6 +1652,32 @@ SNMP extend script to monitor your Redis Server extend redis /etc/snmp/redis.py ``` +# RRDCached + +Install/Setup: +For Install/Setup Local Librenms RRDCached: Please see [RRDCached](RRDCached.md) + +Will collect stats by: +1: Connecting directly to the associated device on port 42217 +2: Monitor thru snmp with SNMP extend, as outlined below +3: Connecting to the rrdcached server specified by the `rrdcached` setting + +SNMP extend script to monitor your (remote) RRDCached via snmp + +## SNMP Extend + +1: Download the script onto the desired host. `wget + https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/rrdcached + -O /etc/snmp/rrdcached` + +2: Make the script executable: `chmod +x /etc/snmp/rrdcached` + +3: Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add: + +``` +extend rrdcached /etc/snmp/rrdcached +``` + # Seafile SNMP extend script to monitor your Seafile Server diff --git a/includes/polling/applications/rrdcached.inc.php b/includes/polling/applications/rrdcached.inc.php index a6b038d8d2..76d7d94f01 100644 --- a/includes/polling/applications/rrdcached.inc.php +++ b/includes/polling/applications/rrdcached.inc.php @@ -40,6 +40,13 @@ if ($agent_data['app'][$name]) { $sock = fsockopen($device['hostname'], 42217, $errno, $errstr, 5); if (! $sock) { + d_echo("\nNo Socket to rrdcached server " . $device['hostname'] . ":42217 try to get rrdcached from SNMP\n"); + $oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.9.114.114.100.99.97.99.104.101.100'; + $result = snmp_get($device, $oid, '-Oqv'); + $data = trim($result, '"'); + $data = str_replace("<<>>\n", '', $data); + } + if (strlen($data) < 100) { $socket = \LibreNMS\Config::get('rrdcached'); if (substr($socket, 0, 6) == 'unix:/') { $socket_file = substr($socket, 5); @@ -47,6 +54,7 @@ if ($agent_data['app'][$name]) { $sock = fsockopen('unix://' . $socket_file); } } + d_echo("\nNo SnmpData " . $device['hostname'] . ' fallback to local rrdcached unix://' . $socket_file . "\n"); } if ($sock) { fwrite($sock, "STATS\n"); @@ -61,7 +69,7 @@ if ($agent_data['app'][$name]) { $count++; } fclose($sock); - } else { + } elseif (strlen($data) < 100) { d_echo("ERROR: $errno - $errstr\n"); } }