From cd94ef34134d8f06af83ec97119018b4e80346a0 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 20 Sep 2009 13:36:25 +0200 Subject: initial import of cgp Collectd Graph Panel is a frontend for Collectd written in PHP. The goal of CGP is to provide an easy-to-use frontend for Collectd, starting with page that shows an overview of all the hosts you are managing with Collectd. In this initial import there is support for the plugins that are default enabled in Collectd. The supported plugins are located in the plugin directory. --- plugin/cpu.php | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++ plugin/df.php | 42 +++++++++++++++++++++++++++++++++ plugin/disk.php | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++ plugin/entropy.php | 37 ++++++++++++++++++++++++++++++ plugin/interface.php | 54 +++++++++++++++++++++++++++++++++++++++++++ plugin/irq.php | 40 ++++++++++++++++++++++++++++++++ plugin/load.php | 41 +++++++++++++++++++++++++++++++++ plugin/memory.php | 53 ++++++++++++++++++++++++++++++++++++++++++ plugin/processes.php | 58 ++++++++++++++++++++++++++++++++++++++++++++++ plugin/sensors.php | 58 ++++++++++++++++++++++++++++++++++++++++++++++ plugin/swap.php | 50 ++++++++++++++++++++++++++++++++++++++++ plugin/users.php | 37 ++++++++++++++++++++++++++++++ 12 files changed, 598 insertions(+) create mode 100644 plugin/cpu.php create mode 100644 plugin/df.php create mode 100644 plugin/disk.php create mode 100644 plugin/entropy.php create mode 100644 plugin/interface.php create mode 100644 plugin/irq.php create mode 100644 plugin/load.php create mode 100644 plugin/memory.php create mode 100644 plugin/processes.php create mode 100644 plugin/sensors.php create mode 100644 plugin/swap.php create mode 100644 plugin/users.php (limited to 'plugin') diff --git a/plugin/cpu.php b/plugin/cpu.php new file mode 100644 index 0000000..10fbf56 --- /dev/null +++ b/plugin/cpu.php @@ -0,0 +1,65 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}-{pinstance}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('value'); +$obj->order = array('idle', 'nice', 'user', 'wait', 'system', 'softirq', 'interrupt', 'steal'); +$obj->ds_names = array( + 'idle' => 'Idle ', + 'nice' => 'Nice ', + 'user' => 'User ', + 'wait' => 'Wait-IO', + 'system' => 'System ', + 'softirq' => 'SoftIRQ', + 'interrupt' => 'IRQ ', + 'steal' => 'Steal ', +); +$obj->colors = array( + 'idle' => 'e8e8e8', + 'nice' => '00e000', + 'user' => '0000ff', + 'wait' => 'ffb000', + 'system' => 'ff0000', + 'softirq' => 'ff00ff', + 'interrupt' => 'a000a0', + 'steal' => '000000', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; + +$obj->rrd_title = "CPU-$pinstance usage on $host"; +$obj->rrd_vertical = 'Jiffies'; +$obj->rrd_format = '%5.2lf'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/df.php b/plugin/df.php new file mode 100644 index 0000000..6398249 --- /dev/null +++ b/plugin/df.php @@ -0,0 +1,42 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('free', 'used'); +$obj->ds_names = array( + 'free' => 'Free', + 'used' => 'Used', +); +$obj->colors = array( + 'free' => '00ff00', + 'used' => 'ff0000', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; + +$obj->rrd_title = "Free space ($tinstance) on $host"; +$obj->rrd_vertical = 'Bytes'; +$obj->rrd_format = '%5.1lf%sB'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/disk.php b/plugin/disk.php new file mode 100644 index 0000000..298c179 --- /dev/null +++ b/plugin/disk.php @@ -0,0 +1,63 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}-{pinstance}/{type}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('read', 'write'); +$obj->ds_names = array( + 'read' => 'Read ', + 'write' => 'Written', +); +$obj->colors = array( + 'read' => '0000ff', + 'write' => '00b000', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; +switch($type) { + case 'disk_merged': + $obj->rrd_title = "Disk Merged Operations ($pinstance) on $host"; + $obj->rrd_vertical = 'Merged operations/s'; + $obj->rrd_format = '%5.1lf'; + break; + case 'disk_octets': + $obj->rrd_title = "Disk Traffic ($pinstance) on $host"; + $obj->rrd_vertical = 'Bytes per second'; + $obj->rrd_format = '%5.1lf%s'; + break; + case 'disk_ops': + $obj->rrd_title = "Disk Operations ($pinstance) on $host"; + $obj->rrd_vertical = 'Ops per second'; + $obj->rrd_format = '%5.1lf'; + break; + case 'disk_time': + $obj->rrd_title = "Disk time per operation ($pinstance) on $host"; + $obj->rrd_vertical = 'Avg. Time/Op'; + $obj->rrd_format = '%5.1lf%ss'; + $obj->scale = '0.001'; + break; +} + +$obj->rrd_graph(); + +?> diff --git a/plugin/entropy.php b/plugin/entropy.php new file mode 100644 index 0000000..55159dc --- /dev/null +++ b/plugin/entropy.php @@ -0,0 +1,37 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('entropy'); +$obj->ds_names = array( + 'entropy' => 'Entropy bits', +); +$obj->colors = array( + 'entropy' => '0000f0', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; +$obj->rrd_title = "Available entropy on $host"; +$obj->rrd_vertical = 'Bits'; +$obj->rrd_format = '%4.0lf'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/interface.php b/plugin/interface.php new file mode 100644 index 0000000..2f345f9 --- /dev/null +++ b/plugin/interface.php @@ -0,0 +1,54 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('rx', 'tx'); +$obj->ds_names = array( + 'rx' => 'Receive ', + 'tx' => 'Transmit', +); +$obj->colors = array( + 'rx' => '0000ff', + 'tx' => '00b000', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; +$obj->rrd_format = '%5.1lf%s'; +switch($type) { + case 'if_errors': + $obj->rrd_title = "Interface Errors ($tinstance) on $host"; + $obj->rrd_vertical = 'Errors per second'; + break; + case 'if_octets': + $obj->rrd_title = "Interface Traffic ($tinstance) on $host"; + $obj->rrd_vertical = 'Bits per second'; + break; + case 'if_packets': + $obj->rrd_title = "Interface Packets ($tinstance) on $host"; + $obj->rrd_vertical = 'Packets per second'; + break; +} + +$obj->rrd_graph(); + +?> diff --git a/plugin/irq.php b/plugin/irq.php new file mode 100644 index 0000000..2759c0e --- /dev/null +++ b/plugin/irq.php @@ -0,0 +1,40 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('value'); +$obj->ds_names = NULL; +$obj->colors = NULL; +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; + +$obj->rrd_title = "Interrupts on $host"; +$obj->rrd_vertical = 'IRQs/s'; +$obj->rrd_format = '%6.1lf'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/load.php b/plugin/load.php new file mode 100644 index 0000000..d7db740 --- /dev/null +++ b/plugin/load.php @@ -0,0 +1,41 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('shortterm', 'midterm', 'longterm'); +$obj->ds_names = array( + 'shortterm' => ' 1 min', + 'midterm' => ' 5 min', + 'longterm' => '15 min', +); +$obj->colors = array( + 'shortterm' => '00ff00', + 'midterm' => '0000ff', + 'longterm' => 'ff0000', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; +$obj->rrd_title = "System load on $host"; +$obj->rrd_vertical = 'System load'; +$obj->rrd_format = '%.2lf'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/memory.php b/plugin/memory.php new file mode 100644 index 0000000..7944238 --- /dev/null +++ b/plugin/memory.php @@ -0,0 +1,53 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('value'); +$obj->order = array('free', 'buffered', 'cached', 'used'); +$obj->ds_names = array( + 'free' => 'Free ', + 'cached' => 'Cached ', + 'buffered' => 'Buffered', + 'used' => 'Used ', +); +$obj->colors = array( + 'free' => '00e000', + 'cached' => '0000ff', + 'buffered' => 'ffb000', + 'used' => 'ff0000', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; + +$obj->rrd_title = "Physical memory utilization on $host"; +$obj->rrd_vertical = 'Bytes'; +$obj->rrd_format = '%5.1lf%s'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/processes.php b/plugin/processes.php new file mode 100644 index 0000000..445e1e4 --- /dev/null +++ b/plugin/processes.php @@ -0,0 +1,58 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('value'); +$obj->ds_names = array( + 'paging' => 'Paging ', + 'blocked' => 'Blocked ', + 'zombies' => 'Zombies ', + 'stopped' => 'Stopped ', + 'running' => 'Running ', + 'sleeping' => 'Sleeping', +); +$obj->colors = array( + 'paging' => 'ffb000', + 'blocked' => 'ff00ff', + 'zombies' => 'ff0000', + 'stopped' => 'a000a0', + 'running' => '00e000', + 'sleeping' => '0000ff', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; + +$obj->rrd_title = "Processes on $host"; +$obj->rrd_vertical = 'Processes'; +$obj->rrd_format = '%5.1lf%s'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/sensors.php b/plugin/sensors.php new file mode 100644 index 0000000..ad43378 --- /dev/null +++ b/plugin/sensors.php @@ -0,0 +1,58 @@ + $type)); + +$obj = new Type_Default; +$obj->datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}-{pinstance}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('value'); +$obj->ds_names = array( + 'value' => 'Value ', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; +switch($type) { + case 'fanspeed': + $obj->colors = '00ff00'; + $obj->rrd_title = "Fanspeed ($pinstance) on $host"; + $obj->rrd_vertical = 'RPM'; + $obj->rrd_format = '%5.1lf'; + break; + case 'temperature': + $obj->colors = '0000ff'; + $obj->rrd_title = "Temperature ($pinstance) on $host"; + $obj->rrd_vertical = 'Celius'; + $obj->rrd_format = '%5.1lf%s'; + break; + case 'voltage': + $obj->colors = 'ff0000'; + $obj->rrd_title = "Voltage ($pinstance) on $host"; + $obj->rrd_vertical = 'Volt'; + $obj->rrd_format = '%5.1lf'; + break; +} + +$obj->rrd_graph(); + +?> diff --git a/plugin/swap.php b/plugin/swap.php new file mode 100644 index 0000000..dfd9ba1 --- /dev/null +++ b/plugin/swap.php @@ -0,0 +1,50 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}-{tinstance}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('value'); +$obj->order = array('free', 'cached', 'used'); +$obj->ds_names = array( + 'free' => 'Free ', + 'cached' => 'Cached ', + 'used' => 'Used ', +); +$obj->colors = array( + 'free' => '00e000', + 'cached' => '0000ff', + 'used' => 'ff0000', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; + +$obj->rrd_title = "Swap utilization on $host"; +$obj->rrd_vertical = 'Bytes'; +$obj->rrd_format = '%5.1lf%s'; + +$obj->rrd_graph(); + +?> diff --git a/plugin/users.php b/plugin/users.php new file mode 100644 index 0000000..dfcaee3 --- /dev/null +++ b/plugin/users.php @@ -0,0 +1,37 @@ +datadir = $CONFIG['datadir']; +$obj->path_format = '{host}/{plugin}/{type}.rrd'; +$obj->args = array( + 'host' => $host, + 'plugin' => $plugin, + 'pinstance' => $pinstance, + 'type' => $type, + 'tinstance' => $tinstance, +); +$obj->data_sources = array('users'); +$obj->ds_names = array( + 'users' => 'Users', +); +$obj->colors = array( + 'users' => '0000f0', +); +$obj->width = $width; +$obj->heigth = $heigth; +$obj->seconds = $seconds; +$obj->rrd_title = "Users on $host"; +$obj->rrd_vertical = 'Users'; +$obj->rrd_format = '%.1lf'; + +$obj->rrd_graph(); + +?> -- cgit v1.1