本文整理汇总了PHP中rrd::cdef方法的典型用法代码示例。如果您正苦于以下问题:PHP rrd::cdef方法的具体用法?PHP rrd::cdef怎么用?PHP rrd::cdef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rrd
的用法示例。
在下文中一共展示了rrd::cdef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$opt[$defcnt] = "--vertical-label \"Bytes\" --title \"Total sql server memory on {$hostname}\" ";
$def[$defcnt] = "";
$def[$defcnt] .= rrd::def("mem", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST");
$def[$defcnt] .= rrd::area("mem", "#c3c3c3", "Memory");
$def[$defcnt] .= rrd::line1("mem", "#111111");
$def[$defcnt] .= rrd::gprint("mem", array("MAX", "AVERAGE", "LAST"), "%.1lf %SB");
$defcnt++;
}
if (preg_match('/^buffer_cache_hit_ratio$/', $VAL['NAME'])) {
$ds_name[$defcnt] = "Buffer Cache Hit Ratio";
$opt[$defcnt] = "--vertical-label \"%\" --title \"Buffer cache hit ratio on {$hostname}\" ";
$def[$defcnt] = "";
$def[$defcnt] .= rrd::def("bufcahitrat", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE:reduce=LAST");
$def[$defcnt] .= rrd::cdef("ar", "bufcahitrat," . $VAL['CRIT_MIN'] . ",LE,bufcahitrat,0,GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF");
$def[$defcnt] .= rrd::cdef("ay", "bufcahitrat," . $VAL['WARN_MIN'] . ",LE,bufcahitrat," . $VAL['CRIT_MIN'] . ",GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF");
$def[$defcnt] .= rrd::cdef("ag", "bufcahitrat,100,LE,bufcahitrat," . $VAL['WARN_MIN'] . ",GT,INF,UNKN,IF,UNKN,IF,ISINF,bufcahitrat,0,IF");
$def[$defcnt] .= rrd::area("ag", "#{$green}");
$def[$defcnt] .= rrd::area("ay", "#{$yellow}");
$def[$defcnt] .= rrd::area("ar", "#{$red}");
$def[$defcnt] .= rrd::line1("bufcahitrat", "#000000:");
$def[$defcnt] .= rrd::gprint("bufcahitrat", "LAST", "Hit ratio is %3.2lf percent\\n");
$defcnt++;
}
if (preg_match('/^(.*)_lock_timeouts_per_sec/', $VAL['NAME'], $match)) {
$dsname = $match[1];
if (empty($opt[1])) {
$opt[1] = "--vertical-label \"Lock timeouts/s\" -l0 --title \"Locks timeouts / sec\" ";
}
if (empty($def[1])) {
$def[1] = "";
}
示例2: str_replace
if ($VAL['MAX'] != "") {
# adjust value and unit, details in .../helpers/pnp.php
$max = pnp::adjust_unit($VAL['MAX'] . $unit, 1024, $fmt);
$upper = "-u {$max['1']} ";
$maximum = "of {$max['1']} {$max['2']}{$pct} used";
$label = $max[2];
$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");
}
示例3: array
$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
#$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
示例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: sprintf
<?php
$color = '#0000FFCC';
$ds_name[1] = 'resources / nodes';
$opt[1] = sprintf('-T 55 -l 0 --vertical-label "Resources/Node" --title "%s / PuppetDB Average Resources Per Node"', $hostname);
$def[1] = rrd::def('var1', $rrdfile, $DS[1], 'AVERAGE');
$def[1] .= rrd::def('var2', $rrdfile, $DS[2], 'AVERAGE');
$def[1] .= rrd::cdef('math1', 'var2,var1,/');
$def[1] .= rrd::area('math1', $color, 'Resources Per Node');
$def[1] .= rrd::gprint('math1', array('LAST'), "%4.0lf %s");
$ds_name[2] = 'nodes';
$opt[2] = sprintf('-T 55 -l 0 --vertical-label "# Nodes" --title "%s / PuppetDB Node Count"', $hostname);
$def[2] = rrd::def('var1', $rrdfile, $DS[1], 'AVERAGE');
$def[2] .= rrd::area('var1', $color, 'Nodes');
$def[2] .= rrd::gprint('var1', array('LAST'), "%4.0lf %s");
$ds_name[3] = 'resources';
$opt[3] = sprintf('-T 55 -l 0 --vertical-label "# Resources" --title "%s / PuppetDB Resource Count"', $hostname);
$def[3] = rrd::def('var1', $rrdfile, $DS[2], 'AVERAGE');
$def[3] .= rrd::area('var1', $color, 'Resources');
$def[3] .= rrd::gprint('var1', array('LAST'), "%4.2lf %s");
示例6: asort
# 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");
}
示例7: array
$def[$id_amp] .= rrd::cdef("tier{$KEY}", "var{$KEY},10,/");
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "b7::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "bf::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "c7::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "cf::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "d7::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "df::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "e7::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "ef::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "f7::STACK ";
$def[$id_amp] .= "AREA:tier{$KEY}#" . $colors[$a] . "ff:\"{$label}{$space}\":STACK ";
$a++;
if ($first) {
$def[$id_amp] .= rrd::cdef("sum{$KEY}", "var{$KEY},0,+");
} else {
$def[$id_amp] .= rrd::cdef("sum{$KEY}", "sum" . ($KEY - 1) . ",var{$KEY},+");
}
$def[$id_amp] .= rrd::line1("sum{$KEY}", "#555555");
$def[$id_amp] .= rrd::gprint("var{$KEY}", array("LAST", "MAX", "AVERAGE"), "%6.1lf A last");
}
# VOLTAGE PROBE
if (preg_match('/^V/', $label)) {
# Long label
$label = preg_replace('/^V(\\d+)_(.+)/', '$2', $label);
$label = preg_replace('/_/', ' ', $label);
# Short label
$label = preg_replace('/^V(\\d+)$/', 'Probe $1', $label);
$ds_name[$id_volt] = "Voltage Probes";
$vlabel = "Volts";
$title = $ds_name[$id_volt];
$opt[$id_volt] = "--slope-mode --vertical-label \"{$vlabel}\" --title \"{$def_title}: {$title}\" ";
示例8: array
}
if (isset($swap_paged_in) && isset($swap_paged_out) && isset($data_paged_in) && isset($data_paged_out)) {
$gkey++;
$opt[$gkey] = '--vertical-label # --title "Memory and Swap Operations on ' . $this->MACRO['DISP_HOSTNAME'] . '"';
$ds_name[$gkey] = "Memory and Swap Operations";
$def[$gkey] = rrd::def("data_paged_in", $data_paged_in['RRDFILE'], $data_paged_in['DS'], "AVERAGE");
$def[$gkey] .= rrd::def("data_paged_out", $data_paged_out['RRDFILE'], $data_paged_out['DS'], "AVERAGE");
$def[$gkey] .= rrd::def("swap_paged_in", $swap_paged_in['RRDFILE'], $swap_paged_in['DS'], "AVERAGE");
$def[$gkey] .= rrd::def("swap_paged_out", $swap_paged_out['RRDFILE'], $swap_paged_out['DS'], "AVERAGE");
$def[$gkey] .= "AREA:data_paged_in#00CF00:\"Data Paged In \\: \t\\g\" ";
$def[$gkey] .= rrd::gprint("data_paged_in", array("LAST", "AVERAGE", "MAX"), '%6.2lf ');
$def[$gkey] .= "AREA:data_paged_out#FF8C0:\"Data Paged Out\\: \t\\g\":STACK ";
$def[$gkey] .= rrd::gprint("data_paged_out", array("LAST", "AVERAGE", "MAX"), '%6.2lf ');
$def[$gkey] .= "LINE2:swap_paged_in#FF0000:\"Swap Paged In \\: \t\\g\" ";
$def[$gkey] .= rrd::gprint("swap_paged_in", array("LAST", "AVERAGE", "MAX"), '%6.2lf ');
$def[$gkey] .= rrd::cdef("swap_paged_out_line", "swap_paged_out,data_paged_in,+");
$def[$gkey] .= "LINE2:swap_paged_out_line#0000FF:\"Swap Paged Out\\: \t\\g\" ";
$def[$gkey] .= rrd::gprint("swap_paged_out", array("LAST", "AVERAGE", "MAX"), '%6.2lf ');
}
if (isset($num_intr) && isset($ctxt)) {
$gkey++;
$opt[$gkey] = '--vertical-label "events per sec" --title "Interrupts and Context Switches on ' . $this->MACRO['DISP_HOSTNAME'] . '"';
$ds_name[$gkey] = "Interrupts and Context Switches";
$def[$gkey] = rrd::def("ctxt", $ctxt['RRDFILE'], $ctxt['DS'], "AVERAGE");
$def[$gkey] .= rrd::def("num_intr", $num_intr['RRDFILE'], $num_intr['DS'], "AVERAGE");
$def[$gkey] .= "AREA:ctxt#00CF00:\"Context Switches (per second)\\: \t\\g\" ";
$def[$gkey] .= rrd::gprint("ctxt", array("LAST", "AVERAGE", "MAX"), '%6.2lf ');
$def[$gkey] .= "LINE1:num_intr#FF0000:\"Interrupts (per second) \\: \t\\g\" ";
$def[$gkey] .= rrd::gprint("num_intr", array("LAST", "AVERAGE", "MAX"), '%6.2lf ');
}
if (isset($processes) && isset($procs_running) && isset($procs_blocked)) {
示例9: array
#third graph - open slots count
$ds_name[3] = "Open slots";
$opt[3] = " --vertical-label \"Workers\" --title \"Apache open slots on {$hostname} / {$servicedesc}\" ";
$opt[3] .= " --slope-mode ";
$def[3] = rrd::def("var1", $RRDFILE[1], $DS[11], "AVERAGE");
$def[3] .= rrd::area("var1", "#e0e0e0", "open slots");
$def[3] .= rrd::line1("var1", "#858585");
$def[3] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%7.0lf");
#fourth graph - server's traffic total and per request
$ds_name[4] = "Apache Traffic";
$opt[4] = " --vertical-label \"Traffic\" -b 1024 --title \"Apache Traffic for {$hostname} / {$servicedesc}\" ";
$opt[4] .= " --slope-mode ";
$def[4] = rrd::def("var1", $RRDFILE[1], $DS[13], "AVERAGE");
$def[4] .= rrd::cdef("trbytes", "var1,1024,*");
$def[4] .= rrd::def("var2", $RRDFILE[1], $DS[14], "AVERAGE");
$def[4] .= rrd::cdef("negperreq", "var2,-1,*");
$def[4] .= "VDEF:totalbytes=trbytes,TOTAL ";
$def[4] .= rrd::area("trbytes", "#b0c0fb", "throughput");
$def[4] .= rrd::line1("trbytes", "#3c63ff");
$def[4] .= rrd::gprint("trbytes", array("LAST", "MAX", "AVERAGE"), "%7.2lf %sB/sec");
$def[4] .= rrd::line2("negperreq", "#00ff00", "kB/request");
$def[4] .= rrd::gprint("var2", array("LAST", "MAX", "AVERAGE"), "%7.2lf %s{$UNIT['14']}");
$def[4] .= "GPRINT:totalbytes:\"%3.0lf %sB total\\n\" ";
#fifth graph - requests per sec ( rate is calculated by apache, time smoothed, very averaged, shouldn't be believed)
$ds_name[5] = "Apache requests";
$opt[5] = " --vertical-label \"Request/sec\" --title \"Apache request/sec for {$hostname} / {$servicedesc}\" ";
$opt[5] .= " --slope-mode ";
$def[5] = rrd::def("var1", $RRDFILE[1], $DS[12], "AVERAGE");
$def[5] .= rrd::area("var1", "#b7ff9e", "Requests / sec");
$def[5] .= rrd::line1("var1", "#2eae00");
$def[5] .= rrd::gprint("var1", array("LAST", "MAX", "AVERAGE"), "%7.2lf %s");
示例10: array
}
if ($CRIT[1] != "") {
$def[1] .= "HRULE:{$CRIT['1']}#FF0000 ";
}
$def[1] .= rrd::area("readmbps", "#40c080", "Read ");
$def[1] .= rrd::gprint("readmbps", "LAST", "%6.1lf MB/s last ");
$def[1] .= rrd::gprint("readmbps", "AVERAGE", "%6.1lf MB/s avg ");
$def[1] .= rrd::gprint("readmbps", "MAX", "%6.1lf MB/s max\\n");
$def[1] .= rrd::area("writembps_neg", "#4080c0", "Write ");
$def[1] .= rrd::gprint("writembps", "LAST", "%6.1lf MB/s last ");
$def[1] .= rrd::gprint("writembps", "AVERAGE", "%6.1lf MB/s avg ");
$def[1] .= rrd::gprint("writembps", "MAX", "%6.1lf MB/s max\\n");
$opt[2] = "--vertical-label 'Throughput (ops/s)' --title \"Disk throughput {$hostname} - disk {$disk}\" ";
$def[2] = rrd::def("readps", $RRDFILE[$INDEX['readps']], $DS[$INDEX['readps']], "AVERAGE");
$def[2] .= rrd::def("writeps", $RRDFILE[$INDEX['writeps']], $DS[$INDEX['writeps']], "AVERAGE");
$def[2] .= rrd::cdef("writeps_neg", "writeps,-1,*");
$def[2] .= rrd::area("readps", "#40c080", "Read ");
$def[2] .= rrd::gprint("readps", array("LAST", "AVERAGE", "MAX"), "%6.2lf ");
$def[2] .= rrd::area("writeps_neg", "#4080c0", "Write ");
$def[2] .= rrd::gprint("writeps", array("LAST", "AVERAGE", "MAX"), "%6.2lf ");
$ds_name[3] = "{$NAGIOS_AUTH_SERVICEDESC}";
$opt[3] = "--vertical-label 'Duration (ms)' --title \"Transaction Duration {$hostname} - disk {$disk}\" ";
$def[3] = rrd::def("svc_t", $RRDFILE[$INDEX['svc_t']], $DS[$INDEX['svc_t']], "AVERAGE");
$def[3] .= rrd::line1("svc_t", "#FF2211", "Duration");
$def[3] .= rrd::gprint("svc_t", array("LAST", "AVERAGE", "MAX"), "%6.2lf ");
$ds_name[4] = "{$NAGIOS_AUTH_SERVICEDESC}";
$opt[4] = "--vertical-label '% Busy' --title \"% of time transaction were blocked {$hostname} - disk {$disk}\" ";
$def[4] = rrd::def("busy", $RRDFILE[$INDEX['busy']], $DS[$INDEX['busy']], "AVERAGE");
$def[4] .= rrd::area("busy", "#3366FF", "Busy");
$def[4] .= rrd::gprint("busy", array("LAST", "AVERAGE", "MAX"), "%6.2lf ");
$ds_name[5] = "{$NAGIOS_AUTH_SERVICEDESC}";
示例11: array
//ob_start();
$DS_mem = $this->DS[0];
$DS_pool = $this->DS[1];
$fmt = '%4.2lf';
$unit = $DS_mem['UNIT'];
$max = pnp::adjust_unit($DS_mem['MAX'] . $unit, 1024, $fmt);
$upper = "-u {$max['1']}";
# set graph labels
$opt[1] = "--vertical-label {$unit} -l 0 {$upper} --title \"JVM " . $DS_mem['NAME'] . "\" ";
# Graph Definitions
$def[1] = rrd::def("var1", $DS_mem['RRDFILE'], $DS_mem['DS']);
$def[1] .= rrd::def("var2", $DS_pool['RRDFILE'], $DS_pool['DS']);
# "normalize" graph values
$divis = $max[3];
$def[1] .= rrd::cdef("v_n", "var1,{$divis},/");
$def[1] .= rrd::cdef("v_pool", "var2,{$divis},/");
$def[1] .= rrd::gradient("v_n", "00FF33", "339900", $DS_mem['NAME']);
$def[1] .= rrd::line1("v_n", "#003300");
$def[1] .= rrd::gprint("v_n", array("LAST", "MAX", "AVERAGE"), "{$fmt} {$unit}");
$def[1] .= rrd::gradient("v_pool", "00FFDD", "3399DD", $DS_pool['NAME']);
$def[1] .= rrd::line1("v_pool", "#003300");
$def[1] .= rrd::gprint("v_pool", "LAST", "{$fmt} {$unit}\\n");
# create max line and legend
//$def[1] .= rrd::gprint("v_n", "MAX", "$fmt $unit max used \\n");
$def[1] .= rrd::hrule($max[1], "#003300", "Max size ({$max['0']}) \\n");
# create warning line and legend
$warn = pnp::adjust_unit($DS_mem['WARN'] . $unit, 1024, $fmt);
$def[1] .= rrd::hrule($warn[1], "#ffff00", "Warning ({$warn['0']}) \\n");
# create critical line and legend
$crit = pnp::adjust_unit($DS_mem['CRIT'] . $unit, 1024, $fmt);
$def[1] .= rrd::hrule($crit[1], "#ff0000", "Critical ({$crit['0']})\\n");
示例12: Copyright
<?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];
$opt[1] = "--vertical-label \"Response time\" -l0 --title \"HTTP response time for {$hostname} / {$servicedesc}\" ";
$def[1] = rrd::def("var1", $DS_time['RRDFILE'], $DS_time['DS']);
$def[1] .= rrd::cdef("v_n", "var1,1000,*");
// display in ms
$def[1] .= rrd::gradient("v_n", "#33CCFF", "#3300FF", "time");
$def[1] .= rrd::line1("v_n", "#000000");
$def[1] .= rrd::gprint("v_n", array("LAST", "AVERAGE", "MIN", "MAX"), "%6.3lfms");
示例13: array
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//$fp = fopen('/tmp/test', 'a');
//ob_start();
$DS_in = $this->DS[0];
$DS_out = $this->DS[1];
$unit = 'B';
$fmt = "%6.2lf";
$max_in = pnp::adjust_unit($DS_in['ACT'] . $unit, 1024, $fmt);
$max_out = pnp::adjust_unit($DS_out['ACT'] . $unit, 1024, $fmt);
$max = $max_in;
$opt[1] = "--slope-mode --vertical-label \"bytes/s\" -u {$max['1']} -l0 --title \"Interface traffic / {$hostname}\"";
$divis = $max[3];
$def[1] = rrd::def("var1", $DS_in['RRDFILE'], $DS_in['DS'], "AVERAGE");
$def[1] .= rrd::def("var2", $DS_out['RRDFILE'], $DS_out['DS'], "AVERAGE");
$def[1] .= rrd::cdef("v_in", "var1,-1,*");
$def[1] .= rrd::cdef("v_out", "var2,1,*");
$def[1] .= rrd::cdef("v_in_f", "var1,1024,/");
// KiB
$def[1] .= rrd::cdef("v_out_f", "var2,1024,/");
// KiB
$def[1] .= rrd::gradient("v_out", "#33CCFF", "#0000FF", $DS_out['NAME']);
$def[1] .= rrd::gprint("v_out_f", array("LAST", "AVERAGE", "MAX"), "{$fmt} KiB/s");
$def[1] .= rrd::gradient("v_in", "#FFCC66", "#FF0000", $DS_in['NAME']);
$def[1] .= rrd::gprint("v_in_f", array("LAST", "AVERAGE", "MAX"), "{$fmt} KiB/s");
// Debug
//$content = ob_get_clean();
//fwrite($fp, "$content\n");
//fclose($fp);
示例14: array
$DS_readdir = $this->DS[10];
$DS_readdirp = $this->DS[11];
$opt[1] = "--vertical-label \"Requests / s\" -l0 --title \"{$hostname} - NFS statistics\" ";
$def[1] = rrd::def("var_status", $DS_status['RRDFILE'], $DS_status['DS']);
$def[1] .= rrd::def("var_read", $DS_read['RRDFILE'], $DS_read['DS']);
$def[1] .= rrd::def("var_write", $DS_write['RRDFILE'], $DS_write['DS']);
//$def[1] .= rrd::def("var_create", $DS_create['RRDFILE'], $DS_create['DS']);
//$def[1] .= rrd::def("var_mkdir", $DS_mkdir['RRDFILE'], $DS_mkdir['DS']);
//$def[1] .= rrd::def("var_symlink", $DS_symlink['RRDFILE'], $DS_symlink['DS']);
//$def[1] .= rrd::def("var_mknod", $DS_mknod['RRDFILE'], $DS_mknod['DS']);
//$def[1] .= rrd::def("var_remove", $DS_remove['RRDFILE'], $DS_remove['DS']);
//$def[1] .= rrd::def("var_rmdir", $DS_rmdir['RRDFILE'], $DS_rmdir['DS']);
//$def[1] .= rrd::def("var_rename", $DS_rename['RRDFILE'], $DS_rename['DS']);
//$def[1] .= rrd::def("var_readdir", $DS_readdir['RRDFILE'], $DS_readdir['DS']);
//$def[1] .= rrd::def("var_readdirp", $DS_readdirp['RRDFILE'], $DS_readdirp['DS']);
$def[1] .= rrd::cdef("v_read", "var_read,-1,*");
$def[1] .= rrd::gradient("v_read", "#33CCFF", "#0000FF", "Read");
$def[1] .= rrd::gprint("var_read", array("LAST", "AVERAGE", "MAX"), "%6.2lfreq/s");
$def[1] .= rrd::gradient("var_write", "#FFCC66", "#FF0000", "Write");
$def[1] .= rrd::gprint("var_write", array("LAST", "AVERAGE", "MAX"), "%6.2lfreq/s");
$def[1] .= rrd::hrule(0, "#838383");
//$def[1] .= rrd::line1("var_create", "#0000AA", "Create");
//$def[1] .= rrd::gprint("var_create", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
//
//$def[1] .= rrd::line1("var_mkdir", "#0000FF", "Mkdir");
//$def[1] .= rrd::gprint("var_mkdir", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
//
//$def[1] .= rrd::line1("var_symlink", "#005500", "Symlink");
//$def[1] .= rrd::gprint("var_symlink", array("LAST", "AVERAGE", "MAX"), "%6.2lf");
//
//$def[1] .= rrd::line1("var_mknod", "#00AA00", "Mknod");
示例15:
# Total Memory
$def[1] = "DEF:mem_total={$RRDFILE['1']}:{$DS['1']}:AVERAGE ";
# Used Memory
$def[1] .= "DEF:mem_used={$RRDFILE['1']}:{$DS['2']}:AVERAGE ";
# Cache
$def[1] .= "DEF:mem_cache={$RRDFILE['1']}:{$DS['3']}:AVERAGE ";
# Buffer
$def[1] .= "DEF:mem_buffer={$RRDFILE['1']}:{$DS['4']}:AVERAGE ";
# Memory Cache
$def[1] .= rrd::cdef("mem_cache_tmp", "mem_cache,mem_buffer,+,mem_used,+");
$def[1] .= rrd::area("mem_cache_tmp", "#DCDDD5", "Disk Cache");
$def[1] .= "GPRINT:mem_cache:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_cache:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_cache" . ':AVERAGE:"%3.2lf %sB Average \\j" ';
# Memory Buffer
$def[1] .= rrd::cdef("mem_buffer_tmp", "mem_buffer,mem_used,+");
$def[1] .= rrd::area("mem_buffer_tmp", "#3E606F", "I/O Buffers");
$def[1] .= "GPRINT:mem_buffer:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_buffer:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_buffer" . ':AVERAGE:"%3.2lf %sB Average \\j" ';
# Memory Used
$def[1] .= rrd::area("mem_used", "#193441", "Processes");
$def[1] .= "GPRINT:mem_used:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_used:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_used" . ':AVERAGE:"%3.2lf %sB Average \\j" ';
# Memory Total
$def[1] .= rrd::line1("mem_total", "#000000", "Total");
$def[1] .= "GPRINT:mem_total:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_total:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_total" . ':AVERAGE:"%3.2lf %sB Average \\j" ';
if ($WARN[2] != "") {