From 94467671b3ffcc34bfb47575e4cc8bb8a78969a8 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Fri, 22 Jul 2016 14:29:29 -0500 Subject: [PATCH 1/6] New App: Powerdns Recursor Polling must have access to stats for the device, port 8082 (Agent file could be added to avoid that) **Graphs:** Questions Answers Cache Performance Cache Size Outbound Queries **Graph changes** generic_multi:print_total added, allow per-dataset colors, document variables generic_multi_line: allow per-dataset colors, document variables --- .../application/powerdns-recursor.inc.php | 30 +++++ .../powerdns-recursor_answers.inc.php | 64 +++++++++ ...owerdns-recursor_cache_performance.inc.php | 65 +++++++++ .../powerdns-recursor_cache_size.inc.php | 50 +++++++ .../powerdns-recursor_outqueries.inc.php | 68 ++++++++++ .../powerdns-recursor_questions.inc.php | 68 ++++++++++ html/includes/graphs/generic_multi.inc.php | 49 ++++++- .../graphs/generic_multi_line.inc.php | 30 ++++- html/pages/apps.inc.php | 7 + .../device/apps/powerdns-recursor.inc.php | 53 ++++++++ .../applications/powerdns-recursor.inc.php | 126 ++++++++++++++++++ 11 files changed, 600 insertions(+), 10 deletions(-) create mode 100644 html/includes/graphs/application/powerdns-recursor.inc.php create mode 100644 html/includes/graphs/application/powerdns-recursor_answers.inc.php create mode 100644 html/includes/graphs/application/powerdns-recursor_cache_performance.inc.php create mode 100644 html/includes/graphs/application/powerdns-recursor_cache_size.inc.php create mode 100644 html/includes/graphs/application/powerdns-recursor_outqueries.inc.php create mode 100644 html/includes/graphs/application/powerdns-recursor_questions.inc.php create mode 100644 html/pages/device/apps/powerdns-recursor.inc.php create mode 100644 includes/polling/applications/powerdns-recursor.inc.php diff --git a/html/includes/graphs/application/powerdns-recursor.inc.php b/html/includes/graphs/application/powerdns-recursor.inc.php new file mode 100644 index 0000000000..72a6221cd8 --- /dev/null +++ b/html/includes/graphs/application/powerdns-recursor.inc.php @@ -0,0 +1,30 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + +$rrd = rrd_name($device['hostname'], array('app', 'powerdns-recursor', $app['app_id'])); +if (is_file($rrd)) { + $rrd_filename = $rrd; +} +$simple_rrd = true; diff --git a/html/includes/graphs/application/powerdns-recursor_answers.inc.php b/html/includes/graphs/application/powerdns-recursor_answers.inc.php new file mode 100644 index 0000000000..cdeb327db0 --- /dev/null +++ b/html/includes/graphs/application/powerdns-recursor_answers.inc.php @@ -0,0 +1,64 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + +include 'powerdns-recursor.inc.php'; + +$colours = 'oranges'; +$unit_text = 'Answers/sec'; +$print_total = true; + +if (is_file($rrd_filename)) { + $rrd_list = array( + array( + 'ds' => 'answers0-1', + 'filename' => $rrd_filename, + 'descr' => '0-1ms', + ), + array( + 'ds' => 'answers1-10', + 'filename' => $rrd_filename, + 'descr' => '1-10ms', + ), + array( + 'ds' => 'answers10-100', + 'filename' => $rrd_filename, + 'descr' => '10-100ms', + ), + array( + 'ds' => 'answers100-1000', + 'filename' => $rrd_filename, + 'descr' => '100-1000ms', + ), + array( + 'ds' => 'answers-slow', + 'filename' => $rrd_filename, + 'descr' => '>1s', + ), + ); +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/graphs/generic_multi.inc.php'; \ No newline at end of file diff --git a/html/includes/graphs/application/powerdns-recursor_cache_performance.inc.php b/html/includes/graphs/application/powerdns-recursor_cache_performance.inc.php new file mode 100644 index 0000000000..5676f62f84 --- /dev/null +++ b/html/includes/graphs/application/powerdns-recursor_cache_performance.inc.php @@ -0,0 +1,65 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ +include 'powerdns-recursor.inc.php'; + +$colours = 'mixed'; +$unit_text = 'Packets/sec'; + +if (is_file($rrd_filename)) { + $rrd_list = array( + array( + 'filename' => $rrd_filename, + 'ds' => 'cache-hits', + 'descr' => 'Query Cache Hits', + 'colour' => '297159', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'cache-misses', + 'descr' => 'Query Cache Misses', + 'colour' => '73AC61', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'packetcache-hits', + 'descr' => 'Packet Cache Hits', + 'colour' => 'BC7049', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'packetcache-misses', + 'descr' => 'Packet Cache Misses', + 'colour' => 'C98F45', + 'area' => true, + ) + ); +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/graphs/generic_multi_line.inc.php'; \ No newline at end of file diff --git a/html/includes/graphs/application/powerdns-recursor_cache_size.inc.php b/html/includes/graphs/application/powerdns-recursor_cache_size.inc.php new file mode 100644 index 0000000000..dc46388b73 --- /dev/null +++ b/html/includes/graphs/application/powerdns-recursor_cache_size.inc.php @@ -0,0 +1,50 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + +include 'powerdns-recursor.inc.php'; + +$colours = 'purples'; +$unit_text = 'Entries'; + +if (is_file($rrd_filename)) { + $rrd_list = array( + array( + 'filename' => $rrd_filename, + 'ds' => 'cache-entries', + 'descr' => 'Query Cache', + 'colour' => '202048', + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'packetcache-entries', + 'descr' => 'Packet Cache', + 'colour' => 'CC7CCC', + ) + ); +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/graphs/generic_multi_line.inc.php'; diff --git a/html/includes/graphs/application/powerdns-recursor_outqueries.inc.php b/html/includes/graphs/application/powerdns-recursor_outqueries.inc.php new file mode 100644 index 0000000000..aa6281fd10 --- /dev/null +++ b/html/includes/graphs/application/powerdns-recursor_outqueries.inc.php @@ -0,0 +1,68 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + +include 'powerdns-recursor.inc.php'; + +$colours = 'mixed'; +$unit_text = 'Queries/sec'; + +if (is_file($rrd_filename)) { + $rrd_list = array( + array( + 'filename' => $rrd_filename, + 'ds' => 'all-outqueries', + 'descr' => 'Total', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'ipv6-outqueries', + 'descr' => 'IPv6', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'tcp-outqueries', + 'descr' => 'TCP', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'throttled-out', + 'descr' => 'Throttled', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'outgoing-timeouts', + 'descr' => 'Timeouts', + 'area' => true, + ) + ); +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/graphs/generic_multi_line.inc.php'; \ No newline at end of file diff --git a/html/includes/graphs/application/powerdns-recursor_questions.inc.php b/html/includes/graphs/application/powerdns-recursor_questions.inc.php new file mode 100644 index 0000000000..6ef78fd441 --- /dev/null +++ b/html/includes/graphs/application/powerdns-recursor_questions.inc.php @@ -0,0 +1,68 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + +include 'powerdns-recursor.inc.php'; + +$colours = 'mixed'; +$unit_text = 'Questions/sec'; + +if (is_file($rrd_filename)) { + $rrd_list = array( + array( + 'filename' => $rrd_filename, + 'ds' => 'questions', + 'descr' => 'Total Questions', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'ipv6-questions', + 'descr' => 'IPv6 Questions', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'tcp-questions', + 'descr' => 'TCP Questions', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'over-capacity-drops', + 'descr' => 'Over Capacity Drops', + 'area' => true, + ), + array( + 'filename' => $rrd_filename, + 'ds' => 'policy-drops', + 'descr' => 'Policy Drops', + 'area' => true, + ) + ); +} else { + echo "file missing: $rrd_filename"; +} + +require 'includes/graphs/generic_multi_line.inc.php'; \ No newline at end of file diff --git a/html/includes/graphs/generic_multi.inc.php b/html/includes/graphs/generic_multi.inc.php index 6d7f78a1c0..5100fce0b3 100644 --- a/html/includes/graphs/generic_multi.inc.php +++ b/html/includes/graphs/generic_multi.inc.php @@ -1,5 +1,20 @@ '500') { @@ -29,20 +44,26 @@ else { $i = 0; $iter = 0; +$ids = array(); foreach ($rrd_list as $rrd) { - if (!$config['graph_colours'][$colours][$iter]) { - $iter = 0; + // get the color for this data set + if(isset($rrd['colour'])) { + $colour = $rrd['colour']; + } else { + if (!$config['graph_colours'][$colours][$iter]) { + $iter = 0; + } + $colour = $config['graph_colours'][$colours][$iter]; + $iter++; } - $colour = $config['graph_colours'][$colours][$iter]; - $ds = $rrd['ds']; $filename = $rrd['filename']; $descr = rrdtool_escape($rrd['descr'], $descr_len); - $id = 'ds'.$i; + $ids[] = ($id = 'ds'.$i); $rrd_options .= ' DEF:'.$id."=$filename:$ds:AVERAGE"; @@ -69,10 +90,26 @@ foreach ($rrd_list as $rrd) { $bstack = ':STACK'; } + + + $i++; - $iter++; }//end foreach +if ($print_total) { + $tot = $ids; + for ($i=1; $i '500') { @@ -31,11 +48,17 @@ $i = 0; $iter = 0; foreach ($rrd_list as $rrd) { - if (!$config['graph_colours'][$colours][$iter]) { - $iter = 0; + // get the color for this data set + if(isset($rrd['colour'])) { + $colour = $rrd['colour']; + } else { + if (!$config['graph_colours'][$colours][$iter]) { + $iter = 0; + } + $colour = $config['graph_colours'][$colours][$iter]; + $iter++; } - $colour = $config['graph_colours'][$colours][$iter]; if (!empty($rrd['area']) && empty($rrd['areacolour'])) { $rrd['areacolour'] = $colour."20"; } @@ -76,7 +99,6 @@ foreach ($rrd_list as $rrd) { $rrd_optionsb .= ' GPRINT:'.$id.'max:MAX:%5.2lf%s'.$units.' GPRINT:'.$id.":AVERAGE:'%5.2lf%s$units\\n'"; $i++; - $iter++; }//end foreach $rrd_options .= $rrd_optionsb; diff --git a/html/pages/apps.inc.php b/html/pages/apps.inc.php index e0843279b6..855de431c7 100644 --- a/html/pages/apps.inc.php +++ b/html/pages/apps.inc.php @@ -33,6 +33,13 @@ $graphs['nginx'] = array( 'req', ); +$graphs['powerdns-recursor'] = array( + 'questions', + 'answers', + 'cache_performance', + 'outqueries' +); + $graphs['rrdcached'] = array( 'queue_length', 'events', diff --git a/html/pages/device/apps/powerdns-recursor.inc.php b/html/pages/device/apps/powerdns-recursor.inc.php new file mode 100644 index 0000000000..421bc3f74d --- /dev/null +++ b/html/pages/device/apps/powerdns-recursor.inc.php @@ -0,0 +1,53 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + +global $config; + +$graphs = array( + 'powerdns-recursor_questions' => 'Questions', + 'powerdns-recursor_answers' => 'Answers', + 'powerdns-recursor_cache_performance' => 'Cache Performance', + 'powerdns-recursor_cache_size' => 'Cache Size', + 'powerdns-recursor_outqueries' => 'Outbound Queries', +); + +foreach ($graphs as $key => $text) { + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = $config['time']['now']; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_'.$key; + + echo '
+
+

'.$text.'

+
+
+
'; + include 'includes/print-graphrow.inc.php'; + echo '
'; + echo '
'; + echo '
'; +} \ No newline at end of file diff --git a/includes/polling/applications/powerdns-recursor.inc.php b/includes/polling/applications/powerdns-recursor.inc.php new file mode 100644 index 0000000000..3307a5d6db --- /dev/null +++ b/includes/polling/applications/powerdns-recursor.inc.php @@ -0,0 +1,126 @@ +. + * + * @package LibreNMS + * @link http://librenms.org + * @copyright 2016 Tony Murray + * @author Tony Murray + */ + +echo ' powerdns-recrusor'; + +global $config; +$data = ''; + +$name = 'powerdns-recursor'; +$app_id = $app['app_id']; +if ($agent_data['app'][$name]) { + $data = $agent_data['app'][$name]; +} elseif (isset($config['apps'][$name]['api-key'])) { + d_echo("\nNo Agent Data. Attempting to connect directly to the powerdns-recursor server " . $device['hostname'] . ":8082\n"); + $context = stream_context_create(array('http' => array('header' => 'X-API-Key: ' . $config['apps'][$name]['api-key']))); + $data = file_get_contents('http://' . $device['hostname'] . ':8082/servers/localhost/statistics', false, $context); +} + +if (!empty($data)) { + $rrd_def = array( + 'all-outqueries' => 'DS:all-outqueries:COUNTER:600:0:U', + 'answers-slow' => 'DS:answers-slow:COUNTER:600:0:U', + 'answers0-1' => 'DS:answers0-1:COUNTER:600:0:U', + 'answers1-10' => 'DS:answers1-10:COUNTER:600:0:U', + 'answers10-100' => 'DS:answers10-100:COUNTER:600:0:U', + 'answers100-1000' => 'DS:answers100-1000:COUNTER:600:0:U', + 'cache-entries' => 'DS:cache-entries:GAUGE:600:0:U', + 'cache-hits' => 'DS:cache-hits:COUNTER:600:0:U', + 'cache-misses' => 'DS:cache-misses:COUNTER:600:0:U', + 'case-mismatches' => 'DS:case-mismatches:COUNTER:600:0:U', + 'chain-resends' => 'DS:chain-resends:COUNTER:600:0:U', + 'client-parse-errors' => 'DS:client-parse-errors:COUNTER:600:0:U', + 'concurrent-queries' => 'DS:concurrent-queries:GAUGE:600:0:U', + 'dlg-only-drops' => 'DS:dlg-only-drops:COUNTER:600:0:U', + 'dont-outqueries' => 'DS:dont-outqueries:COUNTER:600:0:U', + 'edns-ping-matches' => 'DS:edns-ping-matches:COUNTER:600:0:U', + 'edns-ping-mismatches' => 'DS:edns-ping-mismatches:COUNTER:600:0:U', + 'failed-host-entries' => 'DS:failed-host-entries:GAUGE:600:0:U', + 'ipv6-outqueries' => 'DS:ipv6-outqueries:COUNTER:600:0:U', + 'ipv6-questions' => 'DS:ipv6-questions:COUNTER:600:0:U', + 'malloc-bytes' => 'DS:malloc-bytes:GAUGE:600:0:U', + 'max-mthread-stack' => 'DS:max-mthread-stack:GAUGE:600:0:U', + 'negcache-entries' => 'DS:negcache-entries:GAUGE:600:0:U', + 'no-packet-error' => 'DS:no-packet-error:COUNTER:600:0:U', + 'noedns-outqueries' => 'DS:noedns-outqueries:COUNTER:600:0:U', + 'noerror-answers' => 'DS:noerror-answers:COUNTER:600:0:U', + 'noping-outqueries' => 'DS:noping-outqueries:COUNTER:600:0:U', + 'nsset-invalidations' => 'DS:nsset-invalidations:COUNTER:600:0:U', + 'nsspeeds-entries' => 'DS:nsspeeds-entries:GAUGE:600:0:U', + 'nxdomain-answers' => 'DS:nxdomain-answers:COUNTER:600:0:U', + 'outgoing-timeouts' => 'DS:outgoing-timeouts:COUNTER:600:0:U', + 'over-capacity-drops' => 'DS:over-capacity-drops:COUNTER:600:0:U', + 'packetcache-entries' => 'DS:packetcache-entries:GAUGE:600:0:U', + 'packetcache-hits' => 'DS:packetcache-hits:COUNTER:600:0:U', + 'packetcache-misses' => 'DS:packetcache-misses:COUNTER:600:0:U', + 'policy-drops' => 'DS:policy-drops:COUNTER:600:0:U', + 'qa-latency' => 'DS:qa-latency:GAUGE:600:0:U', + 'questions' => 'DS:questions:COUNTER:600:0:U', + 'resource-limits' => 'DS:resource-limits:COUNTER:600:0:U', + 'security-status' => 'DS:security-status:GAUGE:600:0:U', + 'server-parse-errors' => 'DS:server-parse-errors:COUNTER:600:0:U', + 'servfail-answers' => 'DS:servfail-answers:COUNTER:600:0:U', + 'spoof-prevents' => 'DS:spoof-prevents:COUNTER:600:0:U', + 'sys-msec' => 'DS:sys-msec:COUNTER:600:0:U', + 'tcp-client-overflow' => 'DS:tcp-client-overflow:COUNTER:600:0:U', + 'tcp-clients' => 'DS:tcp-clients:GAUGE:600:0:U', + 'tcp-outqueries' => 'DS:tcp-outqueries:COUNTER:600:0:U', + 'tcp-questions' => 'DS:tcp-questions:COUNTER:600:0:U', + 'throttle-entries' => 'DS:throttle-entries:GAUGE:600:0:U', + 'throttled-out' => 'DS:throttled-out:COUNTER:600:0:U', + 'throttled-outqueries' => 'DS:throttled-outquerie:COUNTER:600:0:U', + 'too-old-drops' => 'DS:too-old-drops:COUNTER:600:0:U', + 'unauthorized-tcp' => 'DS:unauthorized-tcp:COUNTER:600:0:U', + 'unauthorized-udp' => 'DS:unauthorized-udp:COUNTER:600:0:U', + 'unexpected-packets' => 'DS:unexpected-packets:COUNTER:600:0:U', + 'unreachables' => 'DS:unreachables:COUNTER:600:0:U', + 'uptime' => 'DS:uptime:COUNTER:600:0:U', + 'user-msec' => 'DS:user-msec:COUNTER:600:0:U', + ); + + //decode and flatten the data + $stats = array(); + foreach (json_decode($data, true) as $stat) { + $stats[$stat['name']] = $stat['value']; + } + d_echo($stats); + + // only the stats we store in rrd + $fields = array(); + foreach ($rrd_def as $key => $value) { + if (isset($stats[$key])) { + $fields[$key] = $stats[$key]; + } else { + $fields[$key] = 'U'; + } + } + + $rrd_name = array('app', 'powerdns', 'recursor', $app_id); + $tags = compact('name', 'app_id', 'rrd_name', 'rrd_def'); + data_update($device, 'app', $tags, $fields); +} + +unset($data, $stats, $rrd_def, $rrd_name, $rrd_keys, $tags, $fields); From a8d66ddf72818b49722b15591428edc11fe00da3 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Fri, 22 Jul 2016 15:36:19 -0500 Subject: [PATCH 2/6] Add Applications docs --- doc/Extensions/Applications.md | 19 +++++++++++++++++++ doc/mkdocs.yml | 4 ++++ 2 files changed, 23 insertions(+) create mode 100644 doc/Extensions/Applications.md create mode 100644 doc/mkdocs.yml diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md new file mode 100644 index 0000000000..c85a1dc36e --- /dev/null +++ b/doc/Extensions/Applications.md @@ -0,0 +1,19 @@ +Application Monitoring +---------------------- + +LibreNMS supports monitoring application statistics through two methods the [Agent](http://docs.librenms.org/Extensions/Agent-Setup/) or direct connection to the device. + +To enable the agent go to device settings -> applications and enable the "unix-agent" +If you are using direct connection to collect statistics, you must manually enable the desired apps in the device settings -> applications page. + +##Applications + +###PowerDNS Recursor +A recursive DNS sever: https://www.powerdns.com/recursor.html +#### Connection +The LibreNMS polling host must be able to connect to port 8082 on the monitored device. +The web-server must be enabled, see the Recursor docs: https://doc.powerdns.com/md/recursor/settings/#webserver +There is currently no way to specify a custom port or password. +#### Agent +Copy powerdns-recursor to the `/usr/lib/check_mk_agent/local` directory. +The user check_mk is running as must be able to run `rec_control get-all` \ No newline at end of file diff --git a/doc/mkdocs.yml b/doc/mkdocs.yml new file mode 100644 index 0000000000..b61dc496d4 --- /dev/null +++ b/doc/mkdocs.yml @@ -0,0 +1,4 @@ +site_name: LibreNMS +docs_dir: /home/murrant/projects/librenms/doc +pages: +- Home: index.md From d83fde53d8101b600002b4c06b25a9187cf65056 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Fri, 22 Jul 2016 18:35:11 -0500 Subject: [PATCH 3/6] Clean up ibm-amm sensors Add power module state Correct state indexes Use numeric oids, but document named oids --- .../sensors/fanspeeds/ibm-amm.inc.php | 30 ++--- .../discovery/sensors/states/ibm-amm.inc.php | 118 ++++++++++++++---- .../sensors/temperatures/ibm-amm.inc.php | 4 +- 3 files changed, 110 insertions(+), 42 deletions(-) diff --git a/includes/discovery/sensors/fanspeeds/ibm-amm.inc.php b/includes/discovery/sensors/fanspeeds/ibm-amm.inc.php index a2bd990c99..b9d6729af3 100644 --- a/includes/discovery/sensors/fanspeeds/ibm-amm.inc.php +++ b/includes/discovery/sensors/fanspeeds/ibm-amm.inc.php @@ -12,26 +12,22 @@ if ($device['os'] == 'ibm-amm') { - $oids = array('blower1speedRPM', 'blower2speedRPM', 'blower3speedRPM', 'blower4speedRPM'); - d_echo($oids."\n"); - if (!empty($oids)) { + $descr_prefix = 'Blower '; + $oids = array( + '.1.3.6.1.4.1.2.3.51.2.2.3.20.0', // BLADE-MIB:blower1speedRPM + '.1.3.6.1.4.1.2.3.51.2.2.3.21.0', // BLADE-MIB:blower2speedRPM + '.1.3.6.1.4.1.2.3.51.2.2.3.22.0', // BLADE-MIB:blower3speedRPM + '.1.3.6.1.4.1.2.3.51.2.2.3.23.0', // BLADE-MIB:blower4speedRPM + ); - echo 'BLADE-MIB '; - foreach ($oids as $index => $data) { - - if (!empty($data)) { - $value = trim(snmp_get($device, $data.'.0', '-Oqv', 'BLADE-MIB'), '"'); - - if (is_numeric($value)) { - $oid = 'BLADE-MIB::' . $data . '.0'; - $descr = $data; - discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value); - } - - } + echo 'BLADE-MIB '; + foreach ($oids as $index => $oid) { + $value = trim(snmp_get($device, $oid, '-Oqv'), '"'); + if (is_numeric($value)) { + $descr = $descr_prefix . ($index + 1); + discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value); } - } } diff --git a/includes/discovery/sensors/states/ibm-amm.inc.php b/includes/discovery/sensors/states/ibm-amm.inc.php index c9cdb9c57f..bbed4a2a7a 100644 --- a/includes/discovery/sensors/states/ibm-amm.inc.php +++ b/includes/discovery/sensors/states/ibm-amm.inc.php @@ -13,16 +13,25 @@ if ($device['os'] == 'ibm-amm') { $index = 1; + $state_name = 'ibm-amm_BlowerState'; + $state_descr = 'Blower '; $oids = array( - 'blower1State' => '.1.3.6.1.4.1.2.3.51.2.2.3.10.0', - 'blower2State' => '.1.3.6.1.4.1.2.3.51.2.2.3.11.0', - 'blower3State' => '.1.3.6.1.4.1.2.3.51.2.2.3.12.0', - 'blower4State' => '.1.3.6.1.4.1.2.3.51.2.2.3.13.0' + '.1.3.6.1.4.1.2.3.51.2.2.3.10.0', // BLADE-MIB::blower1State.0 + '.1.3.6.1.4.1.2.3.51.2.2.3.11.0', // BLADE-MIB::blower2State.0 + '.1.3.6.1.4.1.2.3.51.2.2.3.12.0', // BLADE-MIB::blower3State.0 + '.1.3.6.1.4.1.2.3.51.2.2.3.13.0', // BLADE-MIB::blower4State.0 ); + /* BLADE-MIB: blower1State + * unknown(0), + * good(1), + * warning(2), + * bad(3) + */ - foreach ($oids as $state_name => $oid) { - + foreach ($oids as $oid) { $state = snmp_get($device, $oid, '-Oqv'); + $descr = $state_descr . $index; + if (!empty($state)) { $state_index_id = create_state_index($state_name); @@ -30,10 +39,10 @@ if ($device['os'] == 'ibm-amm') { if ($state_index_id) { $states = array( - array($state_index_id,'unknown',0,0,3) , - array($state_index_id,'good',1,1,0) , - array($state_index_id,'warning',1,2,1) , - array($state_index_id,'bad',1,3,2) , + array($state_index_id, 'unknown', 0, 0, 3), + array($state_index_id, 'good', 1, 1, 0), + array($state_index_id, 'warning', 1, 2, 1), + array($state_index_id, 'bad', 1, 3, 2), ); foreach($states as $value) { @@ -49,7 +58,7 @@ if ($device['os'] == 'ibm-amm') { }//end if - discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index); + discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $index); //Create Sensor To State Index create_sensor_to_state_index($device, $state_name, $index); $index++; @@ -59,15 +68,25 @@ if ($device['os'] == 'ibm-amm') { }//end foreach $index = 1; + $state_name = 'ibm-amm_BlowerControllerState'; + $state_descr = 'Blower Controller '; $oids = array( - 'blower1ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.30.0', - 'blower2ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.31.0', - 'blower3ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.32.0', - 'blower4ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.33.0'); - - foreach ($oids as $state_name => $oid) { + '.1.3.6.1.4.1.2.3.51.2.2.3.30.0', // BLADE-MIB::blower1ControllerState.0 + '.1.3.6.1.4.1.2.3.51.2.2.3.31.0', // BLADE-MIB::blower2ControllerState.0 + '.1.3.6.1.4.1.2.3.51.2.2.3.32.0', // BLADE-MIB::blower3ControllerState.0 + '.1.3.6.1.4.1.2.3.51.2.2.3.33.0', // BLADE-MIB::blower4ControllerState.0 + ); + /* BLADE-MIB: blower1ControllerState + * operational(0), + * flashing(1), + * notPresent(2), + * communicationError(3), + * unknown(255) + */ + foreach ($oids as $oid) { $state = snmp_get($device, $oid, '-Oqv'); + $descr = $state_descr . $index; if (is_numeric($state) && $state != 2) { @@ -76,11 +95,11 @@ if ($device['os'] == 'ibm-amm') { if ($state_index_id) { $states = array( - array($state_index_id,'operational',0,0,0), - array($state_index_id,'flashing',1,1,1), - array($state_index_id,'notPresent',1,2,2), - array($state_index_id,'communicationError',1,3,2), - array($state_index_id,'unknown',1,4,2), + array($state_index_id, 'operational', 1, 0, 0), + array($state_index_id, 'flashing', 1, 1, 1), + array($state_index_id, 'notPresent', 1, 2, -1), + array($state_index_id, 'communicationError', 1, 3, 2), + array($state_index_id, 'unknown', 0, 255, 3), ); foreach($states as $value) { @@ -96,7 +115,7 @@ if ($device['os'] == 'ibm-amm') { }//end if - discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index); + discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $index); //Create Sensor To State Index create_sensor_to_state_index($device, $state_name, $index); $index++; @@ -105,4 +124,57 @@ if ($device['os'] == 'ibm-amm') { }//end foreach + $index = 1; + $state_name = 'ibm-amm_PowerModuleState'; + $state_descr = 'Power Module '; + $powerModuleStateOid= '.1.3.6.1.4.1.2.3.51.2.2.4.1.1.3'; // BLADE-MIB::powerModuleState + $data = snmpwalk_cache_oid_num($device, $powerModuleStateOid, array()); + + /* BLADE-MIB: powerModuleState + * unknown(0), + * good(1), + * warning(2), + * notAvailable(3), + * critical(4) + */ + foreach ($data as $oid => $array) { + $state = current($array); // get the first (and only) item from the array + $descr = $state_descr . $index; + + if (is_numeric($state) && $state != 3) { + + $state_index_id = create_state_index($state_name); + + if ($state_index_id) { + + $states = array( + array($state_index_id, 'unknown', 0, 0, 3), + array($state_index_id, 'good', 1, 1, 0), + array($state_index_id, 'warning', 1, 2, 1), + array($state_index_id, 'notAvailable', 1, 3, -1), + array($state_index_id, 'critical', 1, 4, 2), + ); + + foreach ($states as $value) { + $insert = array( + 'state_index_id' => $value[0], + 'state_descr' => $value[1], + 'state_draw_graph' => $value[2], + 'state_value' => $value[3], + 'state_generic_value' => $value[4] + ); + dbInsert($insert, 'state_translations'); + }//end foreach + + }//end if + + discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, + null, null, $state, 'snmp', $index); + //Create Sensor To State Index + create_sensor_to_state_index($device, $state_name, $index); + $index++; + + }//end if + }//end foreach + }//end if diff --git a/includes/discovery/sensors/temperatures/ibm-amm.inc.php b/includes/discovery/sensors/temperatures/ibm-amm.inc.php index 45becf70e7..fc27f27f37 100644 --- a/includes/discovery/sensors/temperatures/ibm-amm.inc.php +++ b/includes/discovery/sensors/temperatures/ibm-amm.inc.php @@ -11,7 +11,7 @@ */ if ($device['os'] == 'ibm-amm') { - $oid = 'BLADE-MIB::mmTemp.0'; + $oid = '.1.3.6.1.4.1.2.3.51.2.2.1.1.2.0'; // BLADE-MIB::mmTemp.0 $mmtemp = snmp_get($device, $oid, '-Oqv'); preg_match('/[\d\.]+/', $mmtemp, $temp_response); @@ -28,7 +28,7 @@ if ($device['os'] == 'ibm-amm') { discover_sensor($valid['sensor'], 'temperature', $device, $oid, $oid, 'ibm-amm', $descr, $divisor, '1', null, null, null, null, $current); } - $oid = 'BLADE-MIB::frontPanelTemp.0'; + $oid = '.1.3.6.1.4.1.2.3.51.2.2.1.5.1.0'; // BLADE-MIB::frontPanelTemp.0 $fptemp = snmp_get($device, $oid, '-Oqv'); preg_match('/[\d\.]+/', $fptemp, $temp_response); From 52d5e82379802f3afc76dc4f956191000067cbf2 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Sun, 24 Jul 2016 21:45:11 -0500 Subject: [PATCH 4/6] Remove my Applications.md --- doc/Extensions/Applications.md | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 doc/Extensions/Applications.md diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md deleted file mode 100644 index c85a1dc36e..0000000000 --- a/doc/Extensions/Applications.md +++ /dev/null @@ -1,19 +0,0 @@ -Application Monitoring ----------------------- - -LibreNMS supports monitoring application statistics through two methods the [Agent](http://docs.librenms.org/Extensions/Agent-Setup/) or direct connection to the device. - -To enable the agent go to device settings -> applications and enable the "unix-agent" -If you are using direct connection to collect statistics, you must manually enable the desired apps in the device settings -> applications page. - -##Applications - -###PowerDNS Recursor -A recursive DNS sever: https://www.powerdns.com/recursor.html -#### Connection -The LibreNMS polling host must be able to connect to port 8082 on the monitored device. -The web-server must be enabled, see the Recursor docs: https://doc.powerdns.com/md/recursor/settings/#webserver -There is currently no way to specify a custom port or password. -#### Agent -Copy powerdns-recursor to the `/usr/lib/check_mk_agent/local` directory. -The user check_mk is running as must be able to run `rec_control get-all` \ No newline at end of file From ab8452e7f8fceffed7c93321dfe4f1fd85e7e48b Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Sun, 24 Jul 2016 22:20:43 -0500 Subject: [PATCH 5/6] Add PowerDNS Recursor docs to Agent-Setup.md --- doc/Extensions/Agent-Setup.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/Extensions/Agent-Setup.md b/doc/Extensions/Agent-Setup.md index 767e179bf2..17678a311d 100644 --- a/doc/Extensions/Agent-Setup.md +++ b/doc/Extensions/Agent-Setup.md @@ -133,3 +133,15 @@ location /nginx-status { } ``` + +### PowerDNS Recursor +A recursive DNS sever: https://www.powerdns.com/recursor.html + +#### Direct Connection +The LibreNMS polling host must be able to connect to port 8082 on the monitored device. +The web-server must be enabled, see the Recursor docs: https://doc.powerdns.com/md/recursor/settings/#webserver +There is currently no way to specify a custom port or password. + +#### Agent +Copy powerdns-recursor to the `/usr/lib/check_mk_agent/local` directory. +The user check_mk is running as must be able to run `rec_control get-all` From f3de717023a487bc1739a6a883688b9e809376d0 Mon Sep 17 00:00:00 2001 From: Tony Murray Date: Mon, 25 Jul 2016 20:16:55 -0500 Subject: [PATCH 6/6] Remove accidental mkdocs.yml --- doc/mkdocs.yml | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 doc/mkdocs.yml diff --git a/doc/mkdocs.yml b/doc/mkdocs.yml deleted file mode 100644 index b61dc496d4..0000000000 --- a/doc/mkdocs.yml +++ /dev/null @@ -1,4 +0,0 @@ -site_name: LibreNMS -docs_dir: /home/murrant/projects/librenms/doc -pages: -- Home: index.md