What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Create script SSH for check size folder

Votes:

0

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

prtg script ssh

Created on Dec 18, 2015 2:00:06 PM

Last change on Dec 21, 2015 2:38:09 PM by  Stephan Linke [Paessler Support]



4 Replies

Votes:

0

When you execute the script within the terminal, what's the actual output?

Created on Dec 21, 2015 6:53:13 AM by  Stephan Linke [Paessler Support]



Votes:

0

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

Created on Dec 21, 2015 1:21:35 PM



Votes:

0

Please change... echo Spazio occupato ${SPAZIO_OCCUPATO} byte to... #echo Spazio occupato ${SPAZIO_OCCUPATO} byte

Then the sensor will work ;)

Created on Dec 21, 2015 2:39:03 PM by  Stephan Linke [Paessler Support]



Votes:

0

Ok, now it works fine.

Thanks.

Davide.

Created on Dec 21, 2015 3:06:08 PM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.