Browse Source

Appending nagios

Peter Smej 23 years ago
parent
commit
29a3bfb207
3 changed files with 302 additions and 0 deletions
  1. 16 0
      nagios/fsl.nagios
  2. 250 0
      nagios/nagios.spec
  3. 36 0
      nagios/rc.nagios

+ 16 - 0
nagios/fsl.nagios

@@ -0,0 +1,16 @@
+##
+##  fsl.nagios -- OSSP fsl configuration for nagios
+##
+
+ident nagio q{
+    prefix(
+        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
+    ) 
+    -> {
+        debug: file(
+            path="@l_prefix@/var/nagio/nagios.log",
+            append=1, perm=0644
+        )
+    }
+};
+

+ 250 - 0
nagios/nagios.spec

@@ -0,0 +1,250 @@
+##
+##  nagios.spec -- OpenPKG RPM Specification
+##  Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
+##  Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
+##  Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+##  SUCH DAMAGE.
+##
+
+#   package information
+Name:         nagios
+Summary:      Nagios® is a system and network monitoring application.
+URL:          http://www.nagios.org
+Vendor:       Ethan Galstad 
+Packager:     The OpenPKG Project
+Distribution: OpenPKG [EVAL]
+Group:        Network
+License:      GNU
+Version:      1.0
+Release:      20030314
+
+#   list of sources
+Source0:      http://switch.dl.sorceforge.net/sorceforge/nagios/nagios-%{version}.tar.gz
+#Source1:      rc.arpd
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20030310, gd, jpeg, png, zlib, traceroute
+PreReq:       OpenPKG, openpkg >= 20030310, apache, traceroute
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    Nagios® is a system and network monitoring application. It watches hosts and services 
+    that you specify, alerting you when things go bad and when they get better.
+    Nagios was originally designed to run under Linux, although it should work under most 
+    other unices as well.
+    Some of the many features of Nagios® include:
+    * Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)
+    * Monitoring of host resources (processor load, disk usage, etc.)
+    * Simple plugin design that allows users to easily develop their own service checks
+    * Parallelized service checks
+    * Ability to define network host hierarchy using "parent" hosts, allowing detection of 
+      and distinction between hosts that are down and those that are unreachable
+    * Contact notifications when service or host problems occur and get resolved 
+      (via email, pager, or user-defined method)
+    * Ability to define event handlers to be run during service or host events for proactive 
+      problem resolution
+    * Automatic log file rotation
+    * Support for implementing redundant monitoring hosts
+    * Optional web interface for viewing current network status, notification and problem history, 
+      log file, etc.
+
+
+
+%prep
+    %setup -q
+
+%build
+	%{l_shtool} subst \
+		-e 's;localstatedir=.\${prefix}/var.;localstatedir="'%{l_prefix}'/var/nagios";g' \
+		-e 's;datadir=.\${prefix}/share.;datadir="'%{l_prefix}'/share/nagios";g' \
+		-e 's;sysconfdir=.\${prefix}/etc.;sysconfdir="'%{l_prefix}'/etc/nagios";g' \
+		-e 's;libexecdir=.\${prefix}/libexec.;libexecdir="'%{l_prefix}'/libexec/nagios";g' \
+		configure
+
+    # Preconfigure the Path to traceroute
+    ( 
+     echo "ac_cv_path_PATH_TO_TRACEROUTE=\${ac_cv_path_PATH_TO_TRACEROUTE=%{l_prefix}/sbin/traceroute}"
+    ) >config.cache
+
+#	%{l_shtool} subst \
+#-e 's;ac_cv_path_PATH_TO_TRACEROUTE=${ac_cv_path_PATH_TO_TRACEROUTE=/usr/sbin/traceroute};ac_cv_path_PATH_TO_TRACEROUTE=${ac_cv_path_PATH_TO_TRACEROUTE='%{l_prefix}'/sbin/traceroute};g' \
+#		config.cache
+	
+
+#		-e 's;GDLIBS="[^"]*";GDLIBS="-lgd -lz -lm -lpng -ljpeg";g' \
+     CC="%{l_cc}" \
+     CFLAGS="%{l_cflags -O}" \
+     LDFLAGS="%{l_ldflags}" \
+     ./configure \
+         --prefix=%{l_prefix} \
+         --with-cgiurl=%{l_prefix}/cgi/nagios \
+         --with-htmurl=%{l_prefix}/share/nagios \
+         --with-nagios-user=%{l_musr} \
+         --with-nagios-grp=%{l_mgrp} \
+         --with-gd-lib=%{l_prefix}/lib \
+         --with-gd-inc=%{l_prefix}/include \
+         --with-lockfile=%{l_prefix}/var/nagios/nagios.lock 
+#    %{l_shtool} subst \
+#        -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \
+#        arpd.c
+
+#    %{l_shtool} subst \
+#        -e 's;/var/run/arpd.pid;%{l_prefix}/var/arpd/arpd.pid;' \
+#        arpd.8
+
+#    CC="%{l_cc}" \
+#    CFLAGS="%{l_cflags -O}"
+#    ./configure \
+#        --prefix=%{l_prefix} \
+#        --with-libdnet=%{l_prefix} \
+#        --with-libpcap=%{l_prefix} \
+#        --with-libevent=%{l_prefix}
+#    %{l_shtool} subst \
+#        -e "s;^\\(arpd_LDADD.*\\)$;\\1 `%{l_prefix}/bin/fsl-config --all --ldflags --libs`;" \
+#        Makefile
+    %{l_make} all %{l_mflags} \
+		GDLIBS="-lgd -lm -lpng -lz -ljpeg" \
+        LOGDIR=%{l_prefix}/var/nagios \
+        CFGDIR=%{l_prefix}/etc/nagios \
+        BINDIR=%{l__prefix}/bin \
+        CGIDIR=%{l_prefix}/cgi/nagios \
+        HTMLDIR=%{l_prefix}/share/nagios \
+
+
+%install
+    rm -rf $RPM_BUILD_ROOT
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/nagios \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl \
+        $RPM_BUILD_ROOT%{l_prefix}/sbin \
+        $RPM_BUILD_ROOT%{l_prefix}/var/nagios/rw \
+        $RPM_BUILD_ROOT%{l_prefix}/libexec/nagios \
+        $RPM_BUILD_ROOT%{l_prefix}/cgi/nagios \
+        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/media \
+        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/stylesheets \
+        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/contexthelp \
+        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/images \
+        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/logos \
+        $RPM_BUILD_ROOT%{l_prefix}/share/nagios/ssi
+
+#        %{l_make} install %{l_mflags} \
+#			INSTALL=%{l_shtool}' install -c'
+
+#        %{l_make} install-html %{l_mflags} \
+
+
+    #   install files
+
+    #   install nagios
+    %{l_shtool} install -c -s -m 755 \
+        base/nagios $RPM_BUILD_ROOT%{l_prefix}/sbin/
+
+    #   install html
+    %{l_shtool} install -c -m 644 \
+        html/robots.txt $RPM_BUILD_ROOT%{l_prefix}/share/nagios/
+    %{l_shtool} install -c -m 644 \
+        html/docs/robots.txt $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/
+    %{l_shtool} install -c -m 644 \
+        html/media/*.wav $RPM_BUILD_ROOT%{l_prefix}/share/nagios/media/
+    %{l_shtool} install -c -m 644 \
+        html/stylesheets/*.css $RPM_BUILD_ROOT%{l_prefix}/share/nagios/stylesheets/
+    %{l_shtool} install -c -m 644 \
+        html/contexthelp/*.html $RPM_BUILD_ROOT%{l_prefix}/share/nagios/contexthelp/
+    %{l_shtool} install -c -m 644 \
+        html/docs/*.html $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/
+    %{l_shtool} install -c -m 644 \
+        html/docs/images/*.* $RPM_BUILD_ROOT%{l_prefix}/share/nagios/docs/images/
+    %{l_shtool} install -c -m 644 \
+        html/images/*.gif $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/
+    %{l_shtool} install -c -m 644 \
+        html/images/*.jpg $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/
+    %{l_shtool} install -c -m 644 \
+        html/images/*.png $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/
+    %{l_shtool} install -c -m 644 \
+        html/images/logos/*.* $RPM_BUILD_ROOT%{l_prefix}/share/nagios/images/logos/
+
+    #   install cgis
+    %{l_shtool} install -c -s -m 755 \
+         cgi/*.cgi $RPM_BUILD_ROOT%{l_prefix}/cgi/nagios/
+
+    #    install sample config
+    %{l_shtool} install -c -m 644 \
+        sample-config/nagios.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/cgi.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/resource.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/checkcommands.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/contactgroups.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/contacts.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+#    %{l_shtool} install -c -m 644 \
+#        sample-config/template-object/dependencies.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+#   instead of using the depencies.cfg
+    touch $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/dependencies.cfg
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/escalations.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/hostgroups.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/hosts.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/misccommands.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/services.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+    %{l_shtool} install -c -m 644 \
+        sample-config/template-object/timeperiods.cfg $RPM_BUILD_ROOT%{l_prefix}/etc/nagios/
+
+
+    #   install start script
+    %{l_shtool} install -c -m 755 \
+        -e 's;@l_prefix@;%{l_prefix};g' \
+        -e 's;@l_susr@;%{l_susr};g' \
+        %{SOURCE rc.nagios} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   install fsl
+    %{l_shtool} install -c -m 644 \
+         -e 's;@l_prefix@;%{l_prefix};g' \
+         %{SOURCE fsl.nagios} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
+
+#    %{l_shtool} install -c -m 755 \
+#        -e 's;@l_prefix@;%{l_prefix};g' \
+#        -e 's;@l_susr@;%{l_susr};g' \
+#        %{SOURCE rc.arpd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+#    %{l_shtool} install -c -m 644 \
+#        -e 's;@l_prefix@;%{l_prefix};g' \
+#        %{SOURCE fsl.arpd} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
+#   %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
+#	%{l_make} install-config %{l_mflags}
+
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
+
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+

+ 36 - 0
nagios/rc.nagios

@@ -0,0 +1,36 @@
+#!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
+##
+##  rc.nagios -- Run-Commands for nagios
+##
+
+%config
+    nagios_enable="yes"
+    nagios_cfg="nagios.cfg"
+
+%start -p 200
+    opServiceEnabled nagios || exit 0
+        @l_prefix@/sbin/nagios -d @l_prefix@/etc/nagios/$nagios_cfg \
+           >/dev/null 2>&1
+
+%stop -p 200
+    opServiceEnabled nagios || exit 0
+    if [ -f @l_prefix@/var/nagios/nagios.pid ]; then
+        kill -TERM `cat @l_prefix@/var/nagios/nagios.lock`
+    fi
+
+%restart
+    opServiceEnabled nagios || exit 0
+    if [ -f @l_prefix@/var/nagios/nagios.pid ]; then
+        kill -TERM `cat @l_prefix@/var/nagios/nagios.lock`
+        sleep 2
+    fi
+    @l_prefix@/bin/nagios \
+        -d @l_prefix@/etc/nagios/$nagios_cfg \
+        >/dev/null 2>&1
+
+%reload -u @l_susr@
+    opServiceEnabled nagios || exit 0
+    if [ -f @l_prefix@/var/nagios/nagios.pid ]; then
+        kill -HUP `cat @l_prefix@/var/nagios/nagios.lock`
+    fi
+