lordmilko / PrtgAPI

C#/PowerShell interface for PRTG Network Monitor
MIT License
301 stars 37 forks source link

Clone Notification is not working!! #222

Closed karthikkonar24 closed 3 years ago

karthikkonar24 commented 3 years ago

I've tried to clone the notification trigger from one device to another. Using the below command.

Get-Probe -Id XXXX | Get-Trigger -Type state -Inherited $false | Clone-Object -DestinationId XXXX

It's not throwing any error in Powershell. But cloning notification trigger is not happening.

Correct Me!!! If I'm wrong.

lordmilko commented 3 years ago

Hi @karthikkonar24,

Are you able to advise what the output of

Get-Probe -Id XXXX | Get-Trigger -Type state -Inherited $false

Get-Probe -Id XXXX | Get-Trigger -Type state -Inherited $false | Clone-Object -DestinationId XXXX -Verbose

Get-PrtgClient -Diagnostic

is?

Please obscure any sensitive details in the output from the second command such as your PRTG Server URL, username and passhash

Regards, lordmilko

karthikkonar24 commented 3 years ago

Hey lordmilko, Please find the below response for your reference: image

lordmilko commented 3 years ago

Hi @karthikkonar24,

Based on the response to the first request, we can see that there are no non-inherited state triggers defined on the probe with ID 8334, hence why Clone-Object does nothing - there is nothing to clone!

If you have a look at the triggers defined on the probe with ID 8334 in the PRTG UI, are you able to advise whether any non-inherited state triggers display there?

Regards, lordmilko

karthikkonar24 commented 3 years ago

Hey lordmilko,

Device ID 8334 containing the notification trigger which I want to clone the same to the device id 9362. Please find the GUI view of the notification trigger which available on the ID 8334. ID-8334

lordmilko commented 3 years ago

Hi @karthikkonar24,

Are you able to advise what the output of

Get-Probe -Id 8334

is?

karthikkonar24 commented 3 years ago

Hi @lordmilko,

It's not returning any value after entering the command. image

But the 8334 is a device id, if do Get-device -id 8334 will return the value of device details.

lordmilko commented 3 years ago

Hi @karthikkonar24,

This appears to be a duplicate of #219

Can you please try and run the latest build of PrtgAPI via the manual installation instructions and advise whether Get-Probe -Id 8334 returns anything using that, and if so whether you can also retrieve and clone your triggers properly?

Regards, lordmilko

karthikkonar24 commented 3 years ago

Hi lordmilko,

As per your suggestions, I've downloaded the latest PRTGAPI but still Get-Probe -Id 8334 not returning any value. Any suggestion on it.

Regards, Karthik Yadav

lordmilko commented 3 years ago

Hi @karthikkonar24,

Can you do

Set-PrtgClient -LogLevel All

Get-Probe -Verbose

Get-Probe -Id 8334 -Verbose

and provide the output (please obscure any sensitive details like your server name, username and passhash int he results)

lordmilko commented 3 years ago

Hi @karthikkonar24,

Just following up on this. Another user also appeared to have this issue and it turned out they weren't in fact using the new build of PrtgAPI

To make sure you are using the new version of PrtgAPI, can you

  1. Download the latest build
  2. Right click the downloaded PrtgAPI.zip file and go to Properties
  3. On the General tab, under Security select Unblock
  4. Unzip the file to C:\temp\PrtgAPI
  5. Open a new PowerShell and type ipmo C:\temp\PrtgAPI
  6. Provide the output of
Get-Probe -Verbose
Get-Probe -Id 8334 -Verbose
(gmo prtgapi).path

Regards, lordmilko

karthikkonar24 commented 3 years ago

Hi @lordmilko, Please find the output. PRTG1

PS C:\Users\ABC> Set-PrtgClient -LogLevel All PS C:\Users\ABC> Get-Probe -Verbose VERBOSE: Get-Probe: Synchronously executing request http://XXX-XXXX.COM/api/table.xml?content=probenode&columns=objid,name,condition,fold,groupnum,devicenum,up sens,downsens,downacksens,partialdownsens,warnsens,pausedsens,unusualsens,undefinedsens,totalsens,schedule,basetype,bas elink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=* &filter_parentid=0&username=XXX&passhash=XXXXXX VERBOSE: Get-Probe:

20.3.61.1649

PS C:\Users\ABC> PS C:\Users\ABC> Get-Probe -Id 8334 -Verbose VERBOSE: Get-Probe: Synchronously executing request http://XXX-XXXX.COM/api/table.xml?content=probenode&columns=objid,name,condition,fold,groupnum,devicenum,up sens,downsens,downacksens,partialdownsens,warnsens,pausedsens,unusualsens,undefinedsens,totalsens,schedule,basetype,bas elink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=* &filter_objid=8334&filter_parentid=0&username=XXXX&passhash=XXXXXXXX VERBOSE: Get-Probe:

20.3.61.1649

lordmilko commented 3 years ago

Thanks @karthikkonar24,

Can you copy and paste the URL of the first request, i.e. this one

http://XXX-XXXX.COM/api/table.xml?content=probenode&columns=objid,name,condition,fold,groupnum,devicenum,up
sens,downsens,downacksens,partialdownsens,warnsens,pausedsens,unusualsens,undefinedsens,totalsens,schedule,basetype,bas
elink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*
&filter_parentid=0&username=XXX&passhash=XXXXXX

into the address bar of your web browser, hit enter, and then provide the contents of the table.xml file it downloads?

lordmilko commented 3 years ago

Hi @karthikkonar24,

I installed the same version of PRTG you're using (20.3.61.1649) and have managed to reproduce the issue. This issue is happening due to a bug that was present in this PRTG version that I actually opened a case with Paessler regarding around this time last year.

If you upgrade PRTG to version v20.3.62.1397 or higher you should find that Get-Probe is now functioning properly

lordmilko commented 3 years ago

Hi @karthikkonar24,

Please be advised I have now released PrtgAPI 0.9.16, which includes

To update PrtgAPI please run Update-Module PrtgAPI and reopen PowerShell. I also noted that in this screenshot you were trying to retrieve the probe with ID 8334, however according to this screenshot the object with ID 8334 is actually a device (you can see it says device.htm in the URL) so I would say potentially for cloning these triggers you may really need to be doing Get-Device -Id 8334

Please let me know if you have any further issues

Regards, lordmilko