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

Custom SSH Script Advanced XML <values> don't match the values in the prtg-desktop output

Votes:

0

I wrote a script, however when it runs in prtg-desktop, the values display as zero.

The script is shown below:

# description: a PRTG check that displays free space, for various filesystems, ignoring tmpfs, devtmpfs, squashfs. PRTG prefers XML as its output machanism.

# get mount name
MOUNT=$(df -Th -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Filesystem' | awk '{print $7}')
MOUNT_ARRAY=( $MOUNT )

# get free space
FREES=$(df -Th -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Used' | awk '{ print $4}')
MOUNT_FREES=( $FREES )

# build the XML file, iterating through two arrays
echo "<prtg>"
n=0
for i in "${MOUNT_ARRAY[@]}"
do
        echo "  <result>"
        echo "    <channel>Mount: $i</channel>"
        echo -e "      <value> ${MOUNT_FREES[n]} </value>"
        n=$(($n+1))
        echo "  </result>"
done

echo "</prtg>"

XML is generated in logs on the backend server:

<prtg>
  <result>
  <channel>Mount: /</channel>
  <value>16G</value>
  </result>
  <result>
  <channel>Mount: /boot</channel>
  <value>404M</value>
  </result>
  <result>
  <channel>Mount: /data</channel>
  <value>33G</value>
  </result>
</prtg>

The PRTG-Desktop output is as follows:

ChannelIDLast ValueMinimumMaximum
Downtime-4
Execution Time1612msec529msec698msec
mount: /0 #0 #0 #
mount: /boot0 #0 #0 #
mount: /data0 #0 #0 #

As you can see XML <values> don't match the values in the prtg-desktop output. Please could you suggest why that is?

Thanks

df prtg ssh

Created on Sep 21, 2022 1:13:53 PM

Last change on Sep 21, 2022 2:08:55 PM by  Felix Wiesneth [Paessler Support]



1 Reply

Votes:

0

I solved this problem

df -h does not work because the output is letters and numbers.

Created on Oct 9, 2022 6:39:04 AM




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.