What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

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

Your Vote:

Up

Down

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 by  danielloizosswish (0) 1

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



Replies

Nobody has replied yet

Why not be the first?

Please log in or register to enter your reply.


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.