mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
NTPD Application
Support the unix agent Add to documention. Renamed so it will be automatically enabled by the unix-agent.
This commit is contained in:
@@ -7,6 +7,7 @@ Different applications support a variety of ways collect data: by direct connect
|
||||
1. [BIND9/named](#bind9-aka-named) - Agent
|
||||
2. [MySQL](#mysql) - Agent
|
||||
3. [NGINX](#nginx) - Agent
|
||||
4. [NTPD] (#ntpd-server) - extend SNMP, Agent
|
||||
4. [PowerDNS](#powerdns) - Agent
|
||||
5. [PowerDNS Recursor](#powerdns-recursor) - Agent
|
||||
6. [TinyDNS/djbdns](#tinydns-aka-djbdns) - Agent
|
||||
@@ -83,6 +84,25 @@ location /nginx-status {
|
||||
}
|
||||
```
|
||||
|
||||
### NTPD Server
|
||||
Supports NTPD Server (not client, that is separate)
|
||||
|
||||
##### Extend SNMP
|
||||
1. Download the script onto the desired host (the host must be added to LibreNMS devices)
|
||||
```
|
||||
wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/ntpd-server.php -o /etc/snmp/ntpd-server.php
|
||||
```
|
||||
2. Make the script executable (chmod +x /etc/snmp/ntdp-server.php)
|
||||
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
|
||||
```
|
||||
extend ntpdserver /etc/snmp/ntpd-server.php
|
||||
```
|
||||
4. Restart snmpd on your host
|
||||
5. On the device page in Librenms, edit your host and check the `Ntpd-server` under the Applications tab.
|
||||
|
||||
##### Agent
|
||||
Support is built into the agent, and this app will be automatically enabled.
|
||||
|
||||
### PowerDNS
|
||||
An authoritative DNS server: https://www.powerdns.com/auth.html
|
||||
|
||||
|
@@ -71,6 +71,9 @@ function nicecase($item)
|
||||
case 'nfs-v3-stats':
|
||||
return 'NFS v3 Stats';
|
||||
|
||||
case 'ntpd':
|
||||
return 'NTPD (Server)';
|
||||
|
||||
case 'os-updates':
|
||||
return 'OS Updates';
|
||||
|
||||
|
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
|
||||
// Polls ntpd-server statistics from script via SNMP
|
||||
$name = 'ntpdserver';
|
||||
$app_id = $app['app_id'];
|
||||
|
||||
$options = '-O qv';
|
||||
$oid = 'nsExtendOutputFull.10.110.116.112.100.115.101.114.118.101.114';
|
||||
$mib = 'NET-SNMP-EXTEND-MIB';
|
||||
$ntpdserver = snmp_get($device, $oid, $options, $mib);
|
||||
|
||||
echo ' ntpd-server';
|
||||
|
||||
list ($stratum, $offset, $frequency, $jitter, $noise, $stability, $uptime,
|
||||
$buffer_recv, $buffer_free, $buffer_used, $packets_drop, $packets_ignore,
|
||||
$packets_recv, $packets_sent) = explode("\n", $ntpdserver);
|
||||
|
||||
$rrd_name = array('app', $name, $app_id);
|
||||
$rrd_def = array(
|
||||
'DS:stratum:GAUGE:600:-1000:1000',
|
||||
'DS:offset:GAUGE:600:-1000:1000',
|
||||
'DS:frequency:GAUGE:600:-1000:1000',
|
||||
'DS:jitter:GAUGE:600:-1000:1000',
|
||||
'DS:noise:GAUGE:600:-1000:1000',
|
||||
'DS:stability:GAUGE:600:-1000:1000',
|
||||
'DS:uptime:GAUGE:600:0:125000000000',
|
||||
'DS:buffer_recv:GAUGE:600:0:100000',
|
||||
'DS:buffer_free:GAUGE:600:0:100000',
|
||||
'DS:buffer_used:GAUGE:600:0:100000',
|
||||
'DS:packets_drop:DERIVE:600:0:125000000000',
|
||||
'DS:packets_ignore:DERIVE:600:0:125000000000',
|
||||
'DS:packets_recv:DERIVE:600:0:125000000000',
|
||||
'DS:packets_sent:DERIVE:600:0:125000000000'
|
||||
);
|
||||
|
||||
$fields = array(
|
||||
'stratum' => $stratum,
|
||||
'offset' => $offset,
|
||||
'frequency' => $frequency,
|
||||
'jitter' => $jitter,
|
||||
'noise' => $noise,
|
||||
'stability' => $stability,
|
||||
'uptime' => $uptime,
|
||||
'buffer_recv' => $buffer_recv,
|
||||
'buffer_free' => $buffer_free,
|
||||
'buffer_used' => $buffer_used,
|
||||
'packets_drop' => $packets_drop,
|
||||
'packets_ignore' => $packets_ignore,
|
||||
'packets_recv' => $packets_recv,
|
||||
'packets_sent' => $packets_sent,
|
||||
);
|
||||
|
||||
$tags = compact('name', 'app_id', 'rdd_name', 'rrd_def');
|
||||
data_update($device, 'app', $tags, $fields);
|
58
includes/polling/applications/ntpd.inc.php
Normal file
58
includes/polling/applications/ntpd.inc.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
// Polls ntpd-server statistics from script via SNMP
|
||||
$name = 'ntpdserver';
|
||||
$app_id = $app['app_id'];
|
||||
|
||||
echo ' ntpd-server';
|
||||
|
||||
$rrd_name = array('app', $name, $app_id);
|
||||
$rrd_def = array(
|
||||
'DS:stratum:GAUGE:600:-1000:1000',
|
||||
'DS:offset:GAUGE:600:-1000:1000',
|
||||
'DS:frequency:GAUGE:600:-1000:1000',
|
||||
'DS:jitter:GAUGE:600:-1000:1000',
|
||||
'DS:noise:GAUGE:600:-1000:1000',
|
||||
'DS:stability:GAUGE:600:-1000:1000',
|
||||
'DS:uptime:GAUGE:600:0:125000000000',
|
||||
'DS:buffer_recv:GAUGE:600:0:100000',
|
||||
'DS:buffer_free:GAUGE:600:0:100000',
|
||||
'DS:buffer_used:GAUGE:600:0:100000',
|
||||
'DS:packets_drop:DERIVE:600:0:125000000000',
|
||||
'DS:packets_ignore:DERIVE:600:0:125000000000',
|
||||
'DS:packets_recv:DERIVE:600:0:125000000000',
|
||||
'DS:packets_sent:DERIVE:600:0:125000000000'
|
||||
);
|
||||
|
||||
if ($agent_data['app']['ntpd']) {
|
||||
$data = explode("\n", $agent_data['app']['ntpd']);
|
||||
$fields = array();
|
||||
foreach ($data as $line) {
|
||||
$split = explode(':', $line);
|
||||
$fields[$split[0]] = $split[1];
|
||||
}
|
||||
} else {
|
||||
// NET-SNMP-EXTEND-MIB::nsExtendOutputFull."ntpdserver"
|
||||
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.10.110.116.112.100.115.101.114.118.101.114';
|
||||
$data = explode("\n", snmp_get($device, $oid, '-Oqv'));
|
||||
|
||||
$fields = array(
|
||||
'stratum' => $data[0],
|
||||
'offset' => $data[1],
|
||||
'frequency' => $data[2],
|
||||
'jitter' => $data[3],
|
||||
'noise' => $data[4],
|
||||
'stability' => $data[5],
|
||||
'uptime' => $data[6],
|
||||
'buffer_recv' => $data[7],
|
||||
'buffer_free' => $data[8],
|
||||
'buffer_used' => $data[9],
|
||||
'packets_drop' => $data[10],
|
||||
'packets_ignore' => $data[11],
|
||||
'packets_recv' => $data[12],
|
||||
'packets_sent' => $data[13],
|
||||
);
|
||||
}
|
||||
|
||||
$tags = compact('name', 'app_id', 'rdd_name', 'rrd_def');
|
||||
data_update($device, 'app', $tags, $fields);
|
1
sql-schema/127.sql
Normal file
1
sql-schema/127.sql
Normal file
@@ -0,0 +1 @@
|
||||
UPDATE `applications` SET `app_type` = 'ntpd' WHERE `applications`.`app_type` = 'ntpd-server';
|
Reference in New Issue
Block a user