<?php namespace Spechal\Lcgp; $config = \Config::get('lcgp::collectd'); // host comes from the controller that load the plugin $config['host'] = $host; $config['plugin'] = 'interface'; $obj = new CollectdGraphIO($config); $obj->setDataSources(array('rx', 'tx')); $obj->setDataSourceNames(array('rx' => 'Receive', 'tx' => 'Transmit')); $obj->setColors(array('rx' => '0000FF', 'tx' => '00B000')); $obj->setFormat('%.0lf'); switch ($obj->getArg('type')) { case 'if_errors': $obj->setTitle('Interface Errors (' . $obj->getArg('plugin_instance') . ')')->setVertical('Errors per second'); break; case 'if_octets': $obj->setTitle('Interface Traffic (' . $obj->getArg('plugin_instance') . ')')->setVertical('Bytes per second'); break; case 'if_packets': $obj->setTitle('Interface Packets (' . $obj->getArg('plugin_instance') . ')')->setVertical('Packets per second'); break; default: break; } $graphs[$config['plugin']][] = $obj->rrd_graph();
<?php namespace Spechal\Lcgp; $config = \Config::get('lcgp::collectd'); // host comes from the controller that load the plugin $config['host'] = $host; $config['plugin'] = 'swap'; switch ($_GET['type']) { case 'swap': $obj = new CollectdGraphStacked($config); $obj->setOrder(array('free', 'cached', 'used')); $obj->setDataSourceNames(array('free' => 'Free', 'cached' => 'Cached', 'used' => 'Used')); $obj->setTitle('Swap Utilization')->setVertical('Bytes'); $obj->setColors(array('free' => '00E000', 'cached' => '0000FF', 'used' => 'FF0000')); break; case 'swap_io': $obj = new CollectdGraphIO($config); $obj->setOrder(array('out', 'in')); $obj->setDataSourceNames(array('out' => 'Out', 'in' => 'In')); $obj->setTitle('Swapped I/O Pages')->setVertical('Pages'); $obj->setColors(array('out' => '0000FF', 'in' => '00B000')); break; default: break; } $obj->setFormat('%5.1lf%s'); $graphs[$config['plugin']][] = $obj->rrd_graph();
<?php namespace Spechal\Lcgp; $config = \Config::get('lcgp::collectd'); // host comes from the controller that load the plugin $config['host'] = $host; $config['plugin'] = 'disk'; $obj = new CollectdGraphIO($config); $obj->setDataSources(array('read', 'write')); $obj->setDataSourceNames(array('read' => 'Read', 'write' => 'Written')); $obj->setColors(array('read' => '0000FF', 'write' => '00B000')); switch ($obj->getArg('type')) { case 'disk_merged': $obj->setTitle('Disk Merge Operations (' . $obj->getArg('plugin_instance') . ')')->setVertical('Merged Operations per second')->setFormat('%5.1lf%s'); break; case 'disk_octets': $obj->setTitle('Disk Traffic (' . $obj->getArg('plugin_instance') . ')')->setVertical('Bytes per second')->setFormat('%5.1lf%s'); break; case 'disk_ops': $obj->setTitle('Disk Operations (' . $obj->getArg('plugin_instance') . ')')->setVertical('Operations per second')->setFormat('%5.1lf%s'); break; case 'disk_time': $obj->setTitle('Disk Time per op (' . $obj->getArg('plugin_instance') . ')')->setVertical('Avg Time per op')->setFormat('%5.1lf%s')->setScale(0.001); break; default: break; } $graphs[$config['plugin']][] = $obj->rrd_graph();