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
RESTful one-time-maintenance window
Votes:
0
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
Votes:
0
Nicolas,
We do not allow inheritance to be changed via API.
Benjamin Day
[Paessler Support]
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
Votes:
0
Nicolas,
Sorry to be the bearer of bad news,
Benjamin Day
[Paessler Support]
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.
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
Add comment