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

RESTful one-time-maintenance window

Votes:

0

Hi Is it possible to schedule a one time maintenance windows with the RESTful API? I cannot see any object manipulation command to do this. It not, this would make a nice addition to your wishlist. Thanks, Jon

api maintenance-window rest

Created on Nov 24, 2014 8:30:30 AM



7 Replies

Votes:

2

The first thing to do is to manually break the SCHEDULES, DEPENDENCIES, AND MAINTENANCE WINDOW inheritance of the object.

You can now set the maintenance window with following API calls:

SET STARTTIME

/api/setobjectproperty.htm?id=id_of_object&name=maintstart&value=2014-11-24-12-00

SET ENDTIME

/api/setobjectproperty.htm?id=id_of_object&name=maintend&value=2014-11-24-15-00

ENABLE WINDOW

/api/setobjectproperty.htm?id=id_of_object&name=maintenable&value=1

This will set and activate a maintenance window on 2014-11-24 between 12:00 and 15:00 for the given object and its child objects.

Created on Nov 24, 2014 1:05:09 PM

Last change on Nov 24, 2014 3:34:31 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Hi,

"The first thing to do is to manually break the SCHEDULES, DEPENDENCIES, AND MAINTENANCE WINDOW inheritance of the object."

Is there a way to do this via the API ? Also i've checked Lord Milko PrtgAPI module, can't find any solution with Set-ObjectProperty (raw or not ... ) , seems the command returning no error but do nothing (InheritDependancy always on True statement)

If not possible do do this via API command (and only manually) althought "SET STARTTIME" "SET ENDTIME" and "ENABLE WINDOW" possible ...

Thanks.

Nicolas

Created on Jul 9, 2020 3:49:45 PM



Votes:

0

Nicolas,

We do not allow inheritance to be changed via API.

Benjamin Day
[Paessler Support]

Created on Jul 9, 2020 11:55:13 PM by  Benjamin Day [Paessler Support] (1,441) 2 1



Votes:

0

Hi Benjamin,

Thanks for your quick reply, althought it ruined my day ... ;-)

Basically was trying to apply automatic scheduled one-time maintenance trought an Outlook calendar (Outlook API) All was working well and automatized, except the last part ...

Maybe was thinking to apply those scheduled maintenances by "simply" pausing the sensor/probe (no need to break inheritance in this case ...)

Nicolas

Created on Jul 10, 2020 2:49:52 PM



Votes:

0

Nicolas,

Sorry to be the bearer of bad news,

Benjamin Day
[Paessler Support]

Created on Jul 10, 2020 10:07:09 PM by  Benjamin Day [Paessler Support] (1,441) 2 1



Votes:

0

Just wanted to let you know, that I also was struggling with setting the one-time maintenance window.

I figured it out to do it over the prtgAPI from Lordmilko.

Here's the code:

Get-Device -Id 40298 | Get-ObjectProperty -Raw $params = @{ "maintenable_" = 1 "maintstart_" = "2021-11-01-10-00-00" "maintend_" = "2021-11-03-11-00-00" }

Or here in single commands:

Get-Device -Id 40298 | Set-ObjectProperty -RawProperty "maintstart_" -RawValue 2021-11-01-10-00-00 -force Get-Device -Id 40298 | Set-ObjectProperty -RawProperty "maintend_" -RawValue 2021-11-03-11-00-00 -force Get-Device -Id 40298 | Set-ObjectProperty -RawProperty "maintenable_" -RawValue 1

"maintenable_" needs to be enabled at the end otherwise it will not work properly or throw an error.

Created on Oct 8, 2021 8:32:54 AM



Votes:

0

Well actually you also need to set the "Schedules, Dependencies, and Maintenance Windows" (scheduledependency) to not inherit (0) because just setting the maintenance window will not do that. So can automate what you initially wanted to do.

That only works with RawParameters option of the Set-ObjectProperty function.

$params = @{
    "scheduledependency" = 0
    "maintenable_" = 1
    "maintstart_" = "2021-10-08-08-00-00"
    "maintend_" = "2021-11-09-19-00-00"
}

Get-Device -Id 40294 | Set-ObjectProperty -RawParameters $params -Force

Created on Oct 8, 2021 9:45:17 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.