Closed schoenm1 closed 1 year ago
Libraries aren't really supported by PrtgAPI, but you can try using the Get-NotificationTrigger
cmdlet against the library. You should be able to do Get-Trigger -Id <libraryId>
or something
unfortunately, the Get-NotificationTrigger
(Get-Trigger) ist not working with Get-Object
(which I have to use for 'Library' and 'LibraryNode' Object). Get-NotificationTrigger
is working well for Devices (Get-Devices)
Working (with Get-Device):
PS C:\Users\user> Get-Device -id 40 | Get-Trigger * -verbose
VERBOSE: Get-NotificationTrigger: Synchronously executing request https://myserver.domain.com/api/table.xml?id=40&content=triggers&columns=content,objid&username=prtgadmin&passhash=***********
Type ObjectId SubId Inherited ParentId Latency Condition Threshold Unit OnNotificationAction
---- -------- ----- --------- -------- ------- --------- --------- ---- --------------------
State 40 1 False 40 60 Equals Down None
State 40 2 False 40 36256 Equals Down None
State 40 1 True 0 600 Equals Warning E-Mail suppor@domain.com
State 40 2 True 0 600 Equals Down E-Mail suppor@domain.com
But for inherit from Library, the command to get Trigger from Library is not working, independent if the id is a 'Device' or 'Library'.
PS C:\Users\user> Get-Object -id 50475 | Get-NotificationTrigger * -verbose
Get-NotificationTrigger : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters
that take pipeline input.
At line:1 char:24
+ Get-Object -id 50475 | Get-NotificationTrigger * -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (TEST-Library:PSObject) [Get-NotificationTrigger], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,PrtgAPI.PowerShell.Cmdlets.GetNotificationTrigger
As stated you need to do Get-NotificationTrigger -Id 50475
as the Get-NotificationTrigger
cmdlet does not have a parameter set that allows specifying a simple PrtgObject
as pipeline input
Get-NotificationTrigger -Id 50475
is not working.
ID 50475 is a Library and not a Sensor/Device/Group/Probe
Even if I add 50475 as param, the Get-NotificationTrigger
ask again for Object Input.
Get-NotificationTrigger -Id 50475
cmdlet Get-NotificationTrigger at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Object: 50475
Get-NotificationTrigger : Cannot bind parameter 'Object'. Cannot convert the "50475" value of type "System.String" to type "PrtgAPI.SensorOrDeviceOrGroupOrProbe".
At line:1 char:1
+ Get-NotificationTrigger -Id 50475
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-NotificationTrigger], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,PrtgAPI.PowerShell.Cmdlets.GetNotificationTrigger
Get-Object -id 50475
Name Id Type
---- -- ----
TEST-Library 50475 Library
Apologies, I believe the correct command should actually be
Get-NotificationTrigger -ObjectId 50475
I can not get any NotificationTrigger for a Library.
Get-Object -id 50475 | fl *
Id : 50475
ParentId : -6
Name : TEST-Library
Tags :
DisplayType : Library
Type : Library
Active : True
Get-NotificationTrigger -ObjectId 50475 -verbose
VERBOSE: Get-NotificationTrigger: Synchronously executing request
https://prtg.domain.com/api/table.xml?id=50475&content=triggers&columns=content,objid&username=username&passhash=***
With Get-Help Get-NotificationTrigger -full
I see, that the parameter 'Object' should be
It's executing the correct API call so based on this it would appear it's not possible to retrieve notification triggers using the normal notification trigger API
What's going on?
Hi @lordmilko I try in a first step, to get data from a library, check if library node with tag filtering exist and check if NotificationTemplate is linked to Library. If this is successfull, the 2nd would be to create this three types witch PRTGApi. At moment, getting library and library node data is working. Even the Rawdata Property "libtagfilter_"
All Notification Action I can parse
Get-NotificationAction
. But I would not get the data, if a Notification is linked to a library. Even with Development View in Firefox i could not see the POST data to find out the rawparam. Is there a way to get the data screenshot)? https://myserver.domain.com/library.htm?id=50475&tabid=4Due Dilligance