source: trunk/dports/net/nagios/Portfile @ 109427

Last change on this file since 109427 was 109427, checked in by ryandesign@…, 6 years ago

revbump ports linking with libgd that were built while gd2 @2.1.0 was missing the pkgconfig dependency and was therefore missing some features which caused these ports to build differently (#39550)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.1 KB
Line 
1# $Id: Portfile 109427 2013-08-15 13:11:47Z ryandesign@macports.org $
2
3PortSystem      1.0
4
5name                    nagios
6version                 3.5.0
7revision                2
8categories              net
9license                 GPL-2
10maintainers             markd openmaintainer
11platforms               darwin
12
13description             Nagios is a host and service monitoring program
14
15long_description        A network service and host monitor that can notify you \
16                        when servers go down by monitoring for external services \
17                        such as HTTP, FTP, SMTP, SNMP, as well as internal host \
18                        checks for things such as CPU and disk usage and many \
19                        other things.
20
21homepage                http://nagios.org
22
23livecheck.regex         nagios-(\[0-9.\]+)${extract.suffix}
24
25master_sites            sourceforge:project/nagios/nagios-3.x/nagios-${version}
26checksums               rmd160 d75a764486fd3dc0462fb49924698754852d39be \
27                        sha256 469381b2954392689c85d3db733e8da4bd43b806b3d661d1a7fbd52dacc084db
28
29worksrcdir              ${name}
30
31depends_build           port:gd2
32depends_lib             port:openssl \
33                        port:nagios-plugins
34
35set sysconfdir          ${prefix}/etc/${name}
36destroot.destdir        prefix=${prefix} DESTDIR=${destroot}
37
38destroot.target         install install-config install-commandmode install-init
39
40configure.args          --with-cgiurl=/nagios/cgi-bin \
41                        --with-htmurl=/nagios \
42                        --with-nagios-user=nagios \
43                        --with-nagios-grp=nagios \
44                        --with-command-grp=nagios \
45                        --with-gd-lib=${prefix}/lib \
46                        --with-gd-inc=${prefix}/include \
47                        --sbindir=${prefix}/sbin/nagios \
48                        --libexecdir=${prefix}/libexec/nagios \
49                        --datadir=${prefix}/share/nagios \
50                        --with-lockfile=${prefix}/var/nagios/nagios.lock \
51                        --with-init-dir=${prefix}/var/nagios \
52                        --sysconfdir=${sysconfdir} \
53                        --localstatedir=${prefix}/var/nagios \
54                        --with-httpd-conf=/etc/apache2/httpd.conf
55
56platform darwin 8 {
57        configure.args-delete --with-httpd-conf=/etc/apache2/httpd.conf
58        configure.args-append --with-httpd-conf=/etc/httpd/httpd.conf
59}
60
61startupitem.create      yes
62startupitem.start       "${prefix}/var/nagios/nagios.init start"
63startupitem.stop        "${prefix}/var/nagios/nagios.init stop"
64
65post-patch {
66        reinplace "s|INIT_OPTS=-o root -g root|INIT_OPTS=-o nagios -g nagios|g" \
67                "${worksrcpath}/Makefile.in"
68
69        reinplace "s|daemon-init \$(DESTDIR)\$(INIT_DIR)/nagios|daemon-init \$(DESTDIR)\$(INIT_DIR)/nagios.init|g" \
70                "${worksrcpath}/Makefile.in"
71
72        reinplace "s|NagiosLockDir=/var/lock/subsys|NagiosLockDir=${prefix}/var/nagios|g" \
73                ${worksrcpath}/daemon-init.in
74        reinplace "s|su -|su -m|g" \
75                ${worksrcpath}/daemon-init.in
76}
77
78add_users nagios group=nagios
79
80post-destroot {
81# Keep the empty command file directory created by 'make install-commandmode'
82        destroot.keepdirs ${destroot}${prefix}/var/nagios/rw
83
84# Nagios sample files no longer install with -sample suffixes, so do this manually for safety
85        foreach cfgfile [glob ${destroot}${sysconfdir}/*.cfg] {
86                file rename ${cfgfile} ${cfgfile}-sample
87        }
88        foreach cfgfile [glob ${destroot}${sysconfdir}/objects/*.cfg] {
89                file rename ${cfgfile} ${cfgfile}-sample
90        }
91}
92
93
94notes "
95************************************************************
96The basic steps to complete the installation are below.  But Nagios is\
97a complex program so you should read the documentation online at\
98http://www.nagios.org or locally at ${prefix}/share/nagios/docs/index.html\
99to fully understand Nagios.
100************************************************************
101
102IMPORTANT: A user and group called 'nagios' has been created and you must run\
103           nagios as that user.
104
105
106
1071) Setup Apache's httpd.conf file for Nagios (restart Apache when done)
108
109   Insert the \"Nagios stuff\" text block somewhere *above* your Apache cgi-bin\
110   ScriptAlias statement:
111
112        ScriptAlias /cgi-bin/ \"/Library/WebServer/CGI-Executables/\"
113
114#
115# Nagios stuff
116
117ScriptAlias /nagios/cgi-bin/ \"${prefix}/sbin/nagios/\"
118<Directory \"${prefix}/sbin/nagios\">
119 AllowOverride None
120    Options ExecCGI
121    Order allow,deny
122    Allow from all
123    AuthName \"Nagios Access\"
124    AuthType Basic
125    AuthUserFile ${prefix}/etc/nagios/htpasswd.users
126    require valid-user
127</Directory>
128
129Alias /nagios \"${prefix}/share/nagios\"
130<Directory \"${prefix}/share/nagios\">
131    Options None
132    AllowOverride AuthConfig
133    Order allow,deny
134    Allow from all
135</Directory>
136
137# End Nagios stuff
138#
139
140
1412) Configure the Nagios sample files in ${prefix}/etc/nagios.
142
143a) First, backup the Nagios sample files.
144
145   cd ${prefix}/etc/nagios
146   sudo mkdir sample
147   sudo cp *.cfg-sample sample/
148
149b) Then rename the sample files for use.
150
151   sudo -s
152   for i in *cfg-sample; do mv \$i `echo \$i | sed -e s/cfg-sample/cfg/`; done;
153   exit
154
155c) Configure the default commands.cfg file to your requirements.  Then test\
156   the Nagios configuration with this command until you get no errors:
157
158   sudo nagios -v ${prefix}/etc/nagios/nagios.cfg
159
160
1613) Set user 'nagiosadmin' as a \"superuser\" to browse all hosts/services in
162   ${prefix}/etc/nagios/cgi.cfg
163
164   authorized_for_system_information= nagiosadmin
165   authorized_for_configuration_information= nagiosadmin
166   authorized_for_system_commands= nagiosadmin
167   authorized_for_all_services= nagiosadmin
168   authorized_for_all_hosts= nagiosadmin
169   authorized_for_all_service_commands= nagiosadmin
170   authorized_for_all_host_commands= nagiosadmin
171
172
1734) Create a 'nagiosadmin' Apache user/password to correspond with the Nagios Apache\
174   user created above
175
176        htpasswd -c ${prefix}/etc/nagios/htpasswd.users nagiosadmin
177
178   Create other users as desired, omit '-c' since it creates the password file.  Make\
179   additional users login names match Nagios contact names to restrict web viewing to your\
180   host's by contact.
181
182
1835) Set Nagios to start at system boot, and start Nagios
184
185   Run launchctl so Nagios will start at system boot
186        sudo launchctl load -w /Library/LaunchDaemons/org.macports.nagios.plist
187
188   You may now start Nagios manually with this command (or a reboot):
189        sudo ${prefix}/var/nagios/nagios.init start
190
191
1926) You may now login as 'nagiosadmin' to the Nagios web interface at http://localhost/nagios
193
194
195NOTE: The SMTP server Postfix is required to enable Nagios email notifications
196
197
198File Locations:
199
200        Configuration files: ${prefix}/etc/nagios
201        Nagios plugins: ${prefix}/libexec/nagios
202        Lock file:  ${prefix}/var/nagios/nagios.lock
203        Init file:  ${prefix}/var/nagios/nagios.init
204        HTML URL:  http://localhost/nagios/
205        CGI URL:  http://localhost/nagios/cgi-bin/
206"
Note: See TracBrowser for help on using the repository browser.