<?php $ds_name[1] = "Barracuda Inbound Message Statistics"; $opt[1] = "--vertical-label 'Messages' -l0 --title \"Message Statistics for {$hostname}\" "; $def[1] = rrd::def("InboundBlocked", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::area("InboundBlocked", "#ff0000", "InboundBlocked", 'STACK'); $def[1] .= rrd::gprint("InboundBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("InboundVirusBlocked", $RRDFILE[2], $DS[1], "AVERAGE"); $def[1] .= rrd::area("InboundVirusBlocked", "#ff8400", "InboundVirusBlocked", 'STACK'); $def[1] .= rrd::gprint("InboundVirusBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("InboundRateLimited", $RRDFILE[3], $DS[1], "AVERAGE"); $def[1] .= rrd::area("InboundRateLimited", "#9600ff", "InboundRateLimited", 'STACK'); $def[1] .= rrd::gprint("InboundRateLimited", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("InboundQuarantined", $RRDFILE[4], $DS[1], "AVERAGE"); $def[1] .= rrd::area("InboundQuarantined", "#33b0ff", "InboundQuarantined", 'STACK'); $def[1] .= rrd::gprint("InboundQuarantined", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("InboundTagged", $RRDFILE[5], $DS[1], "AVERAGE"); $def[1] .= rrd::area("InboundTagged", "#fdff33", "InboundTagged", 'STACK'); $def[1] .= rrd::gprint("InboundTagged", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("InboundAllowed", $RRDFILE[6], $DS[1], "AVERAGE"); $def[1] .= rrd::area("InboundAllowed", "#45e126", "Allowed", 'STACK'); $def[1] .= rrd::gprint("InboundAllowed", array("LAST", "MAX", "AVERAGE"), "%6.0lf");
} } $gindex++; } if ($VAR['used_cpu_sys'] != -1) { $vindex_cpumain_sys = $VAR['used_cpu_sys']; $vindex_cpumain_user = $VAR['used_cpu_user']; $vindex_cpuchild_sys = $VAR['used_cpu_sys_children']; $vindex_cpuchild_user = $VAR['used_cpu_user_children']; $ds_name[$gindex] = "CPU Use"; $opt[$gindex] = "--vertical-label \"cpu time in msec\" --title \"{$servicedesc} CPU Use on {$hostname}\" "; $def[$gindex] = rrd::def("cpu_main_sys", $RRDFILE[$vindex_cpumain_sys], $DS[$vindex_cpumain_sys], "AVERAGE"); $def[$gindex] .= rrd::area("cpu_main_sys", "#FF6103", "System CPU - Main Thread"); $def[$gindex] .= rrd::gprint("cpu_main_sys", array("LAST", "MAX", "AVERAGE"), "%6.2lf "); if ($vindex_cpuchild_sys != -1) { $def[$gindex] .= rrd::def("cpu_child_sys", $RRDFILE[$vindex_cpuchild_sys], $DS[$vindex_cpuchild_sys], "AVERAGE"); $def[$gindex] .= rrd::area("cpu_child_sys", "#FFD700", "System CPU - Children ", "STACK"); $def[$gindex] .= rrd::gprint("cpu_child_sys", array("LAST", "MAX", "AVERAGE"), "%6.2lf "); } if ($vindex_cpumain_user != -1) { $def[$gindex] .= rrd::def("cpu_main_user", $RRDFILE[$vindex_cpumain_user], $DS[$vindex_cpumain_user], "AVERAGE"); $def[$gindex] .= rrd::area("cpu_main_user", "#008000", "User CPU - Main Thread", "STACK"); $def[$gindex] .= rrd::gprint("cpu_main_user", array("LAST", "MAX", "AVERAGE"), "%6.2lf "); } if ($vindex_cpuchild_user != -1) { $def[$gindex] .= rrd::def("cpu_child_user", $RRDFILE[$vindex_cpuchild_user], $DS[$vindex_cpuchild_user], "AVERAGE"); $def[$gindex] .= rrd::area("cpu_child_user", "#00FF00", "User CPU - Children ", "STACK"); $def[$gindex] .= rrd::gprint("cpu_child_user", array("LAST", "MAX", "AVERAGE"), "%6.2lf "); } $gindex++; }
} # # Bytes per Second # $i++; $def[$i] = ""; $opt[$i] = " --title 'Bytes per Second'"; $ds_name[$i] = "Bytes/s"; $regex = '/BytesPerSec/'; foreach ($this->DS as $KEY => $VAL) { if (preg_match($regex, $VAL['NAME'])) { $def[$i] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[$i] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($VAL['NAME'], 16), 'STACK'); $def[$i] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%6.1lf %sb/s"); } } # # Stats # $i++; $def[$i] = ""; $opt[$i] = " --title 'Worker States'"; $ds_name[$i] = "Worker States"; $regex = '/Starting|DNS|Reading|Sending|Keepalive|Closing|Logging|Finishing/'; foreach ($this->DS as $KEY => $VAL) { if (preg_match($regex, $VAL['NAME'])) { $def[$i] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[$i] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($VAL['NAME'], 16), 'STACK'); $def[$i] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%6.0lf" . $VAL['UNIT']); } }
$lower = " --lower=" . $VAL['MIN']; $minimum = $VAL['MIN']; } if ($VAL['MAX'] != "" && is_numeric($VAL['MAX'])) { $maximum = $VAL['MAX']; } if ($VAL['UNIT'] == "%%") { $vlabel = "%"; $upper = " --upper=101 "; $lower = " --lower=0 "; } else { $vlabel = $VAL['UNIT']; } $opt[$KEY] = '--vertical-label "' . $vlabel . '" --title "' . $this->MACRO['DISP_HOSTNAME'] . ' / ' . $this->MACRO['DISP_SERVICEDESC'] . '"' . $upper . $lower; $ds_name[$KEY] = $VAL['LABEL']; $def[$KEY] = rrd::def("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[$KEY] .= rrd::gradient("var1", "3152A5", "BDC6DE", rrd::cut($VAL['NAME'], 16), 20); $def[$KEY] .= rrd::line1("var1", $_LINE); $def[$KEY] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%3.4lf %S" . $VAL['UNIT']); if ($warning != "") { $def[$KEY] .= rrd::hrule($warning, $_WARNRULE, "Warning {$warning} \\n"); } if ($warn_min != "") { $def[$KEY] .= rrd::hrule($warn_min, $_WARNRULE, "Warning (min) {$warn_min} \\n"); } if ($warn_max != "") { $def[$KEY] .= rrd::hrule($warn_max, $_WARNRULE, "Warning (max) {$warn_max} \\n"); } if ($critical != "") { $def[$KEY] .= rrd::hrule($critical, $_CRITRULE, "Critical {$critical} \\n"); }
<?php /* adminutils - Scripts and resources for admins Copyright (C) 2012 nmaupu_at_gmail_dot_com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $DS_time = $this->DS[0]; $DS_status = $this->DS[1]; $opt[1] = "-l0 --title \"{$hostname} / Openoffice server\" "; $def[1] = rrd::def("var1", $DS_time['RRDFILE'], $DS_time['DS']); $def[1] .= rrd::def("var2", $DS_status['RRDFILE'], $DS_status['DS']); $def[1] .= rrd::gradient("var1", "#00FFFF", "#0000FF", "Time"); $def[1] .= rrd::gprint("var1", array("LAST", "AVERAGE", "MIN", "MAX"), "%4.2lfs"); $def[1] .= rrd::ticker("var2", 2, 1, -0.05, "ff", "#00ff00", "#ff8c00", "#ff0000");
<?php $ds_name[1] = "Cisco Current Rate"; $opt[1] = "--vertical-label 'Rate' -l0 --title \"Current Rate for {$hostname}\" "; $def[1] = rrd::def("Download", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::line1("Download", "#11dd33", "Download"); $def[1] .= rrd::gprint("Download", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("Upload", $RRDFILE[2], $DS[1], "AVERAGE"); $def[1] .= rrd::line1("Upload", "#ff33b9", "Upload"); $def[1] .= rrd::gprint("Upload", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); ?>
<?php $alpha = 'CC'; $colors = array('#ff0000' . $alpha, '#ff7d00' . $alpha, '#fff200' . $alpha, '#00cf00' . $alpha, '#7cb3f1' . $alpha); $opt[1] = "-T 55 -l 0 --vertical-label \"Queries/Second\" --title \"{$hostname} / Select Types\""; $def[1] = ''; foreach ($DS as $i) { $def[1] .= rrd::def("var{$i}", $rrdfile, $DS[$i], 'AVERAGE'); if ($i == '1') { $def[1] .= rrd::area("var{$i}", $colors[$i - 1], prep_name($NAME[$i])); } else { $def[1] .= rrd::area("var{$i}", $colors[$i - 1], prep_name($NAME[$i]), 'STACK'); } $def[1] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf %s\\t"); } /* * Replaces underescores with spaces, up caseses words, then returns the results * of rrd::cut */ function prep_name($name) { return rrd::cut(ucwords(str_replace('_', ' ', $name)), 15); }
$def[2] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($dsname, 12)); $def[2] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%3.2lf %SM"); } if (preg_match('/^select$/', $VAL['NAME'])) { $ds_name[$defcnt] = "Output from sql-query for {$servicedesc}"; $opt[$defcnt] = "--vertical-label \"Counts\" --title \"Output from sql-query for {$servicedesc} on {$hostname}\" "; $def[$defcnt] = ""; $def[$defcnt] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST"); $def[$defcnt] .= rrd::area("var" . $KEY, "#111111"); $def[$defcnt] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%3.2lf Counts"); $defcnt++; } if (preg_match('/^(.*)bck_age$/', $VAL['NAME'])) { $ds_name[$defcnt] = "Last DB Backup"; $opt[$defcnt] = "--vertical-label \"Hours\" --title \"Last DB Backup\" "; $def[$defcnt] = ""; $def[$defcnt] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST"); $def[$defcnt] .= rrd::area("var" . $KEY, "#111111"); $def[$defcnt] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%3.2lf Counts"); $defcnt++; } if (preg_match('/^sql_runtime$/', $VAL['NAME'])) { $ds_name[$defcnt] = "SQL runtime"; $opt[$defcnt] = "--vertical-label \"Seconds\" --title \"Execution time of the SQL statement\" "; $def[$defcnt] = ""; $def[$defcnt] .= rrd::def("runtime", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST"); $def[$defcnt] .= rrd::area("runtime", "#111111"); $def[$defcnt] .= rrd::gprint("runtime", array("LAST", "MAX", "AVERAGE"), "%3.2lf Seconds"); $defcnt++; } }
<?php $_WARNRULE = '#FFFF00'; $_CRITRULE = '#FF0000'; $_AREA = '#256aef'; $_LINE = '#3152A5'; $_MAXRULE = '#000000'; $colors = array("#FF0000", "#336600", "#6600FF", "#FF3300", "#339900", "#6633FF", "#FF6600", "#6600FF", "#6666FF", "#FF9900", "#33FF00", "#6699FF", "#FFCC00", "#33FF33", "#66CCFF", "#FFFF00", "#66CC00", "#66FFFF"); $j = 0; $opt[1] = '--slope-mode -l0 --title "' . $this->MACRO['DISP_HOSTNAME'] . ' / ' . $this->MACRO['DISP_SERVICEDESC'] . '"'; $def[1] = ''; # Debugging Code # throw new Kohana_exception(print_r($this->DS,true)); # sort by ACT (Last) Value. Highest Value goes into Background. usort($this->DS, function ($a, $b) { return $b['ACT'] - $a['ACT']; }); foreach ($this->DS as $KEY => $VAL) { $def[1] .= rrd::def("var{$KEY}", $this->DS[$KEY]['RRDFILE'], $this->DS[$KEY]['DS'], "AVERAGE"); $def[1] .= rrd::area("var{$KEY}", $colors[$j] . "70", rrd::cut($this->DS[$KEY]["NAME"], 40)); $def[1] .= rrd::line1("var{$KEY}", "#000"); $def[1] .= rrd::gprint("var{$KEY}", array("AVERAGE", "MAX", "LAST"), "%5.0lf"); $j++; }
<?php # # Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org) # Plugin: check_load # $opt[1] = "--vertical-label Load -l0 --title \"CPU Load for {$hostname} / {$servicedesc}\" "; # # # $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::def("var2", $RRDFILE[1], $DS[2], "AVERAGE"); $def[1] .= rrd::def("var3", $RRDFILE[1], $DS[3], "AVERAGE"); if ($WARN[1] != "") { $def[1] .= "HRULE:{$WARN['1']}#FFFF00 "; } if ($CRIT[1] != "") { $def[1] .= "HRULE:{$CRIT['1']}#FF0000 "; } $def[1] .= rrd::area("var3", "#ff0000", "load 15"); $def[1] .= rrd::gprint("var3", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); $def[1] .= rrd::area("var2", "#EA8F00", "Load 5 "); $def[1] .= rrd::gprint("var2", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); $def[1] .= rrd::area("var1", "#EACC00", "load 1 "); $def[1] .= rrd::gprint("var1", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
foreach ($this->DS as $key => $value) { $ds[$value['NAME']] = $value; } $max = pnp::adjust_unit($ds['real_used']['MAX'], 1024, $fmt); $upper = "-u {$max['1']}"; $unit_scale = $max[2]; $divis = $max[3]; $opt[1] = "--vertical-label {$unit_scale} -l 0 {$upper} --title \"RAM usage for {$hostname}\" "; $def[1] = rrd::def("var1", $ds['real_used']['RRDFILE'], $ds['real_used']['DS']); $def[1] .= rrd::def("var2", $ds['total']['RRDFILE'], $ds['total']['DS']); $def[1] .= rrd::def("var3", $ds['shared']['RRDFILE'], $ds['shared']['DS']); $def[1] .= rrd::def("var4", $ds['buffered']['RRDFILE'], $ds['buffered']['DS']); $def[1] .= rrd::def("var5", $ds['cached']['RRDFILE'], $ds['cached']['DS']); $def[1] .= rrd::def("var6", $ds['free']['RRDFILE'], $ds['free']['DS']); $def[1] .= rrd::def("var7", $ds['swap_total']['RRDFILE'], $ds['swap_total']['DS']); $def[1] .= rrd::def("var8", $ds['swap_free']['RRDFILE'], $ds['swap_free']['DS']); $def[1] .= rrd::cdef("v_real_used", "var1,{$divis},/"); $def[1] .= rrd::cdef("v_total", "var2,{$divis},/"); $def[1] .= rrd::cdef("v_shared", "var3,{$divis},/"); $def[1] .= rrd::cdef("v_buffered", "var4,{$divis},/"); $def[1] .= rrd::cdef("v_cached", "var5,{$divis},/"); $def[1] .= rrd::cdef("v_used", "var2,var6,-,{$divis},/"); // total - used / $divis $def[1] .= rrd::cdef("v_free", "var6,{$divis},/"); $def[1] .= rrd::cdef("v_swtotal", "var7,{$divis},/"); $def[1] .= rrd::cdef("v_swfree", "var8,{$divis},/"); $def[1] .= rrd::cdef("v_swused", "var7,var8,-,{$divis},/"); // Stacking all other values (used, cached, buffered, cached $def[1] .= rrd::gradient("v_real_used", "#FF9900", "#FF5555", "Real used"); $def[1] .= rrd::line1("v_real_used", "#00000000"); // Invisible to be able to stack with gradient
# with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # $Id$ # $ds_name[1] = "Memory Usage"; $opt[1] = "-l0 --title \"Memory Usage for {$hostname}\" "; $def[1] = rrd::def("tot", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::def("slab", $RRDFILE[1], $DS[2], "AVERAGE"); $def[1] .= rrd::def("swapcached", $RRDFILE[1], $DS[3], "AVERAGE"); $def[1] .= rrd::def("pagetables", $RRDFILE[1], $DS[4], "AVERAGE"); $def[1] .= rrd::def("apps", $RRDFILE[1], $DS[5], "AVERAGE"); $def[1] .= rrd::def("memfree", $RRDFILE[1], $DS[6], "AVERAGE"); $def[1] .= rrd::def("buffers", $RRDFILE[1], $DS[7], "AVERAGE"); $def[1] .= rrd::def("cached", $RRDFILE[1], $DS[8], "AVERAGE"); $def[1] .= rrd::def("swap", $RRDFILE[1], $DS[9], "AVERAGE"); $def[1] .= rrd::line1("tot", "#000000", "Total memory"); $def[1] .= rrd::gprint("tot", array("LAST"), "%6.2lf%s"); $def[1] .= rrd::area("apps", "#FF0000", "Applications"); $def[1] .= rrd::gprint("apps", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s"); $def[1] .= rrd::area("pagetables", "#0000FF", "Page Table ", true); $def[1] .= rrd::gprint("pagetables", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s"); $def[1] .= rrd::area("slab", "#00FFFF", "Slab ", true); $def[1] .= rrd::gprint("slab", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s"); $def[1] .= rrd::area("swapcached", "#FF8000", "Swap Cache ", true); $def[1] .= rrd::gprint("swapcached", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s"); $def[1] .= rrd::area("cached", "#FFFF00", "Cache ", true); $def[1] .= rrd::gprint("cached", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s"); $def[1] .= rrd::area("buffers", "#80FF00", "Buffer ", true); $def[1] .= rrd::gprint("buffers", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s"); $def[1] .= rrd::area("memfree", "#00FF00", "Free ", true);
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. * * * Plots number of cloudstack instances by state as reported by the * check_cloud_instances.php plugin. * * This file is part of the nagios-cloudstack bundle that can be found * at https://github.com/jasonhancock/nagios-cloudstack */ $alpha = ''; $colors = array('Running' => '#00FF00' . $alpha, 'Starting' => '#0000FF' . $alpha, 'Stopping' => '#FF0000' . $alpha, 'Destroyed' => '#CCCCCC' . $alpha); $vlabel = '# of VMs'; $opt[1] = sprintf('-T 55 -l 0 --vertical-label "%s" --title "%s / Number of VMs"', $vlabel, $hostname); $def[1] = ''; $ds_name[1] = 'Cloud Instances'; $count = 0; foreach ($this->DS as $i => $dso) { $def[1] .= rrd::def("var{$i}", $dso['RRDFILE'], $dso['DS'], 'AVERAGE'); $name = rrd::cut($dso['NAME'], 9); $color = isset($colors[$dso['NAME']]) ? $colors[$dso['NAME']] : '#FFFF00'; $stack = $i == 0 ? '' : 'STACK'; $def[1] .= rrd::area("var{$i}", $color, $name, $i == 0 ? '' : $stack); $def[1] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%3.0lf"); } $def[1] .= 'COMMENT:"' . $TEMPLATE[$i] . '\\r" ';
<?php # # Copyright (c) 2011 Anders Håål, based on check_load # Plugin: check_bischeck # $opt[1] = "--title \"{$hostname} / {$servicedesc}\" "; # # # $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::def("var2", $RRDFILE[1], $DS[2], "AVERAGE"); $def[1] .= rrd::area("var1", "#EACC00", "Measured "); $def[1] .= rrd::gprint("var1", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); $def[1] .= rrd::area("var2", "#EA8F00", "Threshold "); $def[1] .= rrd::gprint("var2", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); if ($WARN[1] != "") { $def[1] .= rrd::hrule($WARN[1], "#FFFF00", "Warning " . $WARN[1] . $UNIT[1] . "\\n"); } if ($CRIT[1] != "") { $def[1] .= rrd::hrule($CRIT[1], "#FF0000", "Warning " . $CRIT[1] . $UNIT[1] . "\\n"); }
Copyright (C) 2012 nmaupu_at_gmail_dot_com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $opt[1] = "--slope-mode --vertical-label Load -l0 --title \"CPU Load for {$hostname} / {$servicedesc}\" "; $DS_1 = $this->DS[0]; $DS_5 = $this->DS[1]; $DS_15 = $this->DS[2]; $C15 = '#FF0000'; $C5 = '#0000FF'; $C1 = '#EACC00'; $def[1] = rrd::def("var1", $DS_1['RRDFILE'], $DS_1['DS']); $def[1] .= rrd::def("var2", $DS_5['RRDFILE'], $DS_5['DS']); $def[1] .= rrd::def("var3", $DS_15['RRDFILE'], $DS_15['DS']); $def[1] .= rrd::area("var1", $C1, "Load 1"); $def[1] .= rrd::gprint("var1", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); $def[1] .= rrd::line1("var2", $C5, "Load 5"); $def[1] .= rrd::gprint("var2", array("LAST", "AVERAGE", "MAX"), "%6.2lf"); $def[1] .= rrd::line1("var3", $C15, "Load 15"); $def[1] .= rrd::gprint("var3", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
$def[4] .= "GPRINT:use_mb:AVERAGE:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:use_perc:AVERAGE:\" (%2.1lf%%) Avg\\n\" "; $def[4] .= rrd::area("free_mb", "#00FFFF", "Free Memory ", "STACK"); $def[4] .= "GPRINT:free_mb:LAST:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:free_perc:LAST:\" (%2.1lf%%) Last\" "; $def[4] .= "GPRINT:free_mb:MAX:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:free_perc:MAX:\" (%2.1lf%%) Max\" "; $def[4] .= "GPRINT:free_mb:AVERAGE:\"%6.1lfMB \\g\" "; $def[4] .= "GPRINT:free_perc:AVERAGE:\" (%2.1lf%%) Avg\\n\" "; $def[4] .= rrd::comment("= Total Memory"); $def[4] .= "GPRINT:total_mb:LAST:\"%6.1lfMB\\n\" "; $ds_name[5] = "Data Items Store"; $opt[5] = "--vertical-label \"# items\" --title \"{$servicedesc} Data Items on {$hostname}\" "; $def[5] = rrd::def("curr_items", $RRDFILE[8], $DS[8], "AVERAGE"); $def[5] .= rrd::def("total_items", $RRDFILE[17], $DS[17], "AVERAGE"); $def[5] .= rrd::area("total_items", "#00FF00", "Items Added Per Sec"); $def[5] .= rrd::gprint("total_items", array("LAST", "MAX", "AVERAGE"), "%3.0lf "); $def[5] .= rrd::comment("- Total Current Items "); $def[5] .= rrd::gprint("curr_items", array("LAST"), "%6.0lf "); $ds_name[6] = "CPU Use"; $opt[6] = "--vertical-label \"cpu time in msec\" --title \"CPU Time Use for {$servicedesc} on {$hostname}\" "; $def[6] = rrd::def("rusage_system", $RRDFILE[10], $DS[10], "AVERAGE"); $def[6] .= rrd::def("rusage_user", $RRDFILE[19], $DS[19], "AVERAGE"); $def[6] = rrd::def("rusage_system_ms", $RRDFILE[24], $DS[24], "AVERAGE"); $def[6] .= rrd::def("rusage_user_ms", $RRDFILE[23], $DS[23], "AVERAGE"); $def[6] .= rrd::cdef("rusage_system_graph", "rusage_system_ms,1024,/"); $def[6] .= rrd::cdef("rusage_user_graph", "rusage_user_ms,1024,/"); $def[6] .= rrd::area("rusage_system_graph", "#FFFF00", "CPU System Mode Time"); $def[6] .= rrd::gprint("rusage_system_graph", array("LAST", "MAX", "AVERAGE"), "%3.2lf msec "); $def[6] .= rrd::area("rusage_user_graph", "#00FF00", "CPU User Mode Time ", "STACK"); $def[6] .= rrd::gprint("rusage_user_graph", array("LAST", "MAX", "AVERAGE"), "%3.2lf msec ");
# | / ___| |__ ___ ___| | __ | \/ | |/ / | # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / | # | | |___| | | | __/ (__| < | | | | . \ | # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ | # | | # | Copyright Mathias Kettner 2012 mk@mathias-kettner.de | # +------------------------------------------------------------------+ # # This file is part of Check_MK. # The official homepage is at http://mathias-kettner.de/check_mk. # # check_mk is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation in version 2. check_mk is distributed # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with- # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU General Public License for more de- # ails. You should have received a copy of the GNU General Public # License along with GNU Make; see the file COPYING. If not, write # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, # Boston, MA 02110-1301 USA. # Cut the relevant bits from the Nagios Service Description. # This is a little complicated. $servicedesc = str_replace("_", " ", $servicedesc); $opt[1] = "--lower=0 --upper=" . ($CRIT[1] + 10) . " --vertical-label \"Bytes\" --title \"{$servicedesc}\" "; # Paint nice gradient using MySQLs colours. $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "MAX") . rrd::gradient('var1', '015a84', 'e97b00', 'Database Size', 50) . rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%6.2lf%sB") . "LINE2:var1#e57900 "; # Draw vertical line with the current warn/crit levels. if (isset($WARN[1]) and $WARN[1] != "") { $def[1] .= "HRULE:{$WARN['1']}#FFFF00:\"\" " . "HRULE:{$CRIT['1']}#FF0000:\"\" " . ""; }
$def[$i] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%6.1lf %sb/s"); } } } # # all other graphs # $i++; foreach ($this->DS as $KEY => $VAL) { if (!preg_match('/(^State_)|(^ReqPerSec)|(^BytesPerSec)|(^Uptime)/', $VAL['NAME'])) { $def[$i] = ""; $opt[$i] = " --title '{$hostname}: Apache - " . $VAL['NAME'] . " ' -l 0"; $ds_name[$i] = $VAL['NAME']; $def[$i] .= rrd::def("var" . $KEY, $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[$i] .= rrd::line1("var" . $KEY, rrd::color($KEY), rrd::cut($VAL['NAME'], 16), 'STACK'); $def[$i] .= rrd::gprint("var" . $KEY, array("LAST", "MAX", "AVERAGE"), "%6.1lf"); $i++; } } # # Uptime Graph # $opt[$i] = "--vertical-label 'Uptime (d)' -l0 --title \"Uptime (time since last reboot)\" "; $def[$i] = ""; $def[$i] .= rrd::def("sec", $RRDFILE[1], $DS[1], "MAX"); $ds_name[$i] = $LABEL[1]; $def[$i] .= "CDEF:uptime=sec,86400,/ "; $def[$i] .= "AREA:uptime#80f000:\"Uptime (days)\" "; $def[$i] .= "LINE:uptime#408000 "; $def[$i] .= "GPRINT:uptime:LAST:\"%7.2lf %s LAST\" "; $def[$i] .= "GPRINT:uptime:MAX:\"%7.2lf %s MAX\" ";
if (isset($def[$id_fan])) { $def[$id_fan] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); } else { $def[$id_fan] = rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); } $def[$id_fan] .= rrd::line1("var{$KEY}", "#" . $colors[$f++], rrd::cut($label, 18)); $def[$id_fan] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.0lf RPM"); } # ENCLOSURE TEMPERATURES (Celsius) if (preg_match('/^E(?P<encl>.+?)_t(emp_)?(?P<probe>\\d+)/', $label, $matches)) { $this_id = $matches['encl']; $probe_index = $matches['probe']; if ($enclosure_id != $this_id) { $e = 0; $id_enc++; $enclosure_id = $this_id; } # Label $label = "Probe {$probe_index}"; $ds_name[$id_enc] = "Enclosure {$enclosure_id} Temperatures"; $opt[$id_enc] = "--slope-mode --vertical-label \"Celsius\" --title \"{$def_title}: Enclosure {$enclosure_id} Temperatures\" "; if (isset($def[$id_enc])) { $def[$id_enc] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); } else { $def[$id_enc] = rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); } $def[$id_enc] .= rrd::line1("var{$KEY}", "#" . $colors[$e++], rrd::cut($label, 14)); $def[$id_enc] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.1lf C"); } } }
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # $VALUE_COUNT = 4; $name = $NAME; asort($name); $c = count($name); if ($c % $VALUE_COUNT != 0) { exit; } $interface_count = $c / $VALUE_COUNT; for ($i = 0; $i < $interface_count; $i++) { $index = $i * $VALUE_COUNT + 1; list($interface, $data_type) = explode(".", $name[$index + 2]); $interface = str_replace(";", "", $interface); $opt[$index + 1] = "--vertical-label \"Speed in Gbps\" -X 0 -l 0 -u 1 --title \"Network Interface Load for {$hostname} / {$interface}\" "; $ds_name[$index + 1] = "{$interface}:: Receiving and "; $def[$index + 1] = rrd::def("value1", $RRDFILE[$index + 2], $DS[$index + 2], "AVERAGE"); $def[$index + 1] .= rrd::cdef("value2", "value1,125000,/"); $def[$index + 1] .= rrd::line1("value2", "#008000", "Receiving "); $def[$index + 1] .= rrd::gprint("value2", array("LAST", "AVERAGE", "MAX"), "%6.4lf Gbps"); list($interface, $data_type) = explode(".", $name[$index + 3]); $interface = str_replace(";", "", $interface); $ds_name[$index + 1] .= "Transmission speed"; $def[$index + 1] .= rrd::def("value3", $RRDFILE[$index + 3], $DS[$index + 3], "AVERAGE"); $def[$index + 1] .= rrd::cdef("value4", "value3,125000,/"); $def[$index + 1] .= rrd::line1("value4", "#0000ff", "Transmission "); $def[$index + 1] .= rrd::gprint("value4", array("LAST", "AVERAGE", "MAX"), "%6.4lf Gbps"); $def[$index + 1] .= rrd::comment(" \\n"); $def[$index + 1] .= rrd::comment(" \\n"); $def[$index + 1] .= rrd::comment(" \\n"); }
$def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_unknown", "case{$casecount},UN,1,0,IF"); # create new unknown_total cdef, add flag (0/1) to unknown_total_XXXX-1 $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_unknown_total_" . $case_data_count, "tc_case" . $casecount . "_unknown_total_" . ($case_data_count - 1) . ",tc_case" . $casecount . "_unknown,+"); # 3. calculate # break the comparison 0 < x < y into two, each results in either 0 (false) or 1 (true) $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_incomplete_gt0", "tc_case" . $casecount . "_unknown_total_" . $case_data_count . ",0,GT,1,0,IF"); $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_incomplete_ltdatacount", "tc_case" . $casecount . "_unknown_total_" . $case_data_count . "," . $case_data_count . ",LT,1,0,IF"); # if the sum of both comparisons is 2, both conditions are true and we really have incomplete data. This is when we want to have the TICK. $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_incomplete", "tc_case" . $casecount . "_incomplete_gt0,tc_case" . $casecount . "_incomplete_ltdatacount,+,2,EQ,1,0,IF"); $def[$casecount_int] .= "TICK:tc_case" . $casecount . "_incomplete" . $col_INCOMPL . $tick_opacity_incompl . ":" . $tick_frac . ":' incomplete run' "; # TICKS for warning/critical -> yellow/red ############################################## # - warning/critical -> yellow/red TICK line on top foreach ($this->DS as $k => $v) { # matches only once = for c_$casecount__state if (preg_match('/^c_' . $casecount . '__state/', $v['LABEL'], $state_matches)) { $def[$casecount_int] .= rrd::def("tc_case" . $casecount . "_state", $v['RRDFILE'], $v['DS'], "MAX"); # determine when this case is warning/critical -> draw TICK line on top $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_state_warning", "tc_case" . $casecount . "_state,1,EQ,1,0,IF "); # if incomplete data = 1 -> 0 = no crit TICK # else: if case$casecount_state = 2 -> 1 = crit TICK $def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_state_critical", "tc_case" . $casecount . "_incomplete,1,EQ,0,tc_case" . $casecount . "_state,2,EQ,2,0,IF,IF"); $def[$casecount_int] .= "TICK:tc_case" . $casecount . "_state_warning" . $col_warning . $tick_opacity_warn . ":" . $tick_frac . ":' case/step warning ' "; $def[$casecount_int] .= "TICK:tc_case" . $casecount . "_state_critical" . $col_critical . $tick_opacity_crit . ":" . $tick_frac . ":' case/step critical \\j' "; } } # Suite last check time: black vertical line ################################# $def[$casecount_int] .= "VRULE:" . $NAGIOS_TIMET . "#000000: "; # append CPU/MEM graph (defined above) ################################################ if ($graph_cpu or $graph_mem) { $def[$casecount_int] .= rrd::comment(" \\n"); $def[$casecount_int] .= rrd::comment("Host Statistics\\:\\n");
<?php $ds_name[1] = "Barracuda Queues"; $opt[1] = "--vertical-label 'Queue Length' -l0 --title \"Queue Length for {$hostname}\" "; # $def[1] = rrd::def("inqueue", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::area("inqueue", "#22cc22", "inqueue", 'STACK'); $def[1] .= rrd::gprint("inqueue", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("outqueue", $RRDFILE[2], $DS[1], "AVERAGE"); $def[1] .= rrd::area("outqueue", "#2222FF", "outqueue", 'STACK'); $def[1] .= rrd::gprint("outqueue", array("LAST", "MAX", "AVERAGE"), "%6.0lf");
$def[1] .= rrd::line1("var{$KEY}", rrd::color($i), rrd::cut($label, 10)); $def[1] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%8.2lf"); } } $opt[2] = '--title "Host Stats"'; $ds_name[2] = "Host Stats"; $def[2] = ""; $i = 0; foreach ($this->DS as $KEY => $VAL) { if (preg_match('/^NUMHST(.*)$/', $VAL['NAME'], $matches)) { $i++; $label = ucfirst(strtolower($matches[1])); $def[2] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[2] .= rrd::line1("var{$KEY}", rrd::color($i), rrd::cut($label, 10)); $def[2] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%8.2lf"); } } $opt[3] = '--title "Check Execution Time"'; $ds_name[3] = "Execution Time"; $def[3] = ""; $i = 0; foreach ($this->DS as $KEY => $VAL) { if (preg_match('/(.*)EXT$/', $VAL['NAME'], $matches)) { $i++; $label = ucfirst(strtolower($matches[1])); $def[3] .= rrd::def("var{$KEY}", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE"); $def[3] .= rrd::cdef("var_sec{$KEY}", "var{$KEY},1000,/"); $def[3] .= rrd::line1("var_sec{$KEY}", rrd::color($i), rrd::cut($label, 10)); $def[3] .= rrd::gprint("var_sec{$KEY}", array("LAST", "MAX", "AVERAGE"), "%8.2lf"); } }
$ds_name[1] = 'Hits'; $opt[1] = "-T 55 -l 0 --vertical-label 'hits/s' --title \"{$hostname} / Apache Hits Per Second\""; $def[1] = rrd::def('var0', $rrdfile, $DS[1], 'AVERAGE'); $def[1] .= rrd::area('var0', rrd::color(2), 'Hits'); $def[1] .= rrd::gprint('var0', array('LAST', 'MAX', 'AVERAGE'), '%4.1lf %s'); $ds_name[2] = 'Network Traffic'; $opt[2] = "-T 55 -l 0 --vertical-label 'bit/s' --title \"{$hostname} / Apache Outbound Bandwidth\""; $def[2] = rrd::def('var0', $rrdfile, $DS[2], 'AVERAGE'); $def[2] .= rrd::cdef('var0_bits', 'var0,8,*'); $def[2] .= rrd::area('var0_bits', rrd::color(3), 'Network'); $def[2] .= rrd::gprint('var0_bits', array('LAST', 'MAX', 'AVERAGE'), '%4.1lf %s'); $ds_name[3] = 'Workers'; $opt[3] = "-T 55 -l 0 --vertical-label 'Workers' --title \"{$hostname} / Apache Workers\""; $def[3] = rrd::def('var0', $rrdfile, $DS[3], 'AVERAGE'); $def[3] .= rrd::area('var0', rrd::color(3), 'Workers Busy'); $def[3] .= rrd::gprint('var0', array('LAST', 'MAX', 'AVERAGE'), '%4.0lf %s'); $def[3] .= rrd::def('var1', $rrdfile, $DS[4], 'AVERAGE'); $def[3] .= rrd::area('var1', rrd::color(4), 'Workers Idle', 'STACK'); $def[3] .= rrd::gprint('var1', array('LAST', 'MAX', 'AVERAGE'), '%4.0lf %s'); $ds_name[4] = 'Scoreboard'; $opt[4] = "-T 55 -l 0 --vertical-label 'Workers' --title \"{$hostname} / Apache Scoreboard\""; $def[4] = ''; for ($i = 0; $i < count($scoreboard) - ($include_open_slot ? 0 : 1); $i++) { $def[4] .= rrd::def("var{$i}", $rrdfile, $DS[$i + 5], 'AVERAGE'); if ($i == '1') { $def[4] .= rrd::area("var{$i}", rrd::color($i), rrd::cut($scoreboard[$i], 20)); } else { $def[4] .= rrd::area("var{$i}", rrd::color($i), rrd::cut($scoreboard[$i], 20), 'STACK'); } $def[4] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf %s"); }
<?php # # Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org) # Plugin: check_iostat.php # # $ds_name[1] = "check iostat"; $opt[1] = "--lower-limit 0 --vertical-label \"check iostat\" --title \"check iostat\" "; $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::gradient("var1", "ff5c00", "ffdc00", "check iostat", 10); $def[1] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%.0lf {$UNIT['1']}"); $def[1] .= rrd::line1("var1", "#000000"); if ($WARN[1] != "") { if ($UNIT[1] == "%%") { $UNIT[1] = "%"; } $def[1] .= rrd::hrule($WARN[1], "#FFFF00", "Warning " . $WARN[1] . $UNIT[1] . "\\n"); } if ($CRIT[1] != "") { if ($UNIT[1] == "%%") { $UNIT[1] = "%"; } $def[1] .= rrd::hrule($CRIT[1], "#FF0000", "Critical " . $CRIT[1] . $UNIT[1] . "\\n"); }
<?php $ds_name[1] = "Barracuda Outbound Message Statistics"; $opt[1] = "--vertical-label 'Messages' -l0 --title \"Message Statistics for {$hostname}\" "; $def[1] = rrd::def("hourlyOutboundPolicyBlocked", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlyOutboundPolicyBlocked", "#ff3333", "hourlyOutboundPolicyBlocked", 'STACK'); $def[1] .= rrd::gprint("hourlyOutboundPolicyBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("hourlyOutboundSpamBlocked", $RRDFILE[2], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlyOutboundSpamBlocked", "#ff33b9", "hourlyOutboundSpamBlocked", 'STACK'); $def[1] .= rrd::gprint("hourlyOutboundSpamBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("hourlyOutboundVirusBlocked", $RRDFILE[3], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlyOutboundVirusBlocked", "#ff7633", "hourlyOutboundVirusBlocked", 'STACK'); $def[1] .= rrd::gprint("hourlyOutboundVirusBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("hourlyOutboundRateControlled", $RRDFILE[4], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlyOutboundRateControlled", "#9600ff", "hourlyOutboundRateControlled", 'STACK'); $def[1] .= rrd::gprint("hourlyOutboundRateControlled", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("hourlyOutboundQuarantined", $RRDFILE[5], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlyOutboundQuarantined", "#33b0ff", "hourlyOutboundQuarantined", 'STACK'); $def[1] .= rrd::gprint("hourlyOutboundQuarantined", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("hourlyEncrypted", $RRDFILE[6], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlyEncrypted", "#3333aa", "hourlyEncrypted", 'STACK'); $def[1] .= rrd::gprint("hourlyEncrypted", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("hourlyRedirected", $RRDFILE[7], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlyRedirected", "#33aa84", "hourlyRedirected", 'STACK'); $def[1] .= rrd::gprint("hourlyRedirected", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("hourlySent", $RRDFILE[8], $DS[1], "AVERAGE"); $def[1] .= rrd::area("hourlySent", "#45e126", "hourlySent", 'STACK'); $def[1] .= rrd::gprint("hourlySent", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); ?>
# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # $Id$ # $opt[1] = "--vertical-label \"bits per second\" --title \"Traffic {$hostname} / {$servicedesc}\" "; $opt[2] = "--vertical-label \"errors per second\" --title \"Error {$hostname} / {$servicedesc}\" "; $ds_name[1] = "Traffic"; $ds_name[2] = "Error"; $def[1] = rrd::def("ifInOctets", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::def("ifOutOctets", $RRDFILE[3], $DS[3], "AVERAGE"); $def[1] .= rrd::def("ifSpeed", $RRDFILE[5], $DS[5], "AVERAGE"); $def[1] .= rrd::vdef('ifSpeedLast', 'ifSpeed,LAST'); $def[2] = rrd::def("ifInErrors", $RRDFILE[2], $DS[2], "AVERAGE"); $def[2] .= rrd::def("ifOutErrors", $RRDFILE[4], $DS[4], "AVERAGE"); $def[1] .= rrd::hrule("ifSpeedLast", "#000000", rrd::cut("Speed", 10)); $def[1] .= rrd::gprint("ifSpeed", array("LAST"), "%6.2lf%sbit/s"); $def[1] .= rrd::area("ifInOctets", "#00FF00", rrd::cut("Inbound", 10)); $def[1] .= rrd::gprint("ifInOctets", array("LAST", "MAX", "AVERAGE"), "%6.2lf%sbit/s"); $def[1] .= rrd::line1("ifOutOctets", "#0000FF", rrd::cut("Outbound", 10)); $def[1] .= rrd::gprint("ifOutOctets", array("LAST", "MAX", "AVERAGE"), "%6.2lf%sbit/s"); $def[2] .= rrd::area("ifInErrors", "#800000", rrd::cut("Inbound", 10)); $def[2] .= rrd::gprint("ifInErrors", array("LAST", "MAX", "AVERAGE"), "%4.2lf%s errors/s"); $def[2] .= rrd::area("ifOutErrors", "#FF0000", rrd::cut("Outbound", 10), true); $def[2] .= rrd::gprint("ifOutErrors", array("LAST", "MAX", "AVERAGE"), "%4.2lf%s errors/s"); # vim: set ts=4 sw=4 et syn=php :
$UNIT[1] = "%"; } $def[1] .= rrd::hrule($WARN[1], "#FFFF00", "Warning " . $WARN[1] . $UNIT[1] . "\\n"); } if ($CRIT[1] != "") { if ($UNIT[1] == "%%") { $UNIT[1] = "%"; } $def[1] .= rrd::hrule($CRIT[1], "#FF0000", "Critical " . $CRIT[1] . $UNIT[1] . "\\n"); } # # Packets Lost $ds_name[2] = "Packets Lost"; $opt[2] = "--vertical-label \"Packets lost\" -l0 -u105 --title \"Packets lost\" "; $opt[2] .= rrd::darkteint(); $def[2] = rrd::def("var1", $RRDFILE[2], $DS[2], "AVERAGE"); $def[2] .= rrd::gradient("var1", "ff5c00", "ffdc00", "Packets Lost", 20); $def[2] .= rrd::ticker("var1", $WARN[2], $CRIT[2]); $def[2] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%3.0lf {$UNIT['2']}"); $def[2] .= rrd::line1("var1", "#000000"); $def[2] .= rrd::hrule("100", "#0000ff"); if ($WARN[2] != "") { if ($UNIT[2] == "%%") { $UNIT[2] = "%"; } $def[2] .= rrd::hrule($WARN[2], "#FFFF00", "Warning " . $WARN[2] . $UNIT[2] . "\\n"); } if ($CRIT[2] != "") { if ($UNIT[2] == "%%") { $UNIT[2] = "%"; }
<?php $ds_name[1] = "Barracuda Outbound Message Statistics"; $opt[1] = "--vertical-label 'Messages' -l0 --title \"Message Statistics for {$hostname}\" "; $def[1] = rrd::def("OutboundPolicyBlocked", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundPolicyBlocked", "#ff3333", "OutboundPolicyBlocked", 'STACK'); $def[1] .= rrd::gprint("OutboundPolicyBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("OutboundSpamBlocked", $RRDFILE[2], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundSpamBlocked", "#ff33b9", "OutboundSpamBlocked", 'STACK'); $def[1] .= rrd::gprint("OutboundSpamBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("OutboundVirusBlocked", $RRDFILE[3], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundVirusBlocked", "#ff7633", "OutboundVirusBlocked", 'STACK'); $def[1] .= rrd::gprint("OutboundVirusBlocked", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("OutboundRateLimited", $RRDFILE[4], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundRateLimited", "#9600ff", "OutboundRateLimited", 'STACK'); $def[1] .= rrd::gprint("OutboundRateLimited", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("OutboundQuarantined", $RRDFILE[5], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundQuarantined", "#33b0ff", "OutboundQuarantined", 'STACK'); $def[1] .= rrd::gprint("OutboundQuarantined", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("OutboundEncrypted", $RRDFILE[6], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundEncrypted", "#3333aa", "OutboundEncrypted", 'STACK'); $def[1] .= rrd::gprint("OutboundEncrypted", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("OutboundRedirected", $RRDFILE[7], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundRedirected", "#33aa84", "OutboundRedirected", 'STACK'); $def[1] .= rrd::gprint("OutboundRedirected", array("LAST", "MAX", "AVERAGE"), "%6.0lf"); $def[1] .= rrd::def("OutboundSent", $RRDFILE[8], $DS[1], "AVERAGE"); $def[1] .= rrd::area("OutboundSent", "#45e126", "OutboundSent", 'STACK'); $def[1] .= rrd::gprint("OutboundSent", array("LAST", "MAX", "AVERAGE"), "%6.0lf");
# # #$s=$this->STRUCT['TIMERANGE']['end']; $ds_name[1] = "Runtime"; $def[1] = rrd::def("var1", $RRDFILE[1], $DS[1], "AVERAGE"); $def[1] .= rrd::cdef("t_var1", "var1,14400,TREND"); if ($WARN[1] != "") { $def[1] .= rrd::hrule($WARN[1], "#FFFF00"); } if ($CRIT[1] != "") { $def[1] .= rrd::hrule($CRIT[1], "#FF0000"); } $def[1] .= rrd::gradient("var1", "ffffff", "#33cccc", rrd::cut("Runtime", 10)); $def[1] .= rrd::line1("var1", "#339999"); $def[1] .= rrd::gprint("var1", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf{$UNIT['1']}"); $def[1] .= rrd::line1("t_var1", "#ff9999", rrd::cut("4h trend", 10)); $def[1] .= rrd::gprint("t_var1", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf{$UNIT['1']}"); # # Lines processed and RRD errors # $opt[2] = "--vertical-label \"Counter\" --title \"Number of updates\" "; # # # $ds_name[2] = "Errors and updates"; $def[2] = ''; for ($i = 2; $i <= sizeof($DS); $i++) { $def[2] .= rrd::def("var{$i}", $RRDFILE[$i], $DS[$i], "AVERAGE"); $def[2] .= rrd::line1("var{$i}", rrd::color($i), rrd::cut(ucfirst($LABEL[$i]), 12)); $def[2] .= rrd::gprint("var{$i}", array('LAST', 'MAX', 'AVERAGE'), "%4.0lf{$UNIT[$i]}"); }