Ticket #43008: patch-nagios-Portfile3.diff
File patch-nagios-Portfile3.diff, 12.6 KB (added by jul_bsd@…, 10 years ago) |
---|
-
net/nagios/Portfile
old new 1 # $Id: Portfile 125738 2014-09-25 14:43:03Z mf2k@macports.org $ 1 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 2 # $Id: Portfile 109427 2013-08-15 13:11:47Z ryandesign@macports.org $ 2 3 3 PortSystem 4 PortSystem 1.0 4 5 5 name nagios 6 version 3.5.0 7 revision 2 8 categories net 9 license GPL-2 10 maintainers nomaintainer 11 platforms darwin 12 13 description Nagios is a host and service monitoring program 14 15 long_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 21 homepage http://nagios.org 22 23 livecheck.regex nagios-(\[0-9.\]+)${extract.suffix} 24 25 master_sites sourceforge:project/nagios/nagios-3.x/nagios-${version} 26 checksums rmd160 d75a764486fd3dc0462fb49924698754852d39be \ 27 sha256 469381b2954392689c85d3db733e8da4bd43b806b3d661d1a7fbd52dacc084db 28 29 worksrcdir ${name} 30 31 depends_build port:gd2 32 depends_lib port:openssl \ 33 port:nagios-plugins 34 35 set sysconfdir ${prefix}/etc/${name} 36 destroot.destdir prefix=${prefix} DESTDIR=${destroot} 37 38 destroot.target install install-config install-commandmode install-init 39 40 configure.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 6 name nagios 7 version 4.0.8 8 categories net 9 license GPL-2 10 maintainers markd openmaintainer 11 platforms darwin 12 13 description Nagios is a host and service monitoring program 14 15 long_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 21 homepage http://nagios.org 22 master_sites sourceforge:project/nagios/nagios-4.x/nagios-${version} 23 checksums rmd160 b53631755e0a23aba918a99f58b7bea237fdd799 \ 24 sha256 8b268d250c97851775abe162f46f64724f95f367d752ae4630280cc5d368ca4b 25 26 livecheck.regex nagios-(\[0-9.\]+)${extract.suffix} 27 28 depends_build port:gd2 29 depends_lib port:openssl port:nagios-plugins 30 31 ## Only for 4.0.8: https://github.com/NagiosEnterprises/nagioscore/commit/859d45bc59c2a1a22cc40bb2562b36ca3b89a8c6 32 patchfiles patch-lib-runcmd.c.diff 33 34 set sysconfdir ${prefix}/etc/${name} 35 destroot.destdir prefix=${prefix} DESTDIR=${destroot} 36 37 destroot.target install install-config install-commandmode install-init 38 destroot.asroot yes 39 install.asroot yes 40 41 ## iobroker: http://tracker.nagios.org/view.php?id=484 42 # --with-iobroker=select => not compiling (default: poll) 43 configure.args --with-cgiurl=/nagios/cgi-bin \ 44 --with-htmurl=/nagios \ 45 --with-nagios-user=nagios \ 46 --with-nagios-grp=nagios \ 47 --with-command-grp=nagios \ 48 --with-gd-lib=${prefix}/lib \ 49 --with-gd-inc=${prefix}/include \ 50 --sbindir=${prefix}/sbin/nagios \ 51 --libexecdir=${prefix}/libexec/nagios \ 52 --datadir=${prefix}/share/nagios \ 53 --with-lockfile=${prefix}/var/nagios/nagios.lock \ 54 --with-init-dir=${prefix}/var/nagios \ 55 --sysconfdir=${sysconfdir} \ 56 --localstatedir=${prefix}/var/nagios \ 57 --with-httpd-conf=/etc/apache2/httpd.conf 55 58 56 59 platform darwin 8 { 57 58 60 configure.args-delete --with-httpd-conf=/etc/apache2/httpd.conf 61 configure.args-append --with-httpd-conf=/etc/httpd/httpd.conf 59 62 } 60 63 61 startupitem.create yes 62 startupitem.start "${prefix}/var/nagios/nagios.init start" 63 startupitem.stop "${prefix}/var/nagios/nagios.init stop" 64 startupitem.create yes 65 ## Note: why using a linux chkconfig file??? 66 #startupitem.start "${prefix}/var/nagios/nagios.init start" 67 #startupitem.stop "${prefix}/var/nagios/nagios.init stop" 68 startupitem.executable ${prefix}/bin/nagios ${prefix}/etc/nagios/nagios.cfg 69 startupitem.pidfile ${prefix}/var/nagios/nagios.lock 64 70 65 71 post-patch { 66 72 reinplace "s|INIT_OPTS=-o root -g root|INIT_OPTS=-o nagios -g nagios|g" \ 67 73 "${worksrcpath}/Makefile.in" 68 74 69 70 75 reinplace "s|daemon-init \$(DESTDIR)\$(INIT_DIR)/nagios|daemon-init \$(DESTDIR)\$(INIT_DIR)/nagios.init|g" \ 76 "${worksrcpath}/Makefile.in" 71 77 72 73 74 75 78 reinplace "s|NagiosLockDir=/var/lock/subsys|NagiosLockDir=${prefix}/var/nagios|g" \ 79 ${worksrcpath}/daemon-init.in 80 reinplace "s|su -|su -m|g" \ 81 ${worksrcpath}/daemon-init.in 76 82 } 77 83 78 84 add_users nagios group=nagios 79 85 80 86 post-destroot { 81 87 # Keep the empty command file directory created by 'make install-commandmode' 82 destroot.keepdirs ${destroot}${prefix}/var/nagios/rw 88 destroot.keepdirs ${destroot}${prefix}/var/nagios/rw \ 89 ${destroot}${prefix}/var/${name}/spool/checkresults 83 90 84 91 # 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 } 92 foreach cfgfile [glob ${destroot}${sysconfdir}/*.cfg] { 93 file rename ${cfgfile} ${cfgfile}-sample 94 } 95 foreach cfgfile [glob ${destroot}${sysconfdir}/objects/*.cfg] { 96 file rename ${cfgfile} ${cfgfile}-sample 97 } 98 99 xinstall -d ${destroot}${prefix}/share/examples/${name}/ 100 copy ${filespath}/apache-nagios.conf ${destroot}${prefix}/share/examples/${name}/ 101 copy ${filespath}/nginx-nagios.conf ${destroot}${prefix}/share/examples/${name}/ 102 reinplace "s|%%PREFIX%%|${prefix}|g" \ 103 ${destroot}${prefix}/share/examples/${name}/apache-nagios.conf \ 104 ${destroot}${prefix}/share/examples/${name}/nginx-nagios.conf 105 xinstall -d ${destroot}${prefix}/var/${name}/spool/checkresults 91 106 } 92 107 93 108 … … 100 115 ************************************************************ 101 116 102 117 IMPORTANT: A user and group called 'nagios' has been created and you must run\ 103 118 nagios as that user. 104 119 105 120 106 107 1) Setup Apache's httpd.conf file for Nagios (restart Apache when done) 121 1) Setup your webserver 122 a) Apache's httpd.conf file for Nagios (restart Apache when done) 123 Example configuration in ${prefix}/share/examples/${name}/apache-nagios.conf 108 124 109 125 Insert the \"Nagios stuff\" text block somewhere *above* your Apache cgi-bin\ 110 126 ScriptAlias statement: 111 127 112 ScriptAlias /cgi-bin/ \"/Library/WebServer/CGI-Executables/\" 113 114 # 115 # Nagios stuff 116 117 ScriptAlias /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 129 Alias /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> 128 ScriptAlias /cgi-bin/ \"/Library/WebServer/CGI-Executables/\" 136 129 137 # End Nagios stuff 138 # 130 (is it only relevant to Apple Apache or also macports?) 139 131 132 b) Nginx w php*-fpm and fcgiwrap 133 Example configuration in ${prefix}/share/examples/${name}/nginx-nagios.conf 134 Configured for localhost:8081 135 http://localhost:8081/ 140 136 141 137 2) Configure the Nagios sample files in ${prefix}/etc/nagios. 142 138 … … 152 148 for i in *cfg-sample; do mv \$i `echo \$i | sed -e s/cfg-sample/cfg/`; done; 153 149 exit 154 150 155 c) Configure the default commands.cfg file to your requirements. Then test\ 151 c) Configure at least the default commands.cfg and contacts.cfg files to your \ 152 requirements. Then test\ 156 153 the Nagios configuration with this command until you get no errors: 157 154 158 155 sudo nagios -v ${prefix}/etc/nagios/nagios.cfg … … 160 157 161 158 3) Set user 'nagiosadmin' as a \"superuser\" to browse all hosts/services in 162 159 ${prefix}/etc/nagios/cgi.cfg 160 (default configuration) 163 161 164 162 authorized_for_system_information= nagiosadmin 165 163 authorized_for_configuration_information= nagiosadmin … … 173 171 4) Create a 'nagiosadmin' Apache user/password to correspond with the Nagios Apache\ 174 172 user created above 175 173 176 174 htpasswd -c ${prefix}/etc/nagios/htpasswd.users nagiosadmin 177 175 178 176 Create other users as desired, omit '-c' since it creates the password file. Make\ 179 177 additional users login names match Nagios contact names to restrict web viewing to your\ … … 183 181 5) Set Nagios to start at system boot, and start Nagios 184 182 185 183 Run launchctl so Nagios will start at system boot 186 184 sudo launchctl load -w /Library/LaunchDaemons/org.macports.nagios.plist 187 185 188 186 You may now start Nagios manually with this command (or a reboot): 189 187 sudo ${prefix}/var/nagios/nagios.init start 190 188 191 189 192 190 6) You may now login as 'nagiosadmin' to the Nagios web interface at http://localhost/nagios 193 191 192 7) You can monitor nagios itself with the following commands 193 # ${prefix}/libexec/nagios/check_nagios -t 20 -e 5 -F ${prefix}/var/nagios/nagios.log -C nagios (NOK: Abort trap: 6) 194 # nagiostats 195 As input for mrtg 196 # nagiostats --mrtg 197 Non-official input to cacti 198 http://forums.cacti.net/viewtopic.php?f=12&t=33806&p=221089 199 http://forums.cacti.net/viewtopic.php?f=12&t=34834 200 http://forums.cacti.net/viewtopic.php?f=12&t=17729 201 194 202 195 203 NOTE: The SMTP server Postfix is required to enable Nagios email notifications 196 204 197 205 198 206 File Locations: 199 207 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/ 208 Configuration files: ${prefix}/etc/nagios 209 Nagios plugins: ${prefix}/libexec/nagios 210 Lock file: ${prefix}/var/nagios/nagios.lock 211 Init file: ${prefix}/var/nagios/nagios.init 212 HTML URL: http://localhost/nagios/ 213 CGI URL: http://localhost/nagios/cgi-bin/ 214 206 215 " 216 217 subport ${name}3 { 218 version 3.5.1 219 master_sites sourceforge:project/nagios/nagios-3.x/nagios-${version} 220 checksums rmd160 0ce5693a745f617c9fbf627f18af27b793de884d \ 221 sha256 ca9dd68234fa090b3c35ecc8767b2c9eb743977eaf32612fa9b8341cc00a0f99 222 worksrcdir ${name} 223 224 conflicts ${name} 225 226 } 227 228 ## FIXME! universal: lot of "Undefined symbols for architecture x86_64:" 229 variant universal {} 230 #build.args CFLAGS="${configure.cflags} [get_canonical_archflags cc]" 231 configure.cflags-append "${configure.cflags} [get_canonical_archflags cc]" 232 233 variant nagvis description { nagvis visualization addon } { 234 set n_version 1.7 235 set n_version_minor 10 236 master_sites sourceforge:projects/nagvis/files/NagVis ${n_version}/:nagvis 237 distfiles nagvis-${n_version}.${n_version_minor}${extract.suffix}:nagvis 238 ## http://docs.nagvis.org/1.7/en_US/index.html 239 }