New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

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

 

Top Tags


View all Tags


Can I create a sensor to regularly test my notifications?

Votes:

0

Your Vote:

Up

Down

I would like to have a sensor which is always green, but turns to a red "Error" status for a short while, twice a day.

I want to use this kind of sensor to intentionally trigger my SMS text message notifications to make sure they work when they're needed.

How can I achieve this?

custom-exe custom-script-exe exe-script-sensor notifications powershell prtg ps1 test

Created on Sep 5, 2012 9:24:24 AM by  Daniel Zobel [Paessler Support]

Last change on Mar 19, 2015 3:40:50 PM by  Martina Wittmann [Paessler Support]



1 Reply

Accepted Answer

Votes:

0

Your Vote:

Up

Down

This article applies to PRTG Network Monitor 12 or later

Powershell Script for EXE/Script Sensor

Using the following script you can create an EXE/Script Sensor which is usually green, but shows an error twice a day. Attach a notification trigger to this sensor in order to test your notifications, e.g. by intentionally sending out an SMS text messages for testing.

PowerShell Script

We provide the following script without any warranty or support. Please adapt it to your needs. Thanks to Raffaele for sharing this idea with our support team!

$Time = date -f hhmm
if ($args[0] -eq $Time -or $args[1] -eq $Time) {
                $msg="2:Error"
                $exit=2

}else {
                $msg="0:ok"
                $exit=0
}
write-host $msg
exit $exit

Start Parameters

The script accepts two start parameters in which you can define the times when the sensor will show a Down status. Define them when adding your EXE/Script sensor to PRTG.

  • Provide the times in hhmm 24 hours format (without a colon symbol).
  • The first parameter is mandatory, the second is optional.

In the example below we provided the parameters

0700 1900

which will switch the sensor to show an error every day at 7 a.m. and 7 p.m.


Example Start Parameters

See Also

Created on Sep 5, 2012 9:33:09 AM by  Daniel Zobel [Paessler Support]

Last change on Sep 6, 2012 7:26:59 AM by  Daniel Zobel [Paessler Support]



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.