Hi,
i need to crate ssh script for monitoring a folder's space in CentOS. I created the script for check the space but i don't succeed to return the correct value to PRTG. In the sensor i return the code "Response not wellformed: "Spazio occupato 1326861750 byte Spazio disco ok " (code: PE132)"
I attach the script below.
CARTELLA_CLIENTE=/usr/backup/backup_neterprise/
SPAZIO_OCCUPATO=$(du -sb ${CARTELLA_CLIENTE} | cut -f1)
echo Spazio occupato ${SPAZIO_OCCUPATO} byte
check_service(){
if [ "$SPAZIO_OCCUPATO" -ge 2000000000 ]
then
echo 1:404:Spazio disco massimo superato.
fi
if [ "$SPAZIO_OCCUPATO" -lt 2000000000 ]
then
echo 0:200:Spazio disco ok.
fi
}
main() {
check_service
}
main
Can you help me? Regards
Davide Martinello
Article Comments
The output is:
Spazio occupato 1665637799 byte 0:200:Spazio disco ok.
The script check correctly the space in the folder but in the PRTG the sensor not show green label and status Ok.
Thanks
Dec, 2015 - Permalink
Please change...
echo Spazio occupato ${SPAZIO_OCCUPATO} byte
to...
#echo Spazio occupato ${SPAZIO_OCCUPATO} byte
Then the sensor will work ;)
Dec, 2015 - Permalink
When you execute the script within the terminal, what's the actual output?
Dec, 2015 - Permalink