From e7193cd45a03e438719b156f330c2c7061484b1b Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Mon, 4 Jul 2011 20:58:29 +0200 Subject: plugin: add libvirt plugin --- plugin/libvirt.php | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 plugin/libvirt.php (limited to 'plugin') diff --git a/plugin/libvirt.php b/plugin/libvirt.php new file mode 100644 index 0000000..0d5071a --- /dev/null +++ b/plugin/libvirt.php @@ -0,0 +1,137 @@ +args['type']) { + case 'disk_octets': + $obj->data_sources = array('read', 'write'); + $obj->ds_names = array( + 'read' => 'Read', + 'write' => 'Written', + ); + $obj->colors = array( + 'read' => '0000ff', + 'write' => '00b000', + ); + $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['tinstance']); + $obj->rrd_vertical = 'Bytes per second'; + $obj->rrd_format = '%5.1lf%s'; + break; + case 'disk_ops': + $obj->data_sources = array('read', 'write'); + $obj->ds_names = array( + 'read' => 'Read', + 'write' => 'Written', + ); + $obj->colors = array( + 'read' => '0000ff', + 'write' => '00b000', + ); + $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['tinstance']); + $obj->rrd_vertical = 'Ops per second'; + $obj->rrd_format = '%5.1lf%s'; + break; + case 'if_dropped': + $obj->data_sources = array('rx', 'tx'); + $obj->ds_names = array( + 'rx' => 'Receive', + 'tx' => 'Transmit', + ); + $obj->colors = array( + 'rx' => '0000ff', + 'tx' => '00b000', + ); + $obj->rrd_title = sprintf('Interface Packets Dropped (%s)', $obj->args['tinstance']); + $obj->rrd_vertical = 'Packets dropped per second'; + break; + case 'if_errors': + $obj->data_sources = array('rx', 'tx'); + $obj->ds_names = array( + 'rx' => 'Receive', + 'tx' => 'Transmit', + ); + $obj->colors = array( + 'rx' => '0000ff', + 'tx' => '00b000', + ); + $obj->rrd_title = sprintf('Interface Errors (%s)', $obj->args['tinstance']); + $obj->rrd_vertical = 'Errors per second'; + break; + case 'if_octets': + $obj->data_sources = array('rx', 'tx'); + $obj->ds_names = array( + 'rx' => 'Receive', + 'tx' => 'Transmit', + ); + $obj->colors = array( + 'rx' => '0000ff', + 'tx' => '00b000', + ); + $obj->rrd_title = sprintf('Interface Traffic (%s)', $obj->args['tinstance']); + $obj->rrd_vertical = 'Bytes per second'; + break; + case 'if_packets': + $obj->data_sources = array('rx', 'tx'); + $obj->ds_names = array( + 'rx' => 'Receive', + 'tx' => 'Transmit', + ); + $obj->colors = array( + 'rx' => '0000ff', + 'tx' => '00b000', + ); + $obj->rrd_title = sprintf('Interface Packets (%s)', $obj->args['tinstance']); + $obj->rrd_vertical = 'Packets per second'; + break; + case 'virt_cpu_total': + require_once 'type/Default.class.php'; + $obj = new Type_Default($CONFIG); + + $obj->data_sources = array('ns'); + $obj->ds_names = array( + 'ns' => 'CPU time', + ); + $obj->colors = array( + 'ns' => '0000ff', + ); + $obj->rrd_title = 'CPU usage'; + $obj->rrd_vertical = 'CPU time'; + break; + case 'virt_vcpu': + require_once 'type/Default.class.php'; + $obj = new Type_Default($CONFIG); + + $obj->data_sources = array('ns'); + $obj->ds_names = array( + 'ns' => 'VCPU time', + ); + $obj->colors = array( + 'ns' => '0000ff', + ); + $obj->rrd_title = 'VCPU usage'; + $obj->rrd_vertical = 'VCPU time'; + break; +} + +$obj->width = $width; +$obj->heigth = $heigth; +$obj->rrd_format = '%5.1lf%s'; + +collectd_flush($obj->identifiers); +$obj->rrd_graph(); -- cgit v1.1