librenms-librenms/includes/services/check_load.inc.php
Zmegolaz eac128aca8 Fix: Override -H for check_load service. Fixed backslash escaping. (#8020)
* Added check_load.inc.php.

* Combined load graphs. Removed extra backslashes from all graphs. Escaped backslash in mysql file.

* Added a note about local only service checks to the docs.
2018-01-08 09:35:15 +01:00

32 lines
1.5 KiB
PHP

<?php
// provide some sane default
if ($service['service_param']) {
$params = $service['service_param'];
} else {
$params = "-w 5,5,5 -c 10,10,10";
}
$check_cmd = $config['nagios_plugins'] . "/check_load " . $params;
// Check DS is a json array of the graphs that are available
$check_ds = '{"load":""}';
// Build the graph data
$check_graph = array();
$check_graph['load'] = " DEF:DS0=" . $rrd_filename . ":load1:AVERAGE ";
$check_graph['load'] .= " LINE1.25:DS0#" . $config['graph_colours']['mixed'][0] . ":'" . str_pad(substr("Load 1", 0, 15), 15) . "' ";
$check_graph['load'] .= " GPRINT:DS0:LAST:%5.2lf%s ";
$check_graph['load'] .= " GPRINT:DS0:AVERAGE:%5.2lf%s ";
$check_graph['load'] .= " GPRINT:DS0:MAX:%5.2lf%s\\l ";
$check_graph['load'] .= " DEF:DS1=" . $rrd_filename . ":load5:AVERAGE ";
$check_graph['load'] .= " LINE1.25:DS1#" . $config['graph_colours']['mixed'][1] . ":'" . str_pad(substr("Load 5", 0, 15), 15) . "' ";
$check_graph['load'] .= " GPRINT:DS1:LAST:%5.2lf%s ";
$check_graph['load'] .= " GPRINT:DS1:AVERAGE:%5.2lf%s ";
$check_graph['load'] .= " GPRINT:DS1:MAX:%5.2lf%s\\l ";
$check_graph['load'] .= " DEF:DS2=" . $rrd_filename . ":load15:AVERAGE ";
$check_graph['load'] .= " LINE1.25:DS2#" . $config['graph_colours']['mixed'][2] . ":'" . str_pad(substr("Load 15", 0, 15), 15) . "' ";
$check_graph['load'] .= " GPRINT:DS2:LAST:%5.2lf%s ";
$check_graph['load'] .= " GPRINT:DS2:AVERAGE:%5.2lf%s ";
$check_graph['load'] .= " GPRINT:DS2:MAX:%5.2lf%s\\l ";