diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index bc2361123b..6d5518dd35 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -12,7 +12,8 @@ Different applications support a variety of ways collect data: by direct connect 1. [Memcached](#memcached) - SNMP extend 1. [MySQL](#mysql) - Agent 1. [NGINX](#nginx) - Agent -1. [NTPD](#ntpd-server) - SNMP extend, Agent +1. [NTP Client](#ntp-client) - SNMP extend +1. [NTP Server](#ntp-server) - SNMP extend 1. [OS Updates](#os-updates) - SNMP extend 1. [PowerDNS](#powerdns) - Agent 1. [PowerDNS Recursor](#powerdns-recursor) - Direct, Agent @@ -151,25 +152,39 @@ location /nginx-status { ``` - -### NTPD Server -Supports NTPD Server (not client, that is separate) +### NTP Client +A shell script that gets stats from ntp client. ##### SNMP Extend 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 +wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/ntp-client.sh -O /opt/ntp-client.sh ``` -2. Make the script executable (chmod +x /etc/snmp/ntdp-server.php) +2. Make the script executable (chmod +x /opt/ntp-client.sh) 3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add: ``` -extend ntpdserver /etc/snmp/ntpd-server.php +extend ntp-client /etc/snmp/ntp-client.sh ``` 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. +5. On the device page in Librenms, edit your host and check the `NTP Client` under the Applications tab. -##### Agent -Support is built into the agent, and this app will be automatically enabled. + + +### NTP Server (NTPD) +A shell script that gets stats from ntp server (ntpd). + +##### SNMP Extend +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/ntp-server.sh -O /opt/ntp-server.sh +``` +2. Make the script executable (chmod +x /opt/ntp-server.sh) +3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add: +``` +extend ntp-server /etc/snmp/ntp-server.sh +``` +4. Restart snmpd on your host +5. On the device page in Librenms, edit your host and check the `NTP Server` under the Applications tab. diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index dfa560ab59..e8e05772a9 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -73,8 +73,11 @@ function nicecase($item) case 'nfs-v3-stats': return 'NFS v3 Stats'; - case 'ntpd': - return 'NTPD (Server)'; + case 'ntp-client': + return 'NTP Client'; + + case 'ntp-server': + return 'NTP Server'; case 'os-updates': return 'OS Updates'; diff --git a/html/includes/graphs/application/ntpclient_freq.inc.php b/html/includes/graphs/application/ntp-client_freq.inc.php similarity index 93% rename from html/includes/graphs/application/ntpclient_freq.inc.php rename to html/includes/graphs/application/ntp-client_freq.inc.php index cfd0430b28..2866851713 100644 --- a/html/includes/graphs/application/ntpclient_freq.inc.php +++ b/html/includes/graphs/application/ntp-client_freq.inc.php @@ -9,7 +9,7 @@ $colour_line = 'B3D0DB'; $colour_area_max = 'FFEE99'; $graph_max = 100; $unit_text = 'Frequency'; -$ntpclient_rrd = rrd_name($device['hostname'], array('app', 'ntpclient', $app['app_id'])); +$ntpclient_rrd = rrd_name($device['hostname'], array('app', 'ntp-client', $app['app_id'])); if (rrdtool_check_rrd_exists($ntpclient_rrd)) { $rrd_filename = $ntpclient_rrd; diff --git a/html/includes/graphs/application/ntpclient_stats.inc.php b/html/includes/graphs/application/ntp-client_stats.inc.php similarity index 90% rename from html/includes/graphs/application/ntpclient_stats.inc.php rename to html/includes/graphs/application/ntp-client_stats.inc.php index 2a6750c9ca..ba29f6c5c1 100644 --- a/html/includes/graphs/application/ntpclient_stats.inc.php +++ b/html/includes/graphs/application/ntp-client_stats.inc.php @@ -5,7 +5,7 @@ require 'includes/graphs/common.inc.php'; $colours = 'mixed'; $nototal = (($width < 224) ? 1 : 0); $unit_text = 'Milliseconds'; -$rrd_filename = rrd_name($device['hostname'], array('app', 'ntpclient', $app['app_id'])); +$rrd_filename = rrd_name($device['hostname'], array('app', 'ntp-client', $app['app_id'])); $array = array( 'offset' => array('descr' => 'Offset'), 'jitter' => array('descr' => 'Jitter'), diff --git a/html/includes/graphs/application/ntpdserver_bits.inc.php b/html/includes/graphs/application/ntp-server_bits.inc.php similarity index 67% rename from html/includes/graphs/application/ntpdserver_bits.inc.php rename to html/includes/graphs/application/ntp-server_bits.inc.php index f238dfd0f3..edbb2e8e46 100644 --- a/html/includes/graphs/application/ntpdserver_bits.inc.php +++ b/html/includes/graphs/application/ntp-server_bits.inc.php @@ -1,18 +1,9 @@ array('descr' => 'Received'), 'buffer_used' => array('descr' => 'Used'), diff --git a/html/includes/graphs/application/ntpdserver_freq.inc.php b/html/includes/graphs/application/ntp-server_freq.inc.php similarity index 93% rename from html/includes/graphs/application/ntpdserver_freq.inc.php rename to html/includes/graphs/application/ntp-server_freq.inc.php index 59f6f12f86..3ab35406ac 100644 --- a/html/includes/graphs/application/ntpdserver_freq.inc.php +++ b/html/includes/graphs/application/ntp-server_freq.inc.php @@ -9,7 +9,7 @@ $colour_line = 'B3D0DB'; $colour_area_max = 'FFEE99'; $graph_max = 100; $unit_text = 'Frequency'; -$ntpdserver_rrd = rrd_name($device['hostname'], array('app', 'ntpdserver', $app['app_id'])); +$ntpdserver_rrd = rrd_name($device['hostname'], array('app', 'ntp-server', $app['app_id'])); if (rrdtool_check_rrd_exists($ntpdserver_rrd)) { $rrd_filename = $ntpdserver_rrd; diff --git a/html/includes/graphs/application/ntpdserver_packets.inc.php b/html/includes/graphs/application/ntp-server_packets.inc.php similarity index 87% rename from html/includes/graphs/application/ntpdserver_packets.inc.php rename to html/includes/graphs/application/ntp-server_packets.inc.php index e60fceeafa..f70ee802f7 100644 --- a/html/includes/graphs/application/ntpdserver_packets.inc.php +++ b/html/includes/graphs/application/ntp-server_packets.inc.php @@ -5,7 +5,7 @@ require 'includes/graphs/common.inc.php'; $scale_min = 0; $nototal = (($width < 224) ? 1 : 0); $unit_text = 'Packets'; -$rrd_filename = rrd_name($device['hostname'], array('app', 'ntpdserver', $app['app_id'])); +$rrd_filename = rrd_name($device['hostname'], array('app', 'ntp-server', $app['app_id'])); $array = array( 'packets_drop' => array( 'descr' => 'Dropped', @@ -31,5 +31,4 @@ if (rrdtool_check_rrd_exists($rrd_filename)) { echo "file missing: $file"; } -// include("includes/graphs/generic_multi_line.inc.php"); require 'includes/graphs/generic_multi_simplex_seperated.inc.php'; diff --git a/html/includes/graphs/application/ntpdserver_stats.inc.php b/html/includes/graphs/application/ntp-server_stats.inc.php similarity index 93% rename from html/includes/graphs/application/ntpdserver_stats.inc.php rename to html/includes/graphs/application/ntp-server_stats.inc.php index 83c5d3d3ac..e3d41fd98e 100644 --- a/html/includes/graphs/application/ntpdserver_stats.inc.php +++ b/html/includes/graphs/application/ntp-server_stats.inc.php @@ -5,7 +5,7 @@ require 'includes/graphs/common.inc.php'; $colours = 'mixed'; $nototal = (($width < 224) ? 1 : 0); $unit_text = 'Milliseconds'; -$rrd_filename = rrd_name($device['hostname'], array('app', 'ntpdserver', $app['app_id'])); +$rrd_filename = rrd_name($device['hostname'], array('app', 'ntp-server', $app['app_id'])); $array = array( 'offset' => array('descr' => 'Offset'), 'jitter' => array('descr' => 'Jitter'), diff --git a/html/includes/graphs/application/ntpdserver_stratum.inc.php b/html/includes/graphs/application/ntp-server_stratum.inc.php similarity index 93% rename from html/includes/graphs/application/ntpdserver_stratum.inc.php rename to html/includes/graphs/application/ntp-server_stratum.inc.php index aaf92c0287..bab9802920 100644 --- a/html/includes/graphs/application/ntpdserver_stratum.inc.php +++ b/html/includes/graphs/application/ntp-server_stratum.inc.php @@ -9,7 +9,7 @@ $colour_line = '880000'; $colour_area_max = 'FFCCCC'; $graph_max = 0; $unit_text = 'Stratum'; -$ntpdserver_rrd = rrd_name($device['hostname'], array('app', 'ntpdserver', $app['app_id'])); +$ntpdserver_rrd = rrd_name($device['hostname'], array('app', 'ntp-server', $app['app_id'])); if (rrdtool_check_rrd_exists($ntpdserver_rrd)) { $rrd_filename = $ntpdserver_rrd; diff --git a/html/includes/graphs/application/ntp-server_uptime.inc.php b/html/includes/graphs/application/ntp-server_uptime.inc.php new file mode 100644 index 0000000000..aeae053c10 --- /dev/null +++ b/html/includes/graphs/application/ntp-server_uptime.inc.php @@ -0,0 +1,18 @@ + 'NTP Client - Statistics', - 'ntpclient_freq' => 'NTP Client - Frequency', + 'ntp-client_stats' => 'NTP Client - Statistics', + 'ntp-client_freq' => 'NTP Client - Frequency', ); foreach ($graphs as $key => $text) { diff --git a/html/pages/device/apps/ntpd.inc.php b/html/pages/device/apps/ntp-server.inc.php similarity index 61% rename from html/pages/device/apps/ntpd.inc.php rename to html/pages/device/apps/ntp-server.inc.php index 018fefeed5..74a141ca55 100644 --- a/html/pages/device/apps/ntpd.inc.php +++ b/html/pages/device/apps/ntp-server.inc.php @@ -3,13 +3,13 @@ global $config; $graphs = array( - 'ntpdserver_stats' => 'NTPD Server - Statistics', - 'ntpdserver_freq' => 'NTPD Server - Frequency', - 'ntpdserver_stratum' => 'NTPD Server - Stratum', - 'ntpdserver_buffer' => 'NTPD Server - Buffer', - 'ntpdserver_bits' => 'NTPD Server - Packets Sent/Received', - 'ntpdserver_packets' => 'NTPD Server - Packets Dropped/Ignored', - 'ntpdserver_uptime' => 'NTPD Server - Uptime', + 'ntp-server_stats' => 'NTPD Server - Statistics', + 'ntp-server_freq' => 'NTPD Server - Frequency', + 'ntp-server_stratum' => 'NTPD Server - Stratum', + 'ntp-server_buffer' => 'NTPD Server - Buffer', + 'ntp-server_bits' => 'NTPD Server - Packets Sent/Received', + 'ntp-server_packets' => 'NTPD Server - Packets Dropped/Ignored', + 'ntp-server_uptime' => 'NTPD Server - Uptime', ); foreach ($graphs as $key => $text) { diff --git a/includes/polling/applications/ntp-client.inc.php b/includes/polling/applications/ntp-client.inc.php index 820648cf22..5186ba32fa 100644 --- a/includes/polling/applications/ntp-client.inc.php +++ b/includes/polling/applications/ntp-client.inc.php @@ -1,13 +1,11 @@ $offset, + 'offset' => $offset, 'frequency' => $frequency, - 'jitter' => $jitter, - 'noise' => $noise, + 'jitter' => $jitter, + 'noise' => $noise, 'stability' => $stability, ); diff --git a/includes/polling/applications/ntp-server.inc.php b/includes/polling/applications/ntp-server.inc.php new file mode 100644 index 0000000000..5bfbb585b4 --- /dev/null +++ b/includes/polling/applications/ntp-server.inc.php @@ -0,0 +1,49 @@ + $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', 'rrd_name', 'rrd_def'); +data_update($device, 'app', $tags, $fields); diff --git a/includes/polling/applications/ntpd.inc.php b/includes/polling/applications/ntpd.inc.php deleted file mode 100644 index 2a3e5bdf2c..0000000000 --- a/includes/polling/applications/ntpd.inc.php +++ /dev/null @@ -1,58 +0,0 @@ - $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', 'rrd_name', 'rrd_def'); -data_update($device, 'app', $tags, $fields); diff --git a/includes/polling/unix-agent.inc.php b/includes/polling/unix-agent.inc.php index 7a964946cf..54413614eb 100644 --- a/includes/polling/unix-agent.inc.php +++ b/includes/polling/unix-agent.inc.php @@ -57,7 +57,6 @@ if ($device['os_group'] == 'unix') { "ceph", "mysql", "nginx", - "ntpd", "powerdns", "powerdns-recursor", "proxmox",