Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente | Dernière révision Les deux révisions suivantes | ||
start:developpement:joomla:nagioscheck4updates [2012/12/07 16:39] fufroma |
start:developpement:joomla:nagioscheck4updates [2012/12/07 16:44] fufroma |
||
---|---|---|---|
Ligne 19: | Ligne 19: | ||
#!/bin/bash | #!/bin/bash | ||
- | # Recupere le status de la sonde d'upgrade joomla | + | # Wrapper for nagioscheck4updates |
- | # Simple page sans balise : | + | # Documentation: http://tech.nnx.com/doku.php?id=start:developpement:joomla:nagioscheck4updates |
- | # - premiere ligne, le code de retour pour nagios | + | |
- | # - seconde ligne, le commentaire pour nagios | + | if [ 3 -ne $# ] ; then |
+ | echo "Wrong parameters." | ||
+ | echo "Usage : $0 web_site username password" | ||
+ | exit | ||
+ | fi | ||
site=$1 | site=$1 | ||
Ligne 37: | Ligne 41: | ||
STATE_DEPENDENT=4 | STATE_DEPENDENT=4 | ||
+ | # Get status | ||
ret=$(wget -q -O - "$url" --user="$user" --password="$pass") | ret=$(wget -q -O - "$url" --user="$user" --password="$pass") | ||
nbl=$(echo -e "$ret"|wc -l) | nbl=$(echo -e "$ret"|wc -l) | ||
+ | # Check the content of the page | ||
if [ 2 -ne $nbl ] ; then | if [ 2 -ne $nbl ] ; then | ||
echo "Problem: there is $nbl line instead of 2" | echo "Problem: there is $nbl line instead of 2" | ||
Ligne 50: | Ligne 56: | ||
comment=$(echo -e "$ret" | tail -n 1) | comment=$(echo -e "$ret" | tail -n 1) | ||
+ | # Check informations of the Joomla! component | ||
if [[ ! "$state" =~ [0-4] ]] ; then | if [[ ! "$state" =~ [0-4] ]] ; then | ||
echo "Problem: -$state- should be a number between 0 and 4" | echo "Problem: -$state- should be a number between 0 and 4" | ||
Ligne 55: | Ligne 62: | ||
fi | fi | ||
+ | # Return informations | ||
echo $comment | echo $comment | ||
exit $state | exit $state |