diff options
Diffstat (limited to '')
| -rw-r--r-- | plugin/sensors.php | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/plugin/sensors.php b/plugin/sensors.php index 048f9f1..fda5432 100644 --- a/plugin/sensors.php +++ b/plugin/sensors.php | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | require_once 'conf/common.inc.php'; | 5 | require_once 'conf/common.inc.php'; |
| 6 | require_once 'type/Default.class.php'; | 6 | require_once 'type/Default.class.php'; |
| 7 | require_once 'inc/collectd.inc.php'; | ||
| 7 | 8 | ||
| 8 | ## LAYOUT | 9 | ## LAYOUT |
| 9 | # disk-XXXX/ | 10 | # disk-XXXX/ |
| @@ -11,49 +12,34 @@ require_once 'type/Default.class.php'; | |||
| 11 | # disk-XXXX/temerature-XXXX.rrd | 12 | # disk-XXXX/temerature-XXXX.rrd |
| 12 | # disk-XXXX/voltage-XXXX.rrd | 13 | # disk-XXXX/voltage-XXXX.rrd |
| 13 | 14 | ||
| 14 | # grouped | 15 | $obj = new Type_Default($CONFIG['datadir']); |
| 15 | require_once 'inc/collectd.inc.php'; | ||
| 16 | $tinstance = collectd_plugindetail($host, $plugin, 'ti', array('t' => $type)); | ||
| 17 | |||
| 18 | $obj = new Type_Default; | ||
| 19 | $obj->datadir = $CONFIG['datadir']; | ||
| 20 | $obj->args = array( | ||
| 21 | 'host' => $host, | ||
| 22 | 'plugin' => $plugin, | ||
| 23 | 'pinstance' => $pinstance, | ||
| 24 | 'type' => $type, | ||
| 25 | 'tinstance' => $tinstance, | ||
| 26 | ); | ||
| 27 | $obj->data_sources = array('value'); | ||
| 28 | $obj->ds_names = array( | 16 | $obj->ds_names = array( |
| 29 | 'value' => 'Value ', | 17 | 'value' => 'Value ', |
| 30 | ); | 18 | ); |
| 31 | $obj->width = $width; | 19 | $obj->width = $width; |
| 32 | $obj->heigth = $heigth; | 20 | $obj->heigth = $heigth; |
| 33 | $obj->seconds = $seconds; | 21 | switch($obj->args['type']) { |
| 34 | switch($type) { | ||
| 35 | case 'fanspeed': | 22 | case 'fanspeed': |
| 36 | $obj->colors = '00ff00'; | 23 | $obj->colors = '00ff00'; |
| 37 | $obj->rrd_title = sprintf('Fanspeed (%s)', $pinstance); | 24 | $obj->rrd_title = sprintf('Fanspeed (%s)', $obj->args['pinstance']); |
| 38 | $obj->rrd_vertical = 'RPM'; | 25 | $obj->rrd_vertical = 'RPM'; |
| 39 | $obj->rrd_format = '%5.1lf'; | 26 | $obj->rrd_format = '%5.1lf'; |
| 40 | break; | 27 | break; |
| 41 | case 'temperature': | 28 | case 'temperature': |
| 42 | $obj->colors = '0000ff'; | 29 | $obj->colors = '0000ff'; |
| 43 | $obj->rrd_title = sprintf('Temperature (%s)', $pinstance); | 30 | $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']); |
| 44 | $obj->rrd_vertical = 'Celius'; | 31 | $obj->rrd_vertical = 'Celius'; |
| 45 | $obj->rrd_format = '%5.1lf%s'; | 32 | $obj->rrd_format = '%5.1lf%s'; |
| 46 | break; | 33 | break; |
| 47 | case 'voltage': | 34 | case 'voltage': |
| 48 | $obj->colors = 'ff0000'; | 35 | $obj->colors = 'ff0000'; |
| 49 | $obj->rrd_title = sprintf('Voltage (%s)', $pinstance); | 36 | $obj->rrd_title = sprintf('Voltage (%s)', $obj->args['pinstance']); |
| 50 | $obj->rrd_vertical = 'Volt'; | 37 | $obj->rrd_vertical = 'Volt'; |
| 51 | $obj->rrd_format = '%5.1lf'; | 38 | $obj->rrd_format = '%5.1lf'; |
| 52 | break; | 39 | break; |
| 53 | } | 40 | } |
| 54 | 41 | ||
| 55 | collectd_flush(ident_from_args($obj->args)); | 42 | collectd_flush($obj->identifiers); |
| 56 | |||
| 57 | $obj->rrd_graph(); | 43 | $obj->rrd_graph(); |
| 58 | 44 | ||
| 59 | ?> | 45 | ?> |
