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 can PRTG notify me if my system can no longer copy files on my External HDD?

Votes:

0

I have a Linux system, and I am continuously running a backup of my files to a external hard drive. One time, I encountered an error where my system can no longer copy files to my External HDD because it has lost its writing permission.

I know that there is no built-in sensor that could help me with this issue, and this is quite tricky.

I am thinking of a workaround where I will use SSH Disk free sensor to monitor the external HDD, and I want it to notify me if the disk space is not changing anymore. However, I can't find a way that PRTG will trigger a notification if this happens.

Any inputs will be appreciated.

Thanks

flash notifications permissions

Created on Dec 14, 2012 7:31:42 AM



5 Replies

Accepted Answer

Votes:

0

Hi,

you can use our SSH Script-Sensor for this.

You have to create a script with the following content in the path /var/prtg/scripts/ on your Linux-Machine:

#!/bin/bash
TOUCH="/usr/bin/touch"
RM="/bin/rm"
GREP="/bin/grep"

PATH="$1"
if [ `echo $PATH | $GREP '/$'; echo "$?"` -eq 1 ]; then
  PATH+="/"
fi
PATH+="testfile_prtg"

# check if the path exists
if [ -d "$1" ]; then
  # check if the path is writable
  if [ `$TOUCH "$PATH" 2> /dev/null; echo "$?"` -eq 0 ]; then
    # if it is writable return "1"
    echo "0:1:OK"
    # and then remove the file:
    $RM "$PATH"
  else
    # if not return "0"
    echo "2:0:Path '$1' is not writable!"
  fi
else
  # notify the user to check the path-parameter
  echo "1:0:Path '$1' does not exist!"
fi

After making it executable you can add the ssh-script-sensor in PRTG and provide the path to check as parameter in the sensor settings. If the path is not writable you will be alerted with a down-state, if the path does not exist you will see a warning-state.

Kind regards

Created on Dec 14, 2012 11:32:20 AM by  Dieter Loskarn [Paessler Support]



Votes:

0

Wow, thank you a lot! That's exactly what I am looking for. Anyway, I'm sorry but I'm really not familiar with these scripts, may I know where exactly should I insert the path that I want to monitor in this script?

Thanks!

Created on Dec 17, 2012 5:23:01 AM



Votes:

0

The path needs to be applied as a parameter in the sensor settings: Screenshot sensor settings

For testing purposes you can also add it as a commandline-parameter during execution, e. g. '/var/prtg/scripts/is_writable.sh /home/testuser'.

Created on Dec 17, 2012 10:14:42 AM by  Dieter Loskarn [Paessler Support]

Last change on Feb 24, 2015 8:33:57 AM by  Greg Campion [Paessler Support]



Votes:

0

Thank you for your quick response. I have successfully created a script on my Linux and use it on my SSH Script sensor. It worked, however, it always says that the path is not writable even though I can write files in that path. I am using root as its SSH credentials. Are there any adjustments that needed to be done?

Created on Dec 18, 2012 6:04:57 AM



Votes:

0

Maybe the paths for the 3 commands at the start of the script need to be adjusted to your system. Try to figure out which paths are correct on your system using 'which <command (touch|rm|grep)>' and modify the variables to the results.

Kind regards

Created on Dec 18, 2012 8:14:12 AM by  Dieter Loskarn [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.