~tonyyarusso/+junk/nagios-agent-ubuntu

« back to all changes in this revision

Viewing changes to subcomponents/nrpe/nrpe-2.12/nrpe.spec

  • Committer: Tony Yarusso
  • Date: 2010-07-21 19:14:45 UTC
  • Revision ID: tyarusso@ubuntu-desktop-20100721191445-y222s2cqi0ud65s0
Initial commit to bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%define name nrpe
 
2
%define version 2.12
 
3
%define release 1
 
4
%define nsusr nagios
 
5
%define nsgrp nagios
 
6
%define nsport 5666
 
7
 
 
8
# Reserve option to override port setting with:
 
9
# rpm -ba|--rebuild --define 'nsport 5666'
 
10
%{?port:%define nsport %{port}}
 
11
 
 
12
# Macro that print mesages to syslog at package (un)install time
 
13
%define nnmmsg logger -t %{name}/rpm
 
14
 
 
15
Summary: Host/service/network monitoring agent for Nagios
 
16
URL: http://www.nagios.org
 
17
Name: %{name}
 
18
Version: %{version}
 
19
Release: %{release}
 
20
License: GPL
 
21
Group: Application/System
 
22
Source0: %{name}-%{version}.tar.gz
 
23
BuildRoot: %{_tmppath}/%{name}-buildroot
 
24
Prefix: %{_prefix}
 
25
Prefix: /etc/init.d
 
26
Prefix: /etc/nagios
 
27
Requires: bash, grep, nagios-plugins
 
28
PreReq: /usr/bin/logger, chkconfig, sh-utils, shadow-utils, sed, initscripts, fileutils, mktemp
 
29
 
 
30
%description
 
31
Nrpe is a system daemon that will execute various Nagios plugins
 
32
locally on behalf of a remote (monitoring) host that uses the
 
33
check_nrpe plugin.  Various plugins that can be executed by the 
 
34
daemon are available at:
 
35
http://sourceforge.net/projects/nagiosplug
 
36
 
 
37
This package provides the core agent.
 
38
 
 
39
%package plugin
 
40
Group: Application/System
 
41
Summary: Provides nrpe plugin for Nagios.
 
42
Requires: nagios-plugins
 
43
 
 
44
%description plugin
 
45
Nrpe is a system daemon that will execute various Nagios plugins
 
46
locally on behalf of a remote (monitoring) host that uses the
 
47
check_nrpe plugin.  Various plugins that can be executed by the 
 
48
daemon are available at:
 
49
http://sourceforge.net/projects/nagiosplug
 
50
 
 
51
This package provides the nrpe plugin for Nagios-related applications.
 
52
 
 
53
%prep
 
54
%setup -q
 
55
 
 
56
 
 
57
%pre
 
58
# Create `nagios' group on the system if necessary
 
59
if grep ^nagios: /etc/group; then
 
60
        : # group already exists
 
61
else
 
62
        /usr/sbin/groupadd %{nsgrp} || %nnmmsg Unexpected error adding group "%{nsgrp}". Aborting install process.
 
63
fi
 
64
 
 
65
# Create `nagios' user on the system if necessary
 
66
if id %{nsusr} ; then
 
67
        : # user already exists
 
68
else
 
69
        /usr/sbin/useradd -r -d /var/log/nagios -s /bin/sh -c "%{nsusr}" -g %{nsgrp} %{nsusr} || \
 
70
                %nnmmsg Unexpected error adding user "%{nsusr}". Aborting install process.
 
71
fi
 
72
 
 
73
# if LSB standard /etc/init.d does not exist,
 
74
# create it as a symlink to the first match we find
 
75
if [ -d /etc/init.d -o -L /etc/init.d ]; then
 
76
  : # we're done
 
77
elif [ -d /etc/rc.d/init.d ]; then
 
78
  ln -s /etc/rc.d/init.d /etc/init.d
 
79
elif [ -d /usr/local/etc/rc.d ]; then
 
80
  ln -s  /usr/local/etc/rc.d /etc/init.d
 
81
elif [ -d /sbin/init.d ]; then
 
82
  ln -s /sbin/init.d /etc/init.d
 
83
fi
 
84
 
 
85
 
 
86
%preun
 
87
if [ "$1" = 0 ]; then
 
88
        /sbin/service nrpe stop > /dev/null 2>&1
 
89
        /sbin/chkconfig --del nrpe
 
90
fi
 
91
 
 
92
%postun
 
93
if [ "$1" -ge "1" ]; then
 
94
        /sbin/service nrpe condrestart >/dev/null 2>&1 || :
 
95
fi
 
96
 
 
97
%build
 
98
export PATH=$PATH:/usr/sbin
 
99
CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
 
100
./configure \
 
101
        --with-init-dir=/etc/init.d \
 
102
        --with-nrpe-port=%{nsport} \
 
103
        --with-nrpe-user=%{nsusr} \
 
104
        --with-nrpe-group=%{nsgrp} \
 
105
        --prefix=%{_prefix} \
 
106
        --exec-prefix=%{_prefix}/sbin \
 
107
        --bindir=%{_prefix}/sbin \
 
108
        --sbindir=%{_prefix}/lib/nagios/cgi \
 
109
        --libexecdir=%{_prefix}/lib/nagios/plugins \
 
110
        --datadir=%{_prefix}/share/nagios \
 
111
        --sysconfdir=/etc/nagios \
 
112
        --localstatedir=/var/log/nagios \
 
113
        --enable-command-args
 
114
 
 
115
make all
 
116
 
 
117
%install
 
118
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
 
119
install -d -m 0755 ${RPM_BUILD_ROOT}/etc/init.d
 
120
install -d -m 0755 ${RPM_BUILD_ROOT}/etc/nagios
 
121
install -d -m 0755 ${RPM_BUILD_ROOT}/usr/sbin
 
122
install -d -m 0755 ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
 
123
 
 
124
# install templated configuration files
 
125
cp sample-config/nrpe.cfg ${RPM_BUILD_ROOT}/etc/nagios/nrpe.cfg
 
126
cp init-script ${RPM_BUILD_ROOT}/etc/init.d/nrpe
 
127
cp src/nrpe ${RPM_BUILD_ROOT}/usr/sbin
 
128
cp src/check_nrpe ${RPM_BUILD_ROOT}/usr/lib/nagios/plugins
 
129
 
 
130
%clean
 
131
rm -rf $RPM_BUILD_ROOT
 
132
 
 
133
 
 
134
%files
 
135
%defattr(755,root,root)
 
136
/etc/init.d/nrpe
 
137
%{_prefix}/sbin/nrpe
 
138
%dir /etc/nagios
 
139
%defattr(644,root,root)
 
140
%config(noreplace) /etc/nagios/*.cfg
 
141
%defattr(755,%{nsusr},%{nsgrp})
 
142
%doc Changelog LEGAL README 
 
143
 
 
144
%files plugin
 
145
%defattr(755,root,root)
 
146
%{_prefix}/lib/nagios/plugins
 
147
%defattr(755,%{nsusr},%{nsgrp})
 
148
%doc Changelog LEGAL README
 
149
 
 
150
%changelog
 
151
* Mon Jan 23 2006 Andreas Kasenides ank<@>cs.ucy.ac.cy
 
152
- fixed nrpe.cfg relocation to sample-config
 
153
- replaced Copyright label with License
 
154
- added --enable-command-args to enable remote arg passing (if desired can be disabled by commenting out)
 
155
 
 
156
* Wed Nov 12 2003 Ingimar Robertsson <iar@skyrr.is>
 
157
- Added adding of nagios group if it does not exist.
 
158
 
 
159
* Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
 
160
- Removed the lines which removed the nagios user and group from the system
 
161
- changed the patch release version from 3 to 1
 
162
 
 
163
* Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
 
164
- Removed patch files required for nrpe 1.5
 
165
- Update spec file for version 1.6 (1.6-1)
 
166
 
 
167
* Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
 
168
- First RPM build (1.5-1)