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

How do I prevent SSH Disk Free monitoring Ubuntu snap partititons

Votes:

0

Hi, my company uses prtg "ssh disk free" to monitor Ubuntu snap partitions. Snap partitions are (by default) very small, so fill up quickly and alarm during out of hours. I am trying to find a way to prevent snap partitions being monitored.

I have tried modifying the 'df' that runs on he server with an alias:

  • The "ssh disk free" check performs the periodic command: df -TP -x tmpfs -x devtmpfs -x debugfs

I created a new user and a bash alias on the client server for df: alias df="df -x squashfs"

I was attempting to modify df so it wouldn't display squashfs. the df would be running the command df -TP -x tmpfs -x devtmpfs -x debugfs -x squashfs

However, the logs generated have not changed.

Can anyone advise me? Thanks

df prtg ssh

Created on Sep 16, 2022 3:35:01 PM



8 Replies

Votes:

0

Hi Daniel,

Thank you for your message.

To avoid the SSH Disk Free sensor to create channel for new snap partitions, I invite you to create the sensor anew. When doing that, please make sure to keep the snap partitions not selected/enabled.

The sensor should not create snap channel anymore afterwards.

Regards.

Created on Sep 19, 2022 7:39:29 AM by  Florian Lesage [Paessler Support]



Votes:

0

Thanks for your reply. I appreciate it. Does PRTG off the possibility to modify checks/commands such as 'df'?

Thanks

Created on Sep 20, 2022 8:40:06 AM



Votes:

0

Hi Dianel,

I'm afraid that it is not possible to modify the command executed by the sensor. However, you have the possibility to use yours via a custom script, executed by the SSH Script or SSH Script Advanced sensor.

In that case, the script must return a response in the corresponding format: https://www.paessler.com/manuals/prtg/custom_sensors

If you have further questions, do not hesitate.

Regards.

Created on Sep 21, 2022 5:05:14 AM by  Florian Lesage [Paessler Support]



Votes:

0

In the end the solution was to write a script, which can be seen here:

#!/bin/bash
# filename: check_prtg_free_bytes.sh
# author: D P Loizos [email protected]
# create date: 20/9/2022
# description: a PRTG check that displays free bytes, for various filesystems, ignoring tmpfs, devtmpfs, squashfs. PRTG prefers XML as its output machanism.

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

# get free bytes
FREEB=$(df -T -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Available' | awk '{ print $5}')
MOUNT_FREEB=( $FREEB )

# 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_FREEB[n]} </value>"
        n=$(($n+1))
        echo "  </result>"
done

echo "</prtg>"

Created on Sep 21, 2022 1:26:11 PM

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



Votes:

0

Hi Daniel,

Thank you for your feedback and for sharing a script.

Do not hesitate to contact the support again if needed.

Have a great day.

Regards.

Created on Sep 22, 2022 5:07:37 AM by  Florian Lesage [Paessler Support]



Votes:

0

I have updated the script. In my output, it will give the percent free space left on the disk, and will give warning when its below 10%, and error when its below 5%.

  1. !/bin/bash
  2. filename: check_prtg_free_bytes.sh
  3. author: D P Loizos [email protected]
  4. create date: 20/9/2022
  5. description: a PRTG check that displays free bytes, for various filesystems, ignoring tmpfs, devtmpfs, squashfs. PRTG prefers XML as its output machanism.
  • get mount name
MOUNT=$(df -T -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Filesystem' | awk '{print $7}')
MOUNT_ARRAY=( $MOUNT )
  • get free bytes
FREEB=$(df -T -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Available' | awk '{ print $5}')
MOUNT_FREEB=( $FREEB )
  • get total bytes
PERCENT=$(df -T -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Available' | awk '{ print $6}')
MOUNT_PERCENT=( $PERCENT )
  • build the XML file, iterating through two arrays
echo "<prtg>"
n=0
for i in "${MOUNT_ARRAY[@]}"
do
        percent=${MOUNT_PERCENT[n]}
        percent=${percent%\%}
        percent=$((100-percent))
        echo "  <result>"
        echo "    <channel>Freespace on Mount: $i</channel>"
        echo -e "      <value> $percent </value>"
        n=$(($n+1))
        echo "         <unit>percent</unit>"
        echo "         <LimitMode>1</LimitMode>"
        echo "         <LimitMinWarning>10</LimitMinWarning>"
        echo "         <LimitMinError>5</LimitMinError>"
        echo "  </result>"
done

echo "</prtg>"

Created on Dec 19, 2022 11:33:14 AM

Last change on Dec 19, 2022 11:33:14 AM



Votes:

0

My update of the script, looks funny, so try again with a new post :)

#!/bin/bash
# filename: check_prtg_free_bytes.sh
# author: D P Loizos [email protected]
# create date: 20/9/2022
# description: a PRTG check that displays free bytes, for various filesystems, ignoring tmpfs, devtmpfs, squashfs. PRTG prefers XML as its output machanism.

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

# get free bytes
FREEB=$(df -T -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Available' | awk '{ print $5}')
MOUNT_FREEB=( $FREEB )

# get total bytes
PERCENT=$(df -T -x tmpfs -x devtmpfs -x squashfs | egrep -v 'Available' | awk '{ print $6}')
MOUNT_PERCENT=( $PERCENT )

# build the XML file, iterating through two arrays
echo "<prtg>"
n=0
for i in "${MOUNT_ARRAY[@]}"
do
        percent=${MOUNT_PERCENT[n]}
        percent=${percent%\%}
        percent=$((100-percent))
        echo "  <result>"
        echo "    <channel>Freespace on Mount: $i</channel>"
        echo -e "      <value> $percent </value>"
        n=$(($n+1))
        echo "         <unit>percent</unit>"
        echo "         <LimitMode>1</LimitMode>"
        echo "         <LimitMinWarning>10</LimitMinWarning>"
        echo "         <LimitMinError>5</LimitMinError>"
        echo "  </result>"
done

echo "</prtg>"

Created on Dec 20, 2022 12:00:31 PM



Votes:

0

Hi there, thanks so much for sharing this script, and for detailing your progress with it - it's great to see your process, and your results. Please do keep us updated - it's much appreciated!

Created on Dec 28, 2022 10:20:48 AM by  Mike Payne [Paessler Support]




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.