Browse Source

diskstandby plugin

master
Olaf Rempel 12 years ago
parent
commit
f99924d77f
  1. 22
      Makefile
  2. 4
      sammler.conf
  3. 23
      sammler.php

22
Makefile

@ -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
PLUGINS += apache mysql conntrack alixusv ts2 diskstandby
DESTDIR =
BINARY_DIR = /usr/local/bin
@ -26,11 +26,13 @@ LDFLAGS := -ldl -rdynamic
ifeq ("$(WITH_RRD)", "yes")
SRC += rrdtool.c
CFLAGS += -DWITH_RRD
LDFLAGS += -lrrd
CFLAGS_TARGET = -DWITH_RRD
LDFLAGS_TARGET = -lrrd
TARGET = sammler
else
SRC += rrdtool-fake.c
CFLAGS_TARGET =
LDFLAGS_TARGET =
TARGET = sammler_norrd
endif
@ -40,11 +42,11 @@ all: $(TARGET) plugins
$(TARGET): $(SRC:%.c=%.o)
@echo " Linking file: $@"
@$(CC) $(LDFLAGS) $^ -o $@
@$(CC) $(LDFLAGS) $(LDFLAGS_TARGET) $^ -o $@
%.o: %.c
@echo " Building file: $<"
@$(CC) $(CFLAGS) -o $@ -c $<
@$(CC) $(CFLAGS) $(CFLAGS_TARGET) -o $@ -c $<
.PHONY: plugins
plugins: $(PLUGINS:%=plugins/%.o) $(PLUGINS:%=plugins/%.so)
@ -55,15 +57,19 @@ plugins/%.so: plugins/%.o
plugins/apache.so: plugins/apache.o
@echo " Linking file: $@"
@$(CC) $(LDFLAGS) -shared -o -lcurl -o $@ $<
@$(CC) $(LDFLAGS) -shared -lcurl -o $@ $<
plugins/conntrack.so: plugins/conntrack.o
@echo " Linking file: $@"
@$(CC) $(LDFLAGS) -shared -o -lnfnetlink -lnetfilter_conntrack -o $@ $<
@$(CC) $(LDFLAGS) -shared -lnfnetlink -lnetfilter_conntrack -o $@ $<
plugins/mysql.so: plugins/mysql.o plugins/mysql_helper.o
@echo " Linking file: $@"
@$(CC) $(LDFLAGS) -shared -o -lmysqlclient -o $@ $<
@$(CC) $(LDFLAGS) -shared -lmysqlclient -o $@ $^
plugins/diskstandby.so: plugins/diskstandby.o plugins/sgio.o
@echo " Linking file: $@"
@$(CC) $(LDFLAGS) -shared -o $@ $^
install: all
install -D -m 755 -s $(TARGET) $(DESTDIR)$(BINARY_DIR)/$(TARGET)

4
sammler.conf

@ -28,6 +28,7 @@ plugin random.so
#plugin hwmon.so
#plugin alixusv.so
#plugin ts2.so
plugin diskstandby.so
# 1h(10s), 12h(1min), 48h(2min), 14d(15min), 4w(60min), 2y(12h)
rra RRA:MIN:0.5:1:360 RRA:AVERAGE:0.5:1:360 RRA:MAX:0.5:1:360
@ -52,3 +53,6 @@ rra RRA:MIN:0.5:4320:1440 RRA:AVERAGE:0.5:4320:1440 RRA:MAX:0.5:4320:1440
[p_ts2]
#server localhost,127.0.0.1:51234
[p_diskstandby]
device /dev/sda

23
sammler.php

@ -378,7 +378,7 @@ function show_rrd($conf) {
'AREA:err#FFD0D0 '.
'AREA:c#FF0000:"Busy Workers" GPRINT:c:LAST:"Current\:%8.2lf %s" GPRINT:c:AVERAGE:"Average\:%8.2lf %s" GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" '.
'STACK:d#00CF00:"Idle Workers" GPRINT:d:LAST:"Current\:%8.2lf %s" GPRINT:d:AVERAGE:"Average\:%8.2lf %s" GPRINT:d:MAX:"Maximum\:%8.2lf %s\n" '.
'LINE2:a#0000FF:"Accesses " GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s" GPRINT:a:MAX:"Maximum\:%8.2lf %s" '.
'LINE2:a#0000FF:"Accesses " GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s" GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" '.
'';
break;
@ -535,13 +535,24 @@ function show_rrd($conf) {
'';
break;
case 'diskstandby':
$height /= 2;
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"Active\" ".
"DEF:a={$rrdfile}:active:AVERAGE ".
"CDEF:b=1,a,- ".
'CDEF:err=a,UN,INF,UNKN,IF '.
'AREA:err#FFD0D0 '.
'AREA:a#FF0000:"Active\n "'.
'STACK:b#00CF00:"Standby "';
break;
case 'hwmon':
$cmd .= "--base=1000 --height={$height} --width={$width} --alt-autoscale-max --lower-limit=0 --vertical-label=\"Temperature\" ".
"DEF:a={$rrdfile}:temp:AVERAGE ".
"CDEF:aa=a,1000,/ ".
'CDEF:err=a,UN,INF,UNKN,IF '.
'AREA:err#FFD0D0 '.
'AREA:aa#00CF00:"Temperature" GPRINT:aa:LAST:"Current\:%8.2lf %s" GPRINT:aa:AVERAGE:"Average\:%8.2lf %s" GPRINT:aa:MAX:"Maximum\:%8.2lf %s" '.
'AREA:aa#00CF00:"Temperature" GPRINT:aa:LAST:"Current\:%8.2lf %s" GPRINT:aa:AVERAGE:"Average\:%8.2lf %s" GPRINT:aa:MAX:"Maximum\:%8.2lf %s\n" '.
'LINE1:aa#404040 ';
break;
@ -578,7 +589,7 @@ function show_rrd($conf) {
'AREA:x#FF0000:"Used Memory " GPRINT:x:LAST:"Current\:%8.2lf %s" GPRINT:x:AVERAGE:"Average\:%8.2lf %s" GPRINT:x:MAX:"Maximum\:%8.2lf %s\n" '.
'STACK:c#FF7D00:"Buffer Memory " GPRINT:c:LAST:"Current\:%8.2lf %s" GPRINT:c:AVERAGE:"Average\:%8.2lf %s" GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" '.
'STACK:d#FFC73B:"Cache Memory " GPRINT:d:LAST:"Current\:%8.2lf %s" GPRINT:d:AVERAGE:"Average\:%8.2lf %s" GPRINT:d:MAX:"Maximum\:%8.2lf %s\n" '.
'STACK:b#00CF00:"Free Memory " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s" '.
'STACK:b#00CF00:"Free Memory " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" '.
'LINE1:x#404040 LINE1:xc#404040 LINE1:xcd#404040';
break;
@ -593,7 +604,7 @@ function show_rrd($conf) {
'AREA:err#FFD0D0 '.
'LINE1:a#000000:"Total " GPRINT:a:LAST:"Current\:%8.2lf %s\n" '.
'AREA:b#FF0000:"Used " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" '.
'STACK:c#00CF00:"Free " GPRINT:c:LAST:"Current\:%8.2lf %s" GPRINT:c:AVERAGE:"Average\:%8.2lf %s" GPRINT:c:MAX:"Maximum\:%8.2lf %s" '.
'STACK:c#00CF00:"Free " GPRINT:c:LAST:"Current\:%8.2lf %s" GPRINT:c:AVERAGE:"Average\:%8.2lf %s" GPRINT:c:MAX:"Maximum\:%8.2lf %s\n" '.
'LINE1:b#404040 ';
break;
@ -725,7 +736,7 @@ function show_rrd($conf) {
"DEF:a={$rrdfile}:entropy:AVERAGE ".
'CDEF:err=a,UN,INF,UNKN,IF '.
'AREA:err#FFD0D0 '.
'AREA:a#00CF00:"Available Entropy" GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s" GPRINT:a:MAX:"Maximum\:%8.2lf %s" '.
'AREA:a#00CF00:"Available Entropy" 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;
@ -833,7 +844,7 @@ function show_rrd($conf) {
'STACK:b#00CF00:"pgalloc_normal " GPRINT:b:LAST:"Current\:%8.2lf %s" GPRINT:b:AVERAGE:"Average\:%8.2lf %s" GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" '.
'STACK:a#00CFCF:"pgalloc_high " GPRINT:a:LAST:"Current\:%8.2lf %s" GPRINT:a:AVERAGE:"Average\:%8.2lf %s" GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" '.
'LINE1:d#FF7D00:"pgfree " GPRINT:d:LAST:"Current\:%8.2lf %s" GPRINT:d:AVERAGE:"Average\:%8.2lf %s" GPRINT:d:MAX:"Maximum\:%8.2lf %s\n" '.
'AREA:ee#0040FF:"pgfault " GPRINT:e:LAST:"Current\:%8.2lf %s" GPRINT:e:AVERAGE:"Average\:%8.2lf %s" GPRINT:e:MAX:"Maximum\:%8.2lf %s" '.
'AREA:ee#0040FF:"pgfault " GPRINT:e:LAST:"Current\:%8.2lf %s" GPRINT:e:AVERAGE:"Average\:%8.2lf %s" GPRINT:e:MAX:"Maximum\:%8.2lf %s\n" '.
'LINE1:ee#002A97 ';
break;
}

Loading…
Cancel
Save