Surveillance nagios modem hylafax
neimad01
Messages postés
6
Date d'inscription
Statut
Membre
Dernière intervention
-
neimad01 Messages postés 6 Date d'inscription Statut Membre Dernière intervention -
neimad01 Messages postés 6 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
Comment surveiller par nagios le bon fonctionnement de mes modems utilisés pour transmettre des fax par Hylafax?
Il existe un plugin qui surveille l'envoi des fax en récupérant la sortie de la commande faxstat, mais ce dernier ne permet pas de détecter une ligne HS parmi les autres qui fonctionnent correctement car en final, les fax partent.
Comment surveiller par nagios le bon fonctionnement de mes modems utilisés pour transmettre des fax par Hylafax?
Il existe un plugin qui surveille l'envoi des fax en récupérant la sortie de la commande faxstat, mais ce dernier ne permet pas de détecter une ligne HS parmi les autres qui fonctionnent correctement car en final, les fax partent.
A voir également:
- Surveillance nagios modem hylafax
- Comment visualiser les images de sa caméra de surveillance sur son pc - Guide
- Andie veut accéder à internet dans son nouveau logement. que doit-elle faire pour avoir une box (modem) et pouvoir se connecter à internet ? - Forum Mail
- Andie veut accéder à internet dans son nouveau logement. que doit-elle faire pour avoir une box (modem) et pouvoir se connecter à internet - Forum SFR
- Modem usb samsung ne fonctionne pas - Forum Windows 10
- PTT278 ou PTT298 logement de 2011 ✓ - Forum câblage
1 réponse
Voici le script check_lignes.sh qui peut répondre à la question:
#!/bin/sh
#
#
# Script Nagios de surveillance de l'envoi des fax sur une ligne serie donnee pour le jour courant.
# A lancer en fin de journee
#
#======================================================================================================
# Copyright Damien BUNEL 2015. damien.bunel@groupelcd.com
# Licence: http://www.gnu.org/licenses/gpl-3.0.txt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. 1
#
#
#** Fonction qui compte les envois OK et PASOK
#
statEnvoi() {
AFicTrace="$1"; shift
ADate="$1"; shift
ALigne="$1"; shift
[ "A$FicTrace" = "A" ] && echo "0:0" && exit 0
[ ! -f $FicTrace ] && echo "0:0" && exit 0
[ "A$Ligne" = "A" ] && echo "0:0" && exit 0
#
#***** Initialisation des compteurs
#
OK=0
export OK
PASOK=0
export PASOK
#
#***** Parcours du fichier et compte les envois corrects et ceux en erreur
#
IFSOLD="$IFS"
IFS=`echo -e "\011"`
grep "^$ADate" $AFicTrace | grep SEND | grep $ALigne | (while read A B C D E F G H I J K L M Status Reste
do
if [ "A$Status" = "A\"\"" ]
then
OK=`expr $OK + 1`
else
PASOK=`expr $PASOK + 1`
fi
done; echo "$OK:$PASOK")
IFS="$IFSOLD"
}
#
#** Initialisation des variables globales et des parametres
#
FicTrace='/etc/hylafax/etc/xferfaxlog'
Ligne="SEND"
LIBELLE="ETAT ENVOIS"
#**** Par defaut Warning si plus de 50% d'erreur, Critic si plus de 80% d'erreur
WARNING="0:60"
CRITICAL="0:90"
MinW=0
MaxW=50
MinC=0
MaxC=80
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
#
#***** Traitement des parametres du script
#
while [ $# -gt 0 ]
do
case $1 in
-l) shift; LIBELLE="$1";;
-t) shift; Ligne="$1";;
-f) shift; FicTrace="$1";;
-w) shift; WARNING="$1";;
-c) shift; CRITICAL="$1";;
esac
shift
done
if [ ! -f $FicTrace ]
then
echo "$LIBELLE UNKNOWN - $FicTrace inexistant"
exit $STATE_UNKNOWN
fi
#
#*** Recupere la date du jour au format xferfaxlog
#
LDate=`date +'%m/%d/%y'`
#
#***** Decompose $WARNING pour obtenir MinW et MaxW
#
IFSOLD="$IFS"
IFS=":"
set $WARNING
IFS="$IFSOLD"
MinW="$1"
[ "A$MinW" = "A" ] && MinW=0
if [ $# -gt 1 ]
then
MaxW="$2"
fi
#
#***** Decompose $CRITICAL pour obtenir MinC et MaxC
#
IFSOLD="$IFS"
IFS=":"
set $CRITICAL
IFS="$IFSOLD"
MinC="$1"
[ "A$MinC" = "A" ] && MinC=0
if [ $# -gt 1 ]
then
MaxC="$2"
fi
#
#*** Compte les envois reussi et en echec
#
LRetour=`statEnvoi $FicTrace $LDate $Ligne`
IFSOLD="$IFS"
IFS=":"
set $LRetour
IFS="$IFSOLD"
OK="$1"; export OK
PASOK="$2"; export PASOK
#
#*** Si pas d'envoi, retourne WARNING
#
if [ $OK -eq 0 -a $PASOK -eq 0 ]
then
echo "$LIBELLE WARNING - OK=$OK, PASOK=$PASOK"
exit $STATE_WARNING
fi
#
#*** Si que des echecs, retourne CRITICAL
#
if [ $OK -eq 0 ]
then
echo "$LIBELLE CRITICAL - OK=$OK, PASOK=$PASOK"
exit $STATE_CRITICAL
fi
Ratio=`expr \( $PASOK \* 100 \) / \( $OK + $PASOK \)`
if [ $Ratio -lt $MinC -o $Ratio -gt $MaxC ]
then
echo "$LIBELLE CRITICAL - OK=$OK, PASOK=$PASOK"
exit $STATE_CRITICAL
fi
if [ $Ratio -lt $MinW -o $Ratio -gt $MaxW ]
then
echo "$LIBELLE WARNING - OK=$OK, PASOK=$PASOK"
exit $STATE_WARNING
fi
echo "$LIBELLE OK - OK=$OK, PASOK=$PASOK"
exit $STATE_OK
#!/bin/sh
#
#
# Script Nagios de surveillance de l'envoi des fax sur une ligne serie donnee pour le jour courant.
# A lancer en fin de journee
#
#======================================================================================================
# Copyright Damien BUNEL 2015. damien.bunel@groupelcd.com
# Licence: http://www.gnu.org/licenses/gpl-3.0.txt
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. 1
#
#
#** Fonction qui compte les envois OK et PASOK
#
statEnvoi() {
AFicTrace="$1"; shift
ADate="$1"; shift
ALigne="$1"; shift
[ "A$FicTrace" = "A" ] && echo "0:0" && exit 0
[ ! -f $FicTrace ] && echo "0:0" && exit 0
[ "A$Ligne" = "A" ] && echo "0:0" && exit 0
#
#***** Initialisation des compteurs
#
OK=0
export OK
PASOK=0
export PASOK
#
#***** Parcours du fichier et compte les envois corrects et ceux en erreur
#
IFSOLD="$IFS"
IFS=`echo -e "\011"`
grep "^$ADate" $AFicTrace | grep SEND | grep $ALigne | (while read A B C D E F G H I J K L M Status Reste
do
if [ "A$Status" = "A\"\"" ]
then
OK=`expr $OK + 1`
else
PASOK=`expr $PASOK + 1`
fi
done; echo "$OK:$PASOK")
IFS="$IFSOLD"
}
#
#** Initialisation des variables globales et des parametres
#
FicTrace='/etc/hylafax/etc/xferfaxlog'
Ligne="SEND"
LIBELLE="ETAT ENVOIS"
#**** Par defaut Warning si plus de 50% d'erreur, Critic si plus de 80% d'erreur
WARNING="0:60"
CRITICAL="0:90"
MinW=0
MaxW=50
MinC=0
MaxC=80
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
STATE_DEPENDENT=4
#
#***** Traitement des parametres du script
#
while [ $# -gt 0 ]
do
case $1 in
-l) shift; LIBELLE="$1";;
-t) shift; Ligne="$1";;
-f) shift; FicTrace="$1";;
-w) shift; WARNING="$1";;
-c) shift; CRITICAL="$1";;
esac
shift
done
if [ ! -f $FicTrace ]
then
echo "$LIBELLE UNKNOWN - $FicTrace inexistant"
exit $STATE_UNKNOWN
fi
#
#*** Recupere la date du jour au format xferfaxlog
#
LDate=`date +'%m/%d/%y'`
#
#***** Decompose $WARNING pour obtenir MinW et MaxW
#
IFSOLD="$IFS"
IFS=":"
set $WARNING
IFS="$IFSOLD"
MinW="$1"
[ "A$MinW" = "A" ] && MinW=0
if [ $# -gt 1 ]
then
MaxW="$2"
fi
#
#***** Decompose $CRITICAL pour obtenir MinC et MaxC
#
IFSOLD="$IFS"
IFS=":"
set $CRITICAL
IFS="$IFSOLD"
MinC="$1"
[ "A$MinC" = "A" ] && MinC=0
if [ $# -gt 1 ]
then
MaxC="$2"
fi
#
#*** Compte les envois reussi et en echec
#
LRetour=`statEnvoi $FicTrace $LDate $Ligne`
IFSOLD="$IFS"
IFS=":"
set $LRetour
IFS="$IFSOLD"
OK="$1"; export OK
PASOK="$2"; export PASOK
#
#*** Si pas d'envoi, retourne WARNING
#
if [ $OK -eq 0 -a $PASOK -eq 0 ]
then
echo "$LIBELLE WARNING - OK=$OK, PASOK=$PASOK"
exit $STATE_WARNING
fi
#
#*** Si que des echecs, retourne CRITICAL
#
if [ $OK -eq 0 ]
then
echo "$LIBELLE CRITICAL - OK=$OK, PASOK=$PASOK"
exit $STATE_CRITICAL
fi
Ratio=`expr \( $PASOK \* 100 \) / \( $OK + $PASOK \)`
if [ $Ratio -lt $MinC -o $Ratio -gt $MaxC ]
then
echo "$LIBELLE CRITICAL - OK=$OK, PASOK=$PASOK"
exit $STATE_CRITICAL
fi
if [ $Ratio -lt $MinW -o $Ratio -gt $MaxW ]
then
echo "$LIBELLE WARNING - OK=$OK, PASOK=$PASOK"
exit $STATE_WARNING
fi
echo "$LIBELLE OK - OK=$OK, PASOK=$PASOK"
exit $STATE_OK