IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

Installation et sécurisation d'une station Debian 3.0 stable


Installation et sécurisation d'une station Debian 3.0 stable

15/05/2004




ANNEXE 14. Script d'initialisation Nagios


ANNEXE 14. Script d'initialisation Nagios


#!/bin/sh NAGIOS_BIN=/usr/local/nagios/bin/nagios NAGIOS_CFG=/usr/local/nagios/etc/nagios.cfg NAGIOS_FLG=" -d " NAGIOS_CHK=" -v " NAGIOS_LCK=/var/nagios/var/nagios.lock NAGIOS_CMD=/var/nagios/var/rw/nagios.cmd # Check we have required binaries and variables if [ ! $NAGIOS_BIN ] || [ ! $NAGIOS_CFG ] || [ ! $NAGIOS_CHK ] || [ ! $NAGIOS_FLG ] || [ ! $NAGIOS_FLG ] || [ ! $NAGIOS_CMD ] then echo "init_nagios.sh configuration error" exit 0 fi test -f $NAGIOS_BIN || exit 0 test -f $NAGIOS_CFG || exit 0 case "$1" in start) if [ -f $NAGIOS_LCK ] && kill -0 `cat $NAGIOS_LCK` 2> /dev/null then echo "Nagios already started..." exit 1 else if [ ! -f $NAGIOS_LCK ] && pidof nagios > /dev/null 2&>1 then echo "Nagios already started but no lockfile..." exit 0 else if pidof nagios > /dev/null 2&>1 then echo "Nagios lockfile exist but no daemon is started..." echo "Deleting lockfile and starting Nagios..." rm -f $NAGIOS_LCK $NAGIOS_CMD $NAGIOS_BIN $NAGIOS_FLG $NAGIOS_CFG exit 1 fi fi fi echo "Starting Nagios..." $NAGIOS_BIN $NAGIOS_FLG $NAGIOS_CFG exit 1 ;; stop) if [ -f $NAGIOS_LCK ] && kill -0 `cat $NAGIOS_LCK` 2> /dev/null then echo "Stopping Nagios..." kill -9 `cat $NAGIOS_LCK` > /dev/null rm -f $NAGIOS_LCK rm -f $NAGIOS_CMD exit 1 else if [ ! -f $NAGIOS_LCK ] && pidof nagios > /dev/null 2&>1 then echo "Nagios seems to be running but no lockfile exists... stopping..." killall nagios rm -f $NAGIOS_LCK rm -f $NAGIOS_CMD exit 0 else if [ -f $NAGIOS_LCK ] then echo "Nagios isn't running but lockfile exists... removing..." rm -f $NAGIOS_LCK rm -f $NAGIOS_CMD exit 0 fi fi fi echo "Nagios is not running ..." ;; restart) $0 stop $0 start exit 1 ;; configtest) $NAGIOS_BIN $NAGIOS_CHK $NAGIOS_CFG exit 1 ;; *) echo "Usage : /etc/init.d/init_nagios.sh {start|stop|restart|configtest}" exit 1 ;; esac exit 0


Copyright (c) 2003 Simon Castro, scastro [ at ] entreelibre.com.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
You must have received a copy of the license with this document and it should be présent in the fdl.txt file.
If you did not receive this file or if you don't think this fdl.txt license is correct, have a look on the official http://www.fsf.org/licenses/fdl.txt licence file.
Copyright (c) 2003 Simon Castro, scastro [ at ] entreelibre.com.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
You must have received a copy of the license with this document and it should be présent in the fdl.txt file.
If you did not receive this file or if you don't think this fdl.txt license is correct, have a look on the official http://www.fsf.org/licenses/fdl.txt licence file.