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

start or pause sensor from command line

Votes:

0

I am looking for a way to pause and restart PRTG sensors during system patching or other maintenance, as part of automated script. I could not find any related reference, if it is possible.

Thanks in advance. DJ

monitor prtg server-administrator

Created on Jun 21, 2012 6:28:58 PM



Best Answer

Accepted Answer

Votes:

8

Something like the follows works for me.

/api/pauseobjectfor.htm?id=8645&duration=30&pausemsg=auto_paused_for_server_maint&username=prtgadmin&passhash=1112233445

I am about to add this so i can automatically pause servers before automatically rebooting after applying windows updates.

Created on Feb 22, 2016 3:06:10 AM

Last change on Feb 22, 2016 7:46:10 AM by  Felix Saure [Paessler Support]



13 Replies

Votes:

0

Hi,

I'm afraid it is not possible to pause sensors from the command line. PRTG only has an HTTP API so you can pause sensors via HTTP request. For details on the API, please see this manual section.

For example, in combination with cURL, you could trigger PRTG's HTTP API calls from command line.

Best regards

Created on Jun 22, 2012 6:11:51 AM by  Konstantin Wolff [Paessler Support]

Last change on Jun 25, 2012 7:41:34 AM by  Daniel Zobel [Product Manager]



Votes:

3

PTF.PRObject

This is now possible with new command line tool PRObject.exe

This command line tool can pause, resume or "checknow" any sensor, device, group, probe, notification,... of your PRTG installation.

Parameters:

-u=    The url of your PRTG installation.
-un=   PRTG Username.
-pw=   PRTG Password or PassHash *.
-id=   The ObjectID you want to pause, resume, or check now.
-a=    The action to perform (p for pause, r for resume, c for checknow).
-s     Optional switch to suppress the textual output.

Example to pause object 1001

PRObject -u=yourPRTGServer -un=myuser -pw=mypassword -id=1001 -a=p

If an error occurs error level 1 is returned.

The tool can be downloaded here.

Created on Jun 23, 2012 7:09:29 PM

Last change on May 25, 2015 10:44:34 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Hi

I'd like to use this utility to pause monitoring during scheduled reboots of servers.

Can you pause a sensor for a period of time (eg 5 minutes) rather than pause indefinitely? (This will save having to run the script again when the server starts to resume monitoring.)

Also how do you determine the ObjectID? (I've been viewing the xml page and extracting the ObjectID from there. Is there an easier way?)

Thanks Jon

Created on Nov 6, 2012 10:44:07 PM



Votes:

0

Created on May 22, 2015 3:12:27 PM



Votes:

0

Hi 2College ICT,

Thank you for your comment, the download URL is fixed now.

Created on May 25, 2015 10:55:12 AM



Votes:

0

Has anyone this running against a PRTG server reachable using https only?

I get the error "The request was aborted: Could not create SSL/TLS secure channel." when running PRObject.exe

Created on Dec 2, 2015 11:24:47 AM



Votes:

0

Hi 2CollegeICT,

The error "Could not create SSL/TLS secure channel" unusually indicates a wrong username/password combination.

Please copy the URL after the -u= parameter in you internet browser and make sure it connects to your PRTG server. Next type the username and password as you supplied with the -un= and -pw= parameters, does this open your PRG interface?

Created on Dec 2, 2015 12:40:55 PM



Votes:

0

hmm, typo.

The error "Could not create SSL/TLS secure channel" usually indicates a wrong username/password combination.

Created on Dec 2, 2015 1:44:38 PM



Votes:

0

Thanks for the quick reply.

The -u URL gets me to the login interface. But I received a PassHash instead of PassWord from our PRTG admin. That combination is not accepted in the login interface.

However, that combination I got I could verify with <<url as in -u>>/api.htm?username=<<UserNameas as in -un>>&passhash=<<PassHash as in -pw>>

Have I used the -pw options incorrectly? How to use PassHash in stead of PassWord with -pw?

Created on Dec 2, 2015 4:57:51 PM



Votes:

0

Hi 2CollegeICT,

Ok, I understand the confusion. The native PRTG PassHash cannot be used with the sensor. Only passhashes created with the passhash tool are supported.

The tool can be downloaded here

Created on Dec 3, 2015 8:39:51 AM



Votes:

0

Ah, thanks! Got it working now! (Would have voted for your answer, but my reputation doesn't allow it (yet))

Created on Dec 4, 2015 12:30:43 PM



Accepted Answer

Votes:

8

Something like the follows works for me.

/api/pauseobjectfor.htm?id=8645&duration=30&pausemsg=auto_paused_for_server_maint&username=prtgadmin&passhash=1112233445

I am about to add this so i can automatically pause servers before automatically rebooting after applying windows updates.

Created on Feb 22, 2016 3:06:10 AM

Last change on Feb 22, 2016 7:46:10 AM by  Felix Saure [Paessler Support]



Votes:

7

I have update my Powershell PRTG Admin module to handle pausing of devices. You can now:

  • Pause a device/sensor, for a given timeframe, with a message
  • Pause This Device (looks at the servers IP/hostname, finds it in PRTG, then pauses with timeframe and message)
  • Resume This Device

The last 2 are great and pausing before windows updates.

I have written up all the details here: https://thedomainiown.wordpress.com/prtg-related/pause-a-sensor/

Created on Mar 9, 2016 10:31:45 AM




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.