From 91b1f28fb5331b9770d3c7a64a77b712a41f2a45 Mon Sep 17 00:00:00 2001 From: Mark Schouten Date: Mon, 23 Nov 2015 14:12:46 +0100 Subject: [PATCH] Allow the powerdns App to be set via the unix agent. Uses the agent in https://github.com/librenms/librenms-agent/pull/16 --- includes/polling/applications/powerdns.inc.php | 7 ++++++- includes/polling/unix-agent.inc.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/polling/applications/powerdns.inc.php b/includes/polling/applications/powerdns.inc.php index 3a7c728c2..0ffca6843 100644 --- a/includes/polling/applications/powerdns.inc.php +++ b/includes/polling/applications/powerdns.inc.php @@ -6,7 +6,12 @@ $options = '-O qv'; $mib = 'NET-SNMP-EXTEND-MIB'; $oid = 'nsExtendOutputFull.8.112.111.119.101.114.100.110.115'; -$powerdns = snmp_get($device, $oid, $options, $mib); +if ($agent_data['app']['powerdns']) { + $powerdns = $agent_data['app']['powerdns']; +} +else { + $powerdns = snmp_get($device, $oid, $options, $mib); +} echo ' powerdns'; diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php index bdaf7df49..70f067000 100644 --- a/includes/polling/unix-agent.inc.php +++ b/includes/polling/unix-agent.inc.php @@ -63,6 +63,7 @@ if ($device['os_group'] == 'unix') { "mysql", "nginx", "bind", + "powerdns", "proxmox", "tinydns"); @@ -113,7 +114,7 @@ if ($device['os_group'] == 'unix') { if (file_exists("includes/polling/applications/$key.inc.php")) { d_echo("Enabling $key for ".$device['hostname']." if not yet enabled\n"); - if (in_array($key, array('apache', 'mysql', 'nginx', 'proxmox', 'ceph'))) { + if (in_array($key, array('apache', 'mysql', 'nginx', 'proxmox', 'ceph', 'powerdns'))) { if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], $key)) == '0') { echo "Found new application '$key'\n"; dbInsert(array('device_id' => $device['device_id'], 'app_type' => $key, 'app_status' => '', 'app_instance' => ''), 'applications');