diff options
Diffstat (limited to 'plugin/disk.php')
| -rw-r--r-- | plugin/disk.php | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/plugin/disk.php b/plugin/disk.php index 620b188..f1100d6 100644 --- a/plugin/disk.php +++ b/plugin/disk.php | |||
| @@ -13,15 +13,7 @@ require_once 'inc/collectd.inc.php'; | |||
| 13 | # disk-XXXX/disk_ops.rrd | 13 | # disk-XXXX/disk_ops.rrd |
| 14 | # disk-XXXX/disk_time.rrd | 14 | # disk-XXXX/disk_time.rrd |
| 15 | 15 | ||
| 16 | $obj = new Type_GenericIO; | 16 | $obj = new Type_GenericIO($CONFIG['datadir']); |
| 17 | $obj->datadir = $CONFIG['datadir']; | ||
| 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'); | 17 | $obj->data_sources = array('read', 'write'); |
| 26 | $obj->ds_names = array( | 18 | $obj->ds_names = array( |
| 27 | 'read' => 'Read ', | 19 | 'read' => 'Read ', |
| @@ -33,33 +25,31 @@ $obj->colors = array( | |||
| 33 | ); | 25 | ); |
| 34 | $obj->width = $width; | 26 | $obj->width = $width; |
| 35 | $obj->heigth = $heigth; | 27 | $obj->heigth = $heigth; |
| 36 | $obj->seconds = $seconds; | 28 | switch($obj->args['type']) { |
| 37 | switch($type) { | ||
| 38 | case 'disk_merged': | 29 | case 'disk_merged': |
| 39 | $obj->rrd_title = sprintf('Disk Merged Operations (%s)', $pinstance); | 30 | $obj->rrd_title = sprintf('Disk Merged Operations (%s)', $obj->args['pinstance']); |
| 40 | $obj->rrd_vertical = 'Merged operations/s'; | 31 | $obj->rrd_vertical = 'Merged operations/s'; |
| 41 | $obj->rrd_format = '%5.1lf'; | 32 | $obj->rrd_format = '%5.1lf'; |
| 42 | break; | 33 | break; |
| 43 | case 'disk_octets': | 34 | case 'disk_octets': |
| 44 | $obj->rrd_title = sprintf('Disk Traffic (%s)', $pinstance); | 35 | $obj->rrd_title = sprintf('Disk Traffic (%s)', $obj->args['pinstance']); |
| 45 | $obj->rrd_vertical = 'Bytes per second'; | 36 | $obj->rrd_vertical = 'Bytes per second'; |
| 46 | $obj->rrd_format = '%5.1lf%s'; | 37 | $obj->rrd_format = '%5.1lf%s'; |
| 47 | break; | 38 | break; |
| 48 | case 'disk_ops': | 39 | case 'disk_ops': |
| 49 | $obj->rrd_title = sprintf('Disk Operations (%s)', $pinstance); | 40 | $obj->rrd_title = sprintf('Disk Operations (%s)', $obj->args['pinstance']); |
| 50 | $obj->rrd_vertical = 'Ops per second'; | 41 | $obj->rrd_vertical = 'Ops per second'; |
| 51 | $obj->rrd_format = '%5.1lf'; | 42 | $obj->rrd_format = '%5.1lf'; |
| 52 | break; | 43 | break; |
| 53 | case 'disk_time': | 44 | case 'disk_time': |
| 54 | $obj->rrd_title = sprintf('Disk time per operation (%s)', $pinstance); | 45 | $obj->rrd_title = sprintf('Disk time per operation (%s)', $obj->args['pinstance']); |
| 55 | $obj->rrd_vertical = 'Avg. Time/Op'; | 46 | $obj->rrd_vertical = 'Avg. Time/Op'; |
| 56 | $obj->rrd_format = '%5.1lf%ss'; | 47 | $obj->rrd_format = '%5.1lf%ss'; |
| 57 | $obj->scale = '0.001'; | 48 | $obj->scale = '0.001'; |
| 58 | break; | 49 | break; |
| 59 | } | 50 | } |
| 60 | 51 | ||
| 61 | collectd_flush(ident_from_args($obj->args)); | 52 | collectd_flush($obj->identifiers); |
| 62 | |||
| 63 | $obj->rrd_graph(); | 53 | $obj->rrd_graph(); |
| 64 | 54 | ||
| 65 | ?> | 55 | ?> |
