cleanup hddtemp
This commit is contained in:
parent
1b593fede8
commit
f7cc362d4d
2
Makefile
2
Makefile
@ -2,7 +2,7 @@
|
|||||||
WITH_RRD?=yes
|
WITH_RRD?=yes
|
||||||
|
|
||||||
PLUGINS := ctstat diskstat hwmon load memory mount netdev random rtstat stat uptime vmstat
|
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 =
|
DESTDIR =
|
||||||
BINARY_DIR = /usr/local/bin
|
BINARY_DIR = /usr/local/bin
|
||||||
|
@ -101,7 +101,7 @@ static int probe(void)
|
|||||||
|
|
||||||
/* '|/dev/sda|OCZ-VERTEX3|128|C||/dev/sdb|HDT722525DLA380|SLP|*||/dev/sdc|Generic STORAGE DEVICE|NA|*|' */
|
/* '|/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;
|
int i = 0;
|
||||||
char *device = NULL;
|
char *device = NULL;
|
||||||
int temperature = 0;
|
int temperature = 0;
|
||||||
@ -114,10 +114,10 @@ static int probe(void)
|
|||||||
device++;
|
device++;
|
||||||
|
|
||||||
} else if ((i % 4) == 2) {
|
} else if ((i % 4) == 2) {
|
||||||
char *tmp;
|
char *tmp2;
|
||||||
|
|
||||||
temperature = strtol(tok, &tmp, 10);
|
temperature = strtol(tok, &tmp2, 10);
|
||||||
if (*tmp != '\0')
|
if (*tmp2 != '\0')
|
||||||
device = NULL;
|
device = NULL;
|
||||||
|
|
||||||
} else if ((i % 4) == 3) {
|
} else if ((i % 4) == 3) {
|
||||||
@ -185,9 +185,9 @@ static int init(void)
|
|||||||
return -1;
|
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)
|
static int fini(void)
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* Free Software Foundation, Inc., *
|
* Free Software Foundation, Inc., *
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
#if (WITH_RRD)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -33,7 +34,6 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "plugins.h"
|
#include "plugins.h"
|
||||||
|
|
||||||
#if (WITH_RRD)
|
|
||||||
#define DEFAULT_STEP 10
|
#define DEFAULT_STEP 10
|
||||||
|
|
||||||
#define ARGCMAX 64
|
#define ARGCMAX 64
|
||||||
|
@ -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
|
#device /dev/sda
|
||||||
|
|
||||||
[p_hddtemp]
|
[p_hddtemp]
|
||||||
server test,127.0.0.1:7634
|
#server test,127.0.0.1:7634
|
||||||
|
@ -546,6 +546,15 @@ function show_rrd($conf) {
|
|||||||
'STACK:b#00CF00:"Standby" ';
|
'STACK:b#00CF00:"Standby" ';
|
||||||
break;
|
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':
|
case 'hwmon':
|
||||||
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"Temperature\" ".
|
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"Temperature\" ".
|
||||||
"DEF:a={$rrdfile}:temp:AVERAGE ".
|
"DEF:a={$rrdfile}:temp:AVERAGE ".
|
||||||
|
Loading…
Reference in New Issue
Block a user