diff --git a/html/includes/graphs/application/ntpclient_freq.inc.php b/html/includes/graphs/application/ntpclient_freq.inc.php new file mode 100644 index 0000000000..fc57bf1be4 --- /dev/null +++ b/html/includes/graphs/application/ntpclient_freq.inc.php @@ -0,0 +1,20 @@ + diff --git a/html/includes/graphs/application/ntpclient_stats.inc.php b/html/includes/graphs/application/ntpclient_stats.inc.php new file mode 100644 index 0000000000..bf6f3f0c4a --- /dev/null +++ b/html/includes/graphs/application/ntpclient_stats.inc.php @@ -0,0 +1,32 @@ + array('descr' => 'Offset'), + 'jitter' => array('descr' => 'Jitter'), + 'noise' => array('descr' => 'Noise'), + 'stability' => array('descr' => 'Stability') + ); + + $i = 0; + + if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; + $i++; + } + } else { + echo("file missing: $file"); + } + + include("includes/graphs/generic_multi_line.inc.php"); + +?> diff --git a/html/includes/graphs/application/ntpdserver_bits.inc.php b/html/includes/graphs/application/ntpdserver_bits.inc.php new file mode 100644 index 0000000000..2a4e5a6d8f --- /dev/null +++ b/html/includes/graphs/application/ntpdserver_bits.inc.php @@ -0,0 +1,33 @@ + diff --git a/html/includes/graphs/application/ntpdserver_freq.inc.php b/html/includes/graphs/application/ntpdserver_freq.inc.php new file mode 100644 index 0000000000..36bf610b7b --- /dev/null +++ b/html/includes/graphs/application/ntpdserver_freq.inc.php @@ -0,0 +1,20 @@ + diff --git a/html/includes/graphs/application/ntpdserver_packets.inc.php b/html/includes/graphs/application/ntpdserver_packets.inc.php new file mode 100644 index 0000000000..f6316bae4a --- /dev/null +++ b/html/includes/graphs/application/ntpdserver_packets.inc.php @@ -0,0 +1,31 @@ + array('descr' => 'Dropped', 'colour' => '880000FF'), + 'packets_ignore' => array('descr' => 'Ignored', 'colour' => 'FF8800FF') + ); + + $i = 0; + + if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $vars['colour']; + $i++; + } + } else { + echo("file missing: $file"); + } + +// include("includes/graphs/generic_multi_line.inc.php"); + include("includes/graphs/generic_multi_simplex_seperated.inc.php"); + +?> diff --git a/html/includes/graphs/application/ntpdserver_stats.inc.php b/html/includes/graphs/application/ntpdserver_stats.inc.php new file mode 100644 index 0000000000..3bc8bd641f --- /dev/null +++ b/html/includes/graphs/application/ntpdserver_stats.inc.php @@ -0,0 +1,32 @@ + array('descr' => 'Offset'), + 'jitter' => array('descr' => 'Jitter'), + 'noise' => array('descr' => 'Noise'), + 'stability' => array('descr' => 'Stability') + ); + + $i = 0; + + if (is_file($rrd_filename)) { + foreach ($array as $ds => $vars) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $vars['descr']; + $rrd_list[$i]['ds'] = $ds; + $rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i]; + $i++; + } + } else { + echo("file missing: $file"); + } + + include("includes/graphs/generic_multi_line.inc.php"); + +?> diff --git a/html/includes/graphs/application/ntpdserver_stratum.inc.php b/html/includes/graphs/application/ntpdserver_stratum.inc.php new file mode 100644 index 0000000000..3c2b5589f5 --- /dev/null +++ b/html/includes/graphs/application/ntpdserver_stratum.inc.php @@ -0,0 +1,20 @@ + diff --git a/html/includes/graphs/application/ntpdserver_uptime.inc.php b/html/includes/graphs/application/ntpdserver_uptime.inc.php new file mode 100644 index 0000000000..97ab24dcff --- /dev/null +++ b/html/includes/graphs/application/ntpdserver_uptime.inc.php @@ -0,0 +1,36 @@ + diff --git a/html/includes/graphs/application/powerdns_latency.inc.php b/html/includes/graphs/application/powerdns_latency.inc.php index aee53a538c..792b6c0b31 100644 --- a/html/includes/graphs/application/powerdns_latency.inc.php +++ b/html/includes/graphs/application/powerdns_latency.inc.php @@ -4,8 +4,8 @@ $scale_min = 0; $ds = "latency"; - $colour_area = "6699FF"; - $colour_line = "336699"; + $colour_area = "F6F6F6"; + $colour_line = "B3D0DB"; $colour_area_max = "FFEE99"; $graph_max = 100; $unit_text = "Latency"; diff --git a/html/pages/about.inc.php b/html/pages/about.inc.php index 452763976f..0ef6521e1c 100644 --- a/html/pages/about.inc.php +++ b/html/pages/about.inc.php @@ -181,6 +181,7 @@ print_optionbar_end(); Jonathan De Graeve SNMP code improvements.
Xiaochi Jin Logo design.
Bruno Pramont Collectd code.
+ Dennis de Houx Application monitors for PowerDNS, Shoutcast, NTPD (Client, Server).
diff --git a/html/pages/device/apps/ntp-client.inc.php b/html/pages/device/apps/ntp-client.inc.php new file mode 100644 index 0000000000..fb0cde384f --- /dev/null +++ b/html/pages/device/apps/ntp-client.inc.php @@ -0,0 +1,21 @@ + 'NTP Client - Statistics', + 'ntpclient_freq' => 'NTP Client - Frequency'); + +foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = "100"; + $graph_array['width'] = "215"; + $graph_array['to'] = $now; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = "application_".$key; + echo('

'.$text.'

'); + echo(""); + include("includes/print-quadgraphs.inc.php"); + echo(""); +} + +?> \ No newline at end of file diff --git a/html/pages/device/apps/ntpd-server.inc.php b/html/pages/device/apps/ntpd-server.inc.php new file mode 100644 index 0000000000..6a0fdadceb --- /dev/null +++ b/html/pages/device/apps/ntpd-server.inc.php @@ -0,0 +1,26 @@ + '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'); + +foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = "100"; + $graph_array['width'] = "215"; + $graph_array['to'] = $now; + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = "application_".$key; + echo('

'.$text.'

'); + echo(""); + include("includes/print-quadgraphs.inc.php"); + echo(""); +} + +?> \ No newline at end of file diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 65d8ffea68..3a02b104db 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -43,7 +43,6 @@ if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["SERVER_PORT"])) $config['title_image'] = "images/observium-logo.png"; $config['stylesheet'] = "css/styles.css"; $config['mono_font'] = "DejaVuSansMono"; -#$config['mono_font'] = "LiberationMono"; $config['favicon'] = "images/observium-icon.png"; $config['header_color'] = "#1F334E"; $config['page_refresh'] = "300"; ## Refresh the page every xx seconds diff --git a/includes/polling/applications/ntp-client.inc.php b/includes/polling/applications/ntp-client.inc.php new file mode 100644 index 0000000000..8a6c5e701a --- /dev/null +++ b/includes/polling/applications/ntp-client.inc.php @@ -0,0 +1,38 @@ + diff --git a/includes/polling/applications/ntpd-server.inc.php b/includes/polling/applications/ntpd-server.inc.php new file mode 100644 index 0000000000..feaf81b49a --- /dev/null +++ b/includes/polling/applications/ntpd-server.inc.php @@ -0,0 +1,47 @@ + diff --git a/scripts/ntp-client.php b/scripts/ntp-client.php new file mode 100644 index 0000000000..dee5d42668 --- /dev/null +++ b/scripts/ntp-client.php @@ -0,0 +1,68 @@ +#!/usr/bin/env php + + ## + ######################################################################################## + + + #### START SETTINGS #### + + $ntpq = "/usr/sbin/ntpq"; + + #### END SETTINGS #### + + + ## + ## DO NOT EDIT BENETH THIS LINE + ## + ######################################################################################## + + $cmd = shell_exec($ntpq." -c rv | grep '^offset'"); + $cmd2 = shell_exec($ntpq." -c rv | grep '^stability'"); + $vars = array(); + $vars2 = array(); + $vars = explode(',', $cmd); + $vars2 = explode(',', $cmd2); + + function doSNMPv2($vars, $vars2) { + $ntp = array(); + foreach ($vars as $item=>$value) { + if (!empty($value)) { + $temp = explode('=', $value); + if (isset($temp[1])) { + $ntp[trim($temp[0])] = trim($temp[1]); + } + } + } + foreach ($vars2 as $item=>$value) { + if (!empty($value)) { + $temp = explode('=', $value); + if (isset($temp[1])) { + $ntp[trim($temp[0])] = trim($temp[1]); + } + } + } + $var['offset'] = (isset($ntp['offset']) ? $ntp['offset'] : "U"); + $var['frequency'] = (isset($ntp['frequency']) ? $ntp['frequency'] : "U"); + $var['jitter'] = (isset($ntp['jitter']) ? $ntp['jitter'] : "U"); + $var['noise'] = (isset($ntp['noise']) ? $ntp['noise'] : "U"); + $var['stability'] = (isset($ntp['stability']) ? $ntp['stability'] : "U"); + foreach ($var as $item=>$count) { + echo $count."\n"; + } + } + + doSNMPv2($vars, $vars2); + +?> diff --git a/scripts/ntpd-server.php b/scripts/ntpd-server.php new file mode 100644 index 0000000000..eb59bcd752 --- /dev/null +++ b/scripts/ntpd-server.php @@ -0,0 +1,81 @@ +#!/usr/bin/env php + + ## + ######################################################################################## + + + #### START SETTINGS #### + + $ntpq = "/usr/sbin/ntpq"; + $ntpdc = "/usr/sbin/ntpdc"; + + #### END SETTINGS #### + + + ## + ## DO NOT EDIT BENETH THIS LINE + ## + ######################################################################################## + + $cmd = shell_exec($ntpq." -c rv"); + $cmd2 = shell_exec($ntpdc." -c iostats"); + $vars = array(); + $vars2 = array(); + $vars = explode(',', $cmd); + $vars2 = eregi_replace(' ', '', $cmd2); + $vars2 = explode("\n", $vars2); + + function doSNMPv2($vars, $vars2) { + $ntpd = array(); + foreach ($vars as $item=>$value) { + if (!empty($value)) { + $temp = explode('=', $value); + if (isset($temp[1])) { + $ntpd[trim($temp[0])] = trim($temp[1]); + } + } + } + foreach ($vars2 as $item=>$value) { + if (!empty($value)) { + $temp = explode(':', $value); + if (isset($temp[1])) { + $ntpd[trim($temp[0])] = trim($temp[1]); + } + } + } + $var['stratum'] = (isset($ntpd['stratum']) ? $ntpd['stratum'] : "U"); + $var['offset'] = (isset($ntpd['offset']) ? $ntpd['offset'] : "U"); + $var['frequency'] = (isset($ntpd['frequency']) ? $ntpd['frequency'] : "U"); + $var['jitter'] = (isset($ntpd['jitter']) ? $ntpd['jitter'] : "U"); + $var['noise'] = (isset($ntpd['noise']) ? $ntpd['noise'] : "U"); + $var['stability'] = (isset($ntpd['stability']) ? $ntpd['stability'] : "U"); + $var['uptime'] = (isset($ntpd['timesincereset']) ? $ntpd['timesincereset'] : "U"); + $var['buffer_recv'] = (isset($ntpd['receivebuffers']) ? $ntpd['receivebuffers'] : "U"); + $var['buffer_free'] = (isset($ntpd['freereceivebuffers']) ? $ntpd['freereceivebuffers'] : "U"); + $var['buffer_used'] = (isset($ntpd['usedreceivebuffers']) ? $ntpd['usedreceivebuffers'] : "U"); + $var['packets_drop'] = (isset($ntpd['droppedpackets']) ? $ntpd['droppedpackets'] : "U"); + $var['packets_ignore'] = (isset($ntpd['ignoredpackets']) ? $ntpd['ignoredpackets'] : "U"); + $var['packets_recv'] = (isset($ntpd['receivedpackets']) ? $ntpd['receivedpackets'] : "U"); + $var['packets_sent'] = (isset($ntpd['packetssent']) ? $ntpd['packetssent'] : "U"); + foreach ($var as $item=>$count) { + echo $count."\n"; + } + } + + //print_r($vars2); + + doSNMPv2($vars, $vars2); + +?>