fixes to ntp application and improvement to common grapher

git-svn-id: http://www.observium.org/svn/observer/trunk@2628 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-09-30 23:06:18 +00:00
parent e50ec1588e
commit dd0e7d3671
3 changed files with 34 additions and 16 deletions

View File

@@ -11,10 +11,12 @@ if ($_GET['title'] == "yes") { $rrd_options .= " --title='".$graph_title."' ";
if (isset($_GET['graph_title'])) { $rrd_options .= " --title='".$_GET['graph_title']."' "; }
if (!$scale_min && !$scale_max) { $rrd_options .= " --alt-autoscale-max"; }
#if (!isset($scale_min) && !isset($scale_max)) { $rrd_options .= " --alt-autoscale-max"; }
if (isset($scale_min)) { $rrd_options .= " -l $scale_min"; }
if (isset($scale_max)) { $rrd_options .= " -u $scale_max"; }
if (isset($scale_rigid)) { $rrd_options .= " -r"; }
$rrd_options .= " -E --start ".$from." --end " . $to . " --width ".$width." --height ".$height." ";
$rrd_options .= $config['rrdgraph_def_text'];

View File

@@ -10,7 +10,7 @@
## Add the following to your snmpd.conf file:
## extend ntpclient /opt/observium/scripts/ntp-client.php
##
## Version 1.0 By:
## Version 1.1 By:
## All In One - Dennis de Houx <info@all-in-one.be>
##
########################################################################################
@@ -19,6 +19,9 @@
#### START SETTINGS ####
$ntpq = "/usr/sbin/ntpq";
# Change this to true if you have clk_jitter, sys_jitter in the ntpq -c rv output
$newstats_style = false;
#### END SETTINGS ####
@@ -35,7 +38,7 @@
$vars = explode(',', $cmd);
$vars2 = explode(',', $cmd2);
function doSNMPv2($vars, $vars2) {
function doSNMPv2($vars, $vars2, $newstats_style) {
$ntp = array();
foreach ($vars as $item=>$value) {
if (!empty($value)) {
@@ -55,14 +58,20 @@
}
$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");
if ($newstats_style) {
$var['jitter'] = (isset($ntp['clk_jitter']) ? $ntp['clk_jitter'] : "U");
$var['noise'] = (isset($ntp['sys_jitter']) ? $ntp['sys_jitter'] : "U");
$var['stability'] = (isset($ntp['clk_wander']) ? $ntp['clk_wander'] : "U");
} else {
$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);
doSNMPv2($vars, $vars2, $newstats_style);
?>

View File

@@ -10,7 +10,7 @@
## Add the following to your snmpd.conf file:
## extend ntpdserver /opt/observium/scripts/ntpd-server.php
##
## Version 1.0 By:
## Version 1.1 By:
## All In One - Dennis de Houx <info@all-in-one.be>
##
########################################################################################
@@ -20,6 +20,9 @@
$ntpq = "/usr/sbin/ntpq";
$ntpdc = "/usr/sbin/ntpdc";
# Change this to true if you have clk_jitter, sys_jitter in the ntpq -c rv output
$newstats_style = false;
#### END SETTINGS ####
@@ -37,7 +40,7 @@
$vars2 = eregi_replace(' ', '', $cmd2);
$vars2 = explode("\n", $vars2);
function doSNMPv2($vars, $vars2) {
function doSNMPv2($vars, $vars2, $newstats_style) {
$ntpd = array();
foreach ($vars as $item=>$value) {
if (!empty($value)) {
@@ -58,9 +61,15 @@
$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");
if ($newstats_style) {
$var['jitter'] = (isset($ntpd['clk_jitter']) ? $ntpd['clk_jitter'] : "U");
$var['noise'] = (isset($ntpd['sys_jitter']) ? $ntpd['sys_jitter'] : "U");
$var['stability'] = (isset($ntpd['clk_wander']) ? $ntpd['clk_wander'] : "U");
} else {
$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");
@@ -74,8 +83,6 @@
}
}
//print_r($vars2);
doSNMPv2($vars, $vars2, $newstats_style);
doSNMPv2($vars, $vars2);
?>
?>