本文整理汇总了PHP中rrd::gprint方法的典型用法代码示例。如果您正苦于以下问题:PHP rrd::gprint方法的具体用法?PHP rrd::gprint怎么用?PHP rrd::gprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rrd
的用法示例。
在下文中一共展示了rrd::gprint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
#
#
#
#
$index = 1;
foreach ($DS as $i => $VAL) {
if (!isset($def[$index])) {
$def[$index] = "";
}
$def[$index] .= "DEF:var{$i}={$RRDFILE[$i]}:{$DS[$i]}:AVERAGE ";
if (!preg_match('/^threshold$/', $NAME[$i], $matches)) {
$opt[$index] = "--title \"{$hostname} / {$servicedesc} / {$NAME[$i]} \" ";
$def[$index] .= rrd::gradient("var{$i}", "ff5c00", "ffdc00", "{$NAME[$i]}", 20);
$def[$index] .= rrd::line1("var{$i}", "#000000");
$def[$index] .= rrd::gprint("var{$i}", "LAST", "%6.0lf \\n");
} else {
$def[$index] .= rrd::line2("var{$i}", "#555210", "{$NAME[$i]}");
$def[$index] .= rrd::gprint("var{$i}", "LAST", "%6.0lf \\n");
$val = $i - 1;
if ($WARN[$val] != "") {
$def[$index] .= rrd::hrule($WARN[$val], "#FFFF00", "Warning " . $WARN[$val] . $UNIT[$val] . "\\n");
}
if ($CRIT[$val] != "") {
$def[$index] .= rrd::hrule($CRIT[$val], "#FF0000", "Critical " . $CRIT[$val] . $UNIT[$val] . "\\n");
}
$index = $index + 1;
}
}
?>
示例2: array
}
}
$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++;
}
示例3: foreach
}
#
# 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']);
}
}
示例4: array
$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");
}
}
示例5: Copyright
# Copyright (C) 2014 Red Hat Inc
#
# 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 2
# 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
$def[1] = "";
$opt[1] = "";
$ds_name[1] = "";
$opt[1] = "--vertical-label \"% Usage\" -r --lower-limit 0 --upper-limit 100 --title \"{$NAGIOS_HOSTNAME} / {$NAGIOS_SERVICEDISPLAYNAME}\" --slope-mode -u 100 -N";
$ds_name[1] = "Volume Utilization";
$def[1] = "DEF:utilzation_in={$RRDFILE['1']}:{$DS['1']}:AVERAGE ";
$def[1] .= "CDEF:utilzation_out=utilzation_in ";
$def[1] .= "AREA:utilzation_out#ADD8E6:\"utilization\t\t\" ";
$def[1] .= rrd::gprint("utilzation_out", array("LAST", "AVERAGE", "MAX"), "%6.2lf%%");
if ($WARN[1] != "") {
$def[1] .= "LINE2:{$WARN['1']}#FFA500:\"Warning\\n\" ";
}
if ($CRIT[1] != "") {
$def[1] .= "LINE2:{$CRIT['1']}#FF0000:\"Critical\\n\" ";
}
示例6: array
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");
}
}
}
示例7: foreach
} else {
# no steps, no stacks
$def[$casecount_int] .= rrd::area("case{$casecount}", $col_case_runtime_area, $casename);
$def[$casecount_int] .= rrd::line1("case{$casecount}", $col_case_runtime_line, "");
}
$def[$casecount_int] .= rrd::gprint("case{$casecount}", "LAST", "%3.2lf s LAST");
$def[$casecount_int] .= rrd::gprint("case{$casecount}", "MAX", "%3.2lf s MAX ");
$def[$casecount_int] .= rrd::gprint("case{$casecount}", "AVERAGE", "%3.2lf s AVG \\j");
$def[0] .= rrd::comment(" \\n");
# Case graph, Warn/Crit LINE ##########################################################
foreach ($this->DS as $k => $v) {
if (preg_match('/^c_' . $casecount . '__(warning|critical)/', $v['LABEL'], $matches)) {
$threshold = $matches[1];
$def[$casecount_int] .= rrd::def("case_" . $casecount . "__" . $threshold, $v["RRDFILE"], $v["DS"], "AVERAGE");
$def[$casecount_int] .= rrd::line1("case_" . $casecount . "__" . $threshold, ${"col_" . $threshold}, $threshold . " at \\g", 0);
$def[$casecount_int] .= rrd::gprint("case_" . $casecount . "__" . $threshold, "LAST", "%3.0lf s ");
}
}
$def[$casecount_int] .= rrd::comment(" \\n");
$def[$casecount_int] .= rrd::comment(" \\n");
#######################
# TICKS for case state
#######################
$def[$casecount_int] .= rrd::comment("State ticker legend\\:");
$def[$casecount_int] .= rrd::comment(" \\n");
# TICKS for incomplete data ("data" = step/case LINE) ######################################################
# - complete data --> case_unknown_total == 0 --> no TICK (resp. warn/crit TICK)
# - incomplete data --> 0 < case_unknown_total < case_data_count --> orange TICK (overwrites evt warn/crit TICKS)
# - no data at all --> case_unknown_total == case_data_count --> no TICK
# see comments in case tick
$def[$casecount_int] .= rrd::cdef("tc_case" . $casecount . "_unknown_total_0", "case" . $casecount . ",UN,0,0,IF");
示例8: array
<?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++;
}
示例9: array
$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 ");
示例10: foreach
foreach ($this->DS as $KEY => $VAL) {
if ($VAL['TEMPLATE'] == "check_brick_usage") {
$ds_name[$KEY] = "Brick Utilization";
} else {
$ds_name[$KEY] = "Disk Utilization";
}
$name[$KEY] = "Mount Path: ";
$graph_type = $VAL['LABEL'];
$max_limit = $VAL['MAX'];
$unit = "GiB";
if (endsWith($graph_type, ".inode") || endsWith($graph_type, ".thinpool") || endsWith($graph_type, ".thinpool-metadata")) {
list($brick, $data_type) = explode(".", $graph_type);
$ds_name[$KEY] .= "(";
$ds_name[$KEY] .= $data_type;
$ds_name[$KEY] .= ")";
$name[$KEY] .= $brick;
if ($data_type == "inode") {
$unit = "";
}
} else {
$name[$KEY] .= $graph_type;
$ds_name[$KEY] .= "(space)";
}
$opt[$KEY] = "--vertical-label \"%(Total: {$max_limit} {$unit}) \" --lower-limit 0 --upper-limit 100 -r --title \"{$name[$KEY]}\" ";
$def[$KEY] = rrd::def("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
$def[$KEY] .= rrd::area("var1", "#008000", "Usage");
$def[$KEY] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%.3lf %%");
$def[$KEY] .= rrd::line2($VAL['WARN'], "#FFA500", "Warning\\n");
$def[$KEY] .= rrd::line2($VAL['CRIT'], "#FF0000", "Critical\\n");
$def[$KEY] .= rrd::comment(" \\n");
}
示例11: array
$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++;
}
}
示例12: array
// 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
#$def[1] .= rrd::area("v_real_used", "#FF9900", "Real used");
$def[1] .= rrd::gprint("v_real_used", array("AVERAGE", "MIN", "MAX", "LAST"), "{$fmt}{$unit_scale}");
$def[1] .= rrd::area("v_cached", "#FFAAFF", "Cached", true);
$def[1] .= rrd::gprint("v_cached", "LAST", "{$fmt}{$unit_scale}\\n");
$def[1] .= rrd::area("v_shared", "#0000FF", "Shared", true);
$def[1] .= rrd::gprint("v_shared", "LAST", "{$fmt}{$unit_scale}\\n");
$def[1] .= rrd::area("v_buffered", "#AAFFFF", "Buffered", true);
$def[1] .= rrd::gprint("v_buffered", "LAST", "{$fmt}{$unit_scale}\\n");
$def[1] .= rrd::area("v_free", "#FAFAAA", "Free", true);
$def[1] .= rrd::gprint("v_free", "LAST", "{$fmt}{$unit_scale}\\n");
// Stack swap on the same graph
$def[1] .= rrd::area("v_swused", "#3D3D3D", "Swap used", true);
$def[1] .= rrd::gprint("v_swused", array("AVERAGE", "MAX", "LAST"), "{$fmt}{$unit_scale}");
$def[1] .= rrd::area("v_swfree", "#DDDDDD", "Swap free", true);
$def[1] .= rrd::gprint("v_swfree", "LAST", "{$fmt}{$unit_scale}\\n");
$def[1] .= rrd::line1("v_real_used", "#000000");
// Draw total
$def[1] .= rrd::line1("v_total", "#009900", "Total");
$def[1] .= rrd::gprint("v_total", "LAST", "{$fmt}{$unit_scale}\\n");
// Debug
//fwrite($fp, ob_get_clean());
//fclose($fp);
示例13: str_replace
$divis = $max[3];
$return = '';
}
$ds_name[$KEY] = str_replace("_", "/", $VAL['NAME']);
# set graph labels
$opt[$KEY] = "--vertical-label {$label} -l 0 {$upper} --title \"Filesystem {$ds_name[$KEY]}\" ";
# Graph Definitions
$def[$KEY] = rrd::def("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
# "normalize" graph values
$def[$KEY] .= rrd::cdef("v_n", "var1,{$divis},/");
$def[$KEY] .= rrd::area("v_n", "#c6c6c6", $ds_name[$KEY]);
$def[$KEY] .= rrd::line1("v_n", "#003300");
# show values in legend
$def[$KEY] .= rrd::gprint("v_n", "LAST", "{$fmt} {$label}{$pct} {$maximum} ");
$def[$KEY] .= rrd::gprint("v_n", "AVERAGE", "{$fmt} {$label}{$pct} avg used {$return}");
# create max line and legend
if ($VAL['MAX'] != "") {
$def[$KEY] .= rrd::gprint("v_n", "MAX", "{$fmt} {$label}{$pct} max used \\n");
$def[$KEY] .= rrd::hrule($max[1], "#003300", "Size of FS {$max['0']} \\n");
}
# create warning line and legend
if ($VAL['WARN'] != "") {
$warn = pnp::adjust_unit($VAL['WARN'] . $unit, 1024, $fmt);
$def[$KEY] .= rrd::hrule($warn[1], "#ffff00", "Warning on {$warn['0']} \\n");
}
# create critical line and legend
if ($VAL['CRIT'] != "") {
$crit = pnp::adjust_unit($VAL['CRIT'] . $unit, 1024, $fmt);
$def[$KEY] .= rrd::hrule($crit[1], "#ff0000", "Critical on {$crit['0']}\\n");
}
}
示例14: array
#
$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);
$def[1] .= rrd::gprint("memfree", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
$def[1] .= rrd::area("swap", "#800000", "Swap ", true);
$def[1] .= rrd::gprint("swap", array("LAST", "AVERAGE", "MAX"), "%6.2lf%s");
# vim: set ts=4 sw=4 et syn=php :
示例15: array
<?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");
?>