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:
Channel | ID | Last Value | Minimum | Maximum |
---|---|---|---|---|
Downtime | -4 | |||
Execution Time | 1 | 612msec | 529msec | 698msec |
mount: / | 0 # | 0 # | 0 # | |
mount: /boot | 0 # | 0 # | 0 # | |
mount: /data | 0 # | 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
Add comment