Advertisement
Guest User

cgp exec plugin

a guest
Jun 12th, 2011
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2.  
  3. # Collectd Exec plugin
  4.  
  5. require_once 'conf/common.inc.php';
  6. require_once 'type/Default.class.php';
  7. require_once 'inc/collectd.inc.php';
  8.  
  9. ## LAYOUT
  10. # exec-*/temperature-<gpu>.rrd
  11. # exec-*/fanspeed-<gpu>.rrd ... and so on
  12.  
  13. $obj = new Type_Default($CONFIG);
  14. $obj->ds_names = array(
  15.         'value' => 'Value'
  16. );
  17.  
  18. $obj->width = $width;
  19. $obj->heigth = $heigth;
  20.  
  21.  
  22. switch($obj->args['type']) {
  23. case 'fanspeed':
  24.         $obj->rrd_title = sprintf('Fanspeed (%s)', $obj->args['pinstance']);
  25.         $obj->rrd_vertical = 'Percent';
  26.         $obj->rrd_format = '%5.1lf';
  27.         break;
  28. case 'temperature':
  29.         $obj->rrd_title = sprintf('Temperature (%s)', $obj->args['pinstance']);
  30.         $obj->rrd_vertical = 'Celsius';
  31.         $obj->rrd_format = '%5.1lf%s';
  32.         break;
  33. case 'gauge':
  34.         $obj->rrd_title = sprintf('GPU Load (%s)', $obj->args['pinstance']);
  35.         $obj->rrd_vertical = 'Percent';
  36.         $obj->rrd_format = '%5.1lf';
  37.         break;
  38. case 'threads':
  39.         $obj->rrd_title = sprintf('MHash/s (%s)', $obj->args['pinstance']);
  40.         $obj->rrd_vertical = 'Mhash/s';
  41.         $obj->rrd_format = '%5.1lf';
  42.         break;
  43. }
  44.  
  45. collectd_flush($obj->identifiers);
  46. $obj->rrd_graph();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement