This repository has been archived by the owner on Jan 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
munin.mk
70 lines (59 loc) · 1.9 KB
/
munin.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# munin.mk
# David Rowe March 2008
# Thanks Michael O'Conner for suggesting Munin and providing
# the prototype munin-node script
#
# usage: make -f munin.mk munin-package
#
# BAPS package to install a munin node on a Blackfin system.
#
# see doc/munin.txt
include rules.mk
TARGET_DIR=$(BUILD_DIR)/tmp/munin/ipkg/munin
PKG_NAME:=munin
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/tmp/munin
munin:
mkdir -p $(TARGET_DIR)/etc/munin/plugins
mkdir -p $(TARGET_DIR)/etc/munin/plugins-shared
cp src/munin/munin-node.sh $(TARGET_DIR)/etc/munin/
chmod u+x $(TARGET_DIR)/etc/munin/munin-node.sh
cp src/munin/plugins/* $(TARGET_DIR)/etc/munin/plugins
chmod u+x $(TARGET_DIR)/etc/munin/plugins/*
cp src/munin/plugins-shared/* $(TARGET_DIR)/etc/munin/plugins-shared
chmod u+x $(TARGET_DIR)/etc/munin/plugins-shared/*
find $(TARGET_DIR)/etc/munin/ -name '*~' | xargs rm -f
ln -sf /etc/munin/plugins-shared/if_ $(TARGET_DIR)/etc/munin/plugins/if_eth0
touch $(PKG_BUILD_DIR)/.built
all: munin
dirclean:
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Munin node
DESCRIPTION:=\
Munin node and plugins for remote data logging from Blackfin \
systems. Monitor a network of IP04s and graph \
the results with a small amount of configuration. Easy to set up \
and customise.
endef
# post installation
define Package/$(PKG_NAME)/postinst
#!/bin/sh
echo "munin 4949/tcp" >> /etc/services
echo "munin stream tcp nowait root /etc/munin/munin-node.sh" >> /etc/inetd.conf
kill -HUP `pidof inetd`
endef
# pre-remove
define Package/$(PKG_NAME)/prerm
#!/bin/sh
cd /etc
cat services | sed '/munin/ d' > services.tmp
mv services.tmp services
cat inetd.conf | sed '/munin/ d' > inetd.tmp
mv inetd.tmp inetd.conf
kill -HUP `pidof inetd`
endef
$(eval $(call BuildPackage,$(PKG_NAME)))
munin-package: munin $(PACKAGE_DIR)/$(PKG_NAME)_$(VERSION)_$(PKGARCH).ipk