diff options
Diffstat (limited to 'plugin/disk.php')
| -rw-r--r-- | plugin/disk.php | 63 |
1 files changed, 63 insertions, 0 deletions
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 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | # Collectd Disk plugin | ||
| 4 | |||
| 5 | require_once $CONFIG['webdir'].'/conf/config.php'; | ||
| 6 | require_once $CONFIG['webdir'].'/type/GenericIO.class.php'; | ||
| 7 | |||
| 8 | ## LAYOUT | ||
| 9 | # disk-XXXX/ | ||
| 10 | # disk-XXXX/disk_merged.rrd | ||
| 11 | # disk-XXXX/disk_octets.rrd | ||
| 12 | # disk-XXXX/disk_ops.rrd | ||
| 13 | # disk-XXXX/disk_time.rrd | ||
| 14 | |||
| 15 | $obj = new Type_GenericIO; | ||
| 16 | $obj->datadir = $CONFIG['datadir']; | ||
| 17 | $obj->path_format = '{host}/{plugin}-{pinstance}/{type}.rrd'; | ||
| 18 | $obj->args = array( | ||
| 19 | 'host' => $host, | ||
| 20 | 'plugin' => $plugin, | ||
| 21 | 'pinstance' => $pinstance, | ||
| 22 | 'type' => $type, | ||
| 23 | 'tinstance' => $tinstance, | ||
| 24 | ); | ||
| 25 | $obj->data_sources = array('read', 'write'); | ||
| 26 | $obj->ds_names = array( | ||
| 27 | 'read' => 'Read ', | ||
| 28 | 'write' => 'Written', | ||
| 29 | ); | ||
| 30 | $obj->colors = array( | ||
| 31 | 'read' => '0000ff', | ||
| 32 | 'write' => '00b000', | ||
| 33 | ); | ||
| 34 | $obj->width = $width; | ||
| 35 | $obj->heigth = $heigth; | ||
| 36 | $obj->seconds = $seconds; | ||
| 37 | switch($type) { | ||
| 38 | case 'disk_merged': | ||
| 39 | $obj->rrd_title = "Disk Merged Operations ($pinstance) on $host"; | ||
| 40 | $obj->rrd_vertical = 'Merged operations/s'; | ||
| 41 | $obj->rrd_format = '%5.1lf'; | ||
| 42 | break; | ||
| 43 | case 'disk_octets': | ||
| 44 | $obj->rrd_title = "Disk Traffic ($pinstance) on $host"; | ||
| 45 | $obj->rrd_vertical = 'Bytes per second'; | ||
| 46 | $obj->rrd_format = '%5.1lf%s'; | ||
| 47 | break; | ||
| 48 | case 'disk_ops': | ||
| 49 | $obj->rrd_title = "Disk Operations ($pinstance) on $host"; | ||
| 50 | $obj->rrd_vertical = 'Ops per second'; | ||
| 51 | $obj->rrd_format = '%5.1lf'; | ||
| 52 | break; | ||
| 53 | case 'disk_time': | ||
| 54 | $obj->rrd_title = "Disk time per operation ($pinstance) on $host"; | ||
| 55 | $obj->rrd_vertical = 'Avg. Time/Op'; | ||
| 56 | $obj->rrd_format = '%5.1lf%ss'; | ||
| 57 | $obj->scale = '0.001'; | ||
| 58 | break; | ||
| 59 | } | ||
| 60 | |||
| 61 | $obj->rrd_graph(); | ||
| 62 | |||
| 63 | ?> | ||
