misc fixes
This commit is contained in:
parent
1c13dd3f58
commit
7aa19ecade
23
Makefile
23
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 diskstandby
|
||||
#PLUGINS += apache mysql conntrack alixusv ts2 diskstandby
|
||||
|
||||
DESTDIR =
|
||||
BINARY_DIR = /usr/local/bin
|
||||
@ -19,23 +19,28 @@ WWW_OWNER = www-data
|
||||
|
||||
SRC := configfile.c event.c helper.c linebuffer.c logging.c network.c pidfile.c
|
||||
SRC += plugins.c probe.c sammler.c signals.c sockaddr.c
|
||||
CFLAGS := -O2 -Wall -Wno-unused-result -MMD -fno-stack-protector -I.
|
||||
CFLAGS := -O2 -Wall -MMD -I.
|
||||
LDFLAGS := -ldl -rdynamic
|
||||
|
||||
# ############################
|
||||
|
||||
ifeq ("$(WITH_RRD)", "yes")
|
||||
SRC += rrdtool.c
|
||||
CFLAGS_TARGET = -DWITH_RRD
|
||||
CFLAGS += -DWITH_RRD
|
||||
LDFLAGS_TARGET = -lrrd
|
||||
TARGET = sammler
|
||||
else
|
||||
SRC += rrdtool-fake.c
|
||||
CFLAGS_TARGET =
|
||||
LDFLAGS_TARGET =
|
||||
TARGET = sammler_norrd
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(wildcard $(DESTDIR)$(CONFIG_DIR)/sammler.conf)),)
|
||||
NEWCONF=sammler.conf
|
||||
else
|
||||
NEWCONF=sammler.conf.dist
|
||||
endif
|
||||
|
||||
# ############################
|
||||
|
||||
all: $(TARGET) plugins
|
||||
@ -46,7 +51,7 @@ $(TARGET): $(SRC:%.c=%.o)
|
||||
|
||||
%.o: %.c
|
||||
@echo " Building file: $<"
|
||||
@$(CC) $(CFLAGS) $(CFLAGS_TARGET) -o $@ -c $<
|
||||
@$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
.PHONY: plugins
|
||||
plugins: $(PLUGINS:%=plugins/%.o) $(PLUGINS:%=plugins/%.so)
|
||||
@ -73,12 +78,12 @@ plugins/diskstandby.so: plugins/diskstandby.o plugins/sgio.o
|
||||
|
||||
install: all
|
||||
install -D -m 755 -s $(TARGET) $(DESTDIR)$(BINARY_DIR)/$(TARGET)
|
||||
install -D -m 644 sammler.conf $(DESTDIR)$(CONFIG_DIR)/sammler.conf
|
||||
install -D -m 644 sammler.conf $(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
|
||||
sed -i -e "s:^logfile .*$$:logfile $(LOG_DIR)/sammler.log:" \
|
||||
-e "s:^pidfile .*$$:pidfile $(PID_DIR)/sammler.pid:" \
|
||||
-e "s:^rrd_dir .*$$:rrd_dir $(DATA_DIR):" \
|
||||
-e "s:^plugin_dir .*$$:plugin_dir $(PLUGIN_DIR):" \
|
||||
$(DESTDIR)$(CONFIG_DIR)/sammler.conf
|
||||
$(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
|
||||
install -d -m 755 $(DESTDIR)$(PLUGIN_DIR)
|
||||
install -m 755 -s plugins/*.so $(DESTDIR)$(PLUGIN_DIR)
|
||||
install -d -m 755 $(DESTDIR)$(LOG_DIR)
|
||||
@ -90,10 +95,12 @@ ifeq ("$(WITH_RRD)", "yes")
|
||||
sed -i -e "s:%%WWW_CONFIG%%:$(WWW_CONFIG):" \
|
||||
-e "s:%%DATA_DIR%%:$(DATA_DIR)/:" \
|
||||
$(DESTDIR)$(WWW_DIR)/sammler.php
|
||||
ifeq ($(strip $(wildcard $(DESTDIR)$(WWW_CONFIG))),)
|
||||
-install -D -m 644 -o $(WWW_OWNER) /dev/null $(DESTDIR)$(WWW_CONFIG)
|
||||
endif
|
||||
else
|
||||
sed -i -e "s:^forward_only .*$$:forward_only true:" \
|
||||
$(DESTDIR)$(CONFIG_DIR)/sammler.conf
|
||||
$(DESTDIR)$(CONFIG_DIR)/$(NEWCONF)
|
||||
endif
|
||||
|
||||
clean:
|
||||
|
@ -234,7 +234,7 @@ struct strtoken * strtokenize(const char *input, const char *delim, int maxfield
|
||||
{
|
||||
struct strtoken *tokens = malloc(sizeof(struct strtoken) +
|
||||
maxfields * sizeof(char *) +
|
||||
strlen(input));
|
||||
strlen(input) +1);
|
||||
if (tokens == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -120,7 +120,7 @@ static int init_cb(struct strtoken *tokens, void *privdata)
|
||||
|
||||
entry->devpath = strdup(tokens->field[0]);
|
||||
|
||||
log_print(LOG_INFO, "%s: added server '%s'", plugin.name, entry->devpath);
|
||||
log_print(LOG_INFO, "%s: added device '%s'", plugin.name, entry->devpath);
|
||||
list_add_tail(&entry->list, &device_list);
|
||||
return 0;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ plugin random.so
|
||||
#plugin hwmon.so
|
||||
#plugin alixusv.so
|
||||
#plugin ts2.so
|
||||
plugin diskstandby.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
|
||||
@ -55,4 +55,4 @@ rra RRA:MIN:0.5:4320:1440 RRA:AVERAGE:0.5:4320:1440 RRA:MAX:0.5:4320:1440
|
||||
#server localhost,127.0.0.1:51234
|
||||
|
||||
[p_diskstandby]
|
||||
device /dev/sda
|
||||
#device /dev/sda
|
||||
|
@ -542,8 +542,8 @@ function show_rrd($conf) {
|
||||
"CDEF:b=1,a,- ".
|
||||
'CDEF:err=a,UN,INF,UNKN,IF '.
|
||||
'AREA:err#FFD0D0 '.
|
||||
'AREA:a#FF0000:"Active\n "'.
|
||||
'STACK:b#00CF00:"Standby "';
|
||||
'AREA:a#FF0000:"Active\n" '.
|
||||
'STACK:b#00CF00:"Standby" ';
|
||||
break;
|
||||
|
||||
case 'hwmon':
|
||||
|
Loading…
Reference in New Issue
Block a user