[net] [admin]: Moved Nagios programs from Network|Monitoring to Administration becaus...
[packages.git] / admin / 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:=admin
23   CATEGORY:=Administration
24   DEPENDS:=+libopenssl
25   TITLE:=Daemon to execute Nagios check commands on remote hosts
26   URL:=http://www.nagios.org/download
27 endef
28
29 define Package/nrpe/description
30         The NRPE addon is designed to allow you to execute Nagios plugins on
31         remote Linux/Unix machines.  The main reason for doing this is to allow
32         Nagios to monitor "local" resources (like CPU load, memory usage, etc.)
33         on remote machines.  Since these public resources are not usually
34         exposed to external machines, an agent like NRPE must be installed on
35         the remote Linux/Unix machines.
36 endef
37
38 define Package/nrpe/postinst
39 #!/bin/sh
40
41 id=50
42 name=nagios
43 home=/var/run/nagios
44 shell=/bin/false
45
46 # do not change below
47 # check if we are on real system
48 if [ -z "$${IPKG_INSTROOT}" ]; then
49         # create copies of passwd and group, if we use squashfs
50         rootfs=`mount |awk '/root/ { print $$5 }'`
51         if [ "$$rootfs" = "squashfs" ]; then
52                 if [ -h /etc/group ]; then
53                         rm /etc/group
54                         cp -p /rom/etc/group /etc/group
55                 fi
56                 if [ -h /etc/passwd ]; then
57                         rm /etc/passwd
58                         cp -p /rom/etc/passwd /etc/passwd
59                 fi
60         fi
61 fi
62
63 echo ""
64 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
65         echo "adding group $$name to /etc/group"
66         echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
67 fi
68 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
69         echo "adding user $$name to /etc/passwd"
70         echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd
71 fi
72 endef
73
74 CONFIGURE_ARGS += \
75         --with-ssl="$(STAGING_DIR)/usr" \
76         --with-ssl-lib="$(STAGING_DIR)/usr/lib"
77
78 define Package/nrpe/install
79         $(INSTALL_DIR) $(1)/usr/sbin
80         $(INSTALL_DIR) $(1)/etc
81         $(INSTALL_DIR) $(1)/etc/init.d
82         $(INSTALL_DATA) ./files/nrpe.cfg $(1)/etc/nrpe.cfg
83         $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/nrpe $(1)/usr/sbin
84         $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME)
85 endef
86
87 $(eval $(call RequireCommand,openssl, \
88         $(PKG_NAME) requires openssl installed on the host-system. \
89 ))
90
91 $(eval $(call BuildPackage,nrpe))
92