[net] Monitoring: Finally collected a Nagios programs under Monitoring submenu.
[openwrt/svn-archive/archive.git] / net / nrpe / Makefile
1 #
2 # Copyright (C) 2007-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 #
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=nrpe
12 PKG_VERSION:=2.12
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@SF/nagios
17 PKG_MD5SUM:=b2d75e2962f1e3151ef58794d60c9e97
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/nrpe
22 SECTION:=net
23 CATEGORY:=Network
24 SUBMENU:=Monitoring
25 DEPENDS:=+libopenssl
26 TITLE:=Daemon to execute Nagios check commands on remote hosts
27 URL:=http://www.nagios.org/download
28 endef
29
30 define Package/nrpe/description
31 The NRPE addon is designed to allow you to execute Nagios plugins on
32 remote Linux/Unix machines. The main reason for doing this is to allow
33 Nagios to monitor "local" resources (like CPU load, memory usage, etc.)
34 on remote machines. Since these public resources are not usually
35 exposed to external machines, an agent like NRPE must be installed on
36 the remote Linux/Unix machines.
37 endef
38
39 define Package/nrpe/postinst
40 #!/bin/sh
41
42 id=50
43 name=nagios
44 home=/var/run/nagios
45 shell=/bin/false
46
47 # do not change below
48 # check if we are on real system
49 if [ -z "$${IPKG_INSTROOT}" ]; then
50 # create copies of passwd and group, if we use squashfs
51 rootfs=`mount |awk '/root/ { print $$5 }'`
52 if [ "$$rootfs" = "squashfs" ]; then
53 if [ -h /etc/group ]; then
54 rm /etc/group
55 cp -p /rom/etc/group /etc/group
56 fi
57 if [ -h /etc/passwd ]; then
58 rm /etc/passwd
59 cp -p /rom/etc/passwd /etc/passwd
60 fi
61 fi
62 fi
63
64 echo ""
65 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
66 echo "adding group $$name to /etc/group"
67 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
68 fi
69 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
70 echo "adding user $$name to /etc/passwd"
71 echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd
72 fi
73 endef
74
75 CONFIGURE_ARGS += \
76 --with-ssl="$(STAGING_DIR)/usr" \
77 --with-ssl-lib="$(STAGING_DIR)/usr/lib"
78
79 define Package/nrpe/install
80 $(INSTALL_DIR) $(1)/usr/sbin
81 $(INSTALL_DIR) $(1)/etc
82 $(INSTALL_DIR) $(1)/etc/init.d
83 $(INSTALL_DATA) ./files/nrpe.cfg $(1)/etc/nrpe.cfg
84 $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/nrpe $(1)/usr/sbin
85 $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
86 endef
87
88 $(eval $(call RequireCommand,openssl, \
89 $(PKG_NAME) requires openssl installed on the host-system. \
90 ))
91
92 $(eval $(call BuildPackage,nrpe))
93