Browse Source

cleanup hddtemp

master
Olaf Rempel 7 years ago
parent
commit
f7cc362d4d
5 changed files with 18 additions and 9 deletions
  1. +1
    -1
      Makefile
  2. +6
    -6
      plugins/hddtemp.c
  3. +1
    -1
      rrdtool.c
  4. +1
    -1
      sammler.conf
  5. +9
    -0
      sammler.php

+ 1
- 1
Makefile View File

@@ -2,7 +2,7 @@
WITH_RRD?=yes

PLUGINS := ctstat diskstat hwmon load memory mount netdev random rtstat stat uptime vmstat
#PLUGINS += apache mysql conntrack alixusv ts2 diskstandby hddptemp
#PLUGINS += apache mysql conntrack alixusv ts2 diskstandby hddtemp

DESTDIR =
BINARY_DIR = /usr/local/bin


+ 6
- 6
plugins/hddtemp.c View File

@@ -101,7 +101,7 @@ static int probe(void)

/* '|/dev/sda|OCZ-VERTEX3|128|C||/dev/sdb|HDT722525DLA380|SLP|*||/dev/sdc|Generic STORAGE DEVICE|NA|*|' */

char *tok, *tmp, *resp = resp_buf;
char *tok, *tmp = NULL, *resp = resp_buf;
int i = 0;
char *device = NULL;
int temperature = 0;
@@ -114,10 +114,10 @@ static int probe(void)
device++;

} else if ((i % 4) == 2) {
char *tmp;
char *tmp2;

temperature = strtol(tok, &tmp, 10);
if (*tmp != '\0')
temperature = strtol(tok, &tmp2, 10);
if (*tmp2 != '\0')
device = NULL;

} else if ((i % 4) == 3) {
@@ -185,9 +185,9 @@ static int init(void)
return -1;
}

int retval = config_get_strtokens("p_hddtemp", "server", ",", 2, init_cb, NULL);
config_get_strtokens("p_hddtemp", "server", ",", 2, init_cb, NULL);

return (retval <= 0) ? -1 : 0;
return 0;
}

static int fini(void)


+ 1
- 1
rrdtool.c View File

@@ -17,6 +17,7 @@
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#if (WITH_RRD)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -33,7 +34,6 @@
#include "logging.h"
#include "plugins.h"

#if (WITH_RRD)
#define DEFAULT_STEP 10

#define ARGCMAX 64


+ 1
- 1
sammler.conf View File

@@ -59,4 +59,4 @@ rra RRA:MIN:0.5:4320:1440 RRA:AVERAGE:0.5:4320:1440 RRA:MAX:0.5:4320:1440
#device /dev/sda

[p_hddtemp]
server test,127.0.0.1:7634
#server test,127.0.0.1:7634

+ 9
- 0
sammler.php View File

@@ -546,6 +546,15 @@ function show_rrd($conf) {
'STACK:b#00CF00:"Standby" ';
break;

case 'hddtemp':
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"Temperature\" ".
"DEF:a={$rrdfile}:temperature:AVERAGE ".
'CDEF:err=a,UN,INF,UNKN,IF '.
'AREA:err#FFD0D0 '.
'AREA:a#00CF00:"Temperature" GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s" GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" '.
'LINE1:a#404040 ';
break;

case 'hwmon':
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"Temperature\" ".
"DEF:a={$rrdfile}:temp:AVERAGE ".


Loading…
Cancel
Save