mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fixed display of cpu usage on junos - rm your rrd/*/junos-cpu.rrd if it doesnt work..
git-svn-id: http://www.observium.org/svn/observer/trunk@771 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
25
html/includes/graphs/device_cpu_junos.inc.php
Normal file
25
html/includes/graphs/device_cpu_junos.inc.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
$unit_text = "Load %";
|
||||
|
||||
$units='%';
|
||||
$total_units='%';
|
||||
$colours='mixed';
|
||||
|
||||
$scale_min = "0";
|
||||
$scale_max = "100";
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
include("common.inc.php");
|
||||
$database = $config['rrd_dir'] . "/" . $hostname . "/junos-cpu.rrd";
|
||||
|
||||
$rrd_options .= " DEF:load=$database:LOAD:AVERAGE";
|
||||
$rrd_options .= " DEF:load_max=$database:LOAD:MAX";
|
||||
$rrd_options .= " DEF:load_min=$database:LOAD:MIN";
|
||||
$rrd_options .= " COMMENT:\ \ \ \ \ \ \ \ \ \ Current\ \ Minimum\ \ Maximum\ \ Average\\\\n";
|
||||
$rrd_options .= " AREA:load#ffee99: LINE1.25:load#aa2200:Load\ %";
|
||||
$rrd_options .= " GPRINT:load:LAST:%6.2lf\ GPRINT:load_min:AVERAGE:%6.2lf\ ";
|
||||
$rrd_options .= " GPRINT:load_max:MAX:%6.2lf\ GPRINT:load:AVERAGE:%6.2lf\\\\n";
|
||||
|
||||
?>
|
@@ -27,22 +27,23 @@ $cpu_usage = trim(shell_exec($cpu_cmd));
|
||||
|
||||
if (is_numeric($cpu_usage))
|
||||
{
|
||||
if (!is_file($cpurrd)) {
|
||||
shell_exec($config['rrdtool'] . " create $cpurrd \
|
||||
--step 300 \
|
||||
DS:cpu:GAUGE:600:0:100 \
|
||||
RRA:AVERAGE:0.5:1:800 \
|
||||
RRA:AVERAGE:0.5:6:800 \
|
||||
RRA:AVERAGE:0.5:24:800 \
|
||||
RRA:AVERAGE:0.5:288:800 \
|
||||
RRA:MAX:0.5:1:800 \
|
||||
RRA:MAX:0.5:6:800 \
|
||||
RRA:MAX:0.5:24:800 \
|
||||
RRA:MAX:0.5:288:800");
|
||||
if (!is_file($cpurrd))
|
||||
{
|
||||
$rrdcreate = shell_exec($config['rrdtool'] ." create $cpurrd --step 300 DS:LOAD:GAUGE:600:-1:100 RRA:AVERAGE:0.5:1:1200 RRA:AVERAGE:0.5:1:2000 \
|
||||
RRA:AVERAGE:0.5:6:2000 \
|
||||
RRA:AVERAGE:0.5:24:2000 \
|
||||
RRA:AVERAGE:0.5:288:2000 \
|
||||
RRA:MAX:0.5:1:2000 \
|
||||
RRA:MAX:0.5:6:2000 \
|
||||
RRA:MAX:0.5:24:2000 \
|
||||
RRA:MAX:0.5:288:2000 \
|
||||
RRA:MIN:0.5:1:2000 \
|
||||
RRA:MIN:0.5:6:2000 \
|
||||
RRA:MIN:0.5:24:2000 \
|
||||
RRA:MIN:0.5:288:2000");
|
||||
}
|
||||
|
||||
if ($cpu_usage) { echo "CPU: $cpu_usage%\n"; }
|
||||
shell_exec($config['rrdtool'] . " update $cpurrd N:$cpu_usage");
|
||||
echo "CPU: $cpu_usage%\n";
|
||||
rrdtool_update($cpurrd, " N:$cpu_usage");
|
||||
}
|
||||
|
||||
include("hr-mib.inc.php");
|
||||
|
Reference in New Issue
Block a user