Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$param = Get-Device -id 127399 | New-SensorParameters -RawType exexml -Target PSx64.exe #341

Open
2 tasks done
carsten0407 opened this issue Jul 1, 2023 · 11 comments
Open
2 tasks done
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version

Comments

@carsten0407
Copy link

What's going on?

Im trying to add a sensor (exexml) with
$param = Get-Device -id 127399 | New-SensorParameters -RawType exexml -Target PSx64.exe
get-device -id 127399 | Add-Sensor $params

I get the param, but nothing happens no sensor will added.

scriptplaceholdergroup : 1
scriptplaceholder1description :
scriptplaceholder1 :
scriptplaceholder2description :
scriptplaceholder2 :
scriptplaceholder3description :
scriptplaceholder3 :
scriptplaceholder4description :
scriptplaceholder4 :
scriptplaceholder5description :
scriptplaceholder5 :
exefilelabel :
exeparams :
environment : 0
usewindowsauthentication : 0
mutexname :
timeout : 60
writeresult : 0
anti-csrf-token : ZWJmNTc4MjZiZDJjMTY2ZmY2NmJjMThlMzcwMmQ5NGFjZTQ3OTg4OQ==
exefile : PSx64.exe
Targets : {[exefile, PrtgAPI.Targets.GenericSensorTarget[]]}
Source : server.lan.local
QueryParameters :
SensorType : exexml
Priority : Three
InheritTriggers : True
InheritInterval : True
Interval : 00:01:00
IntervalErrorMode : OneWarningThenDown
DynamicType : False
Name : XML-Programm-/Skriptsensor
Tags : {xmlexesensor}
Cookie : False

If I try without -target
$param = Get-Device -id 127399 | New-SensorParameters -RawType exexml ((((-Target PSx64.))))
the sensor will added but the wrong one with a wrong exefile

Due Dilligance

  • It wasn't covered by the wiki, I swear!
  • I have tried doing some basic research on this issue but haven't been able to come up with anything. Please help!
@carsten0407 carsten0407 added the question Questions raised by people who don't know how to program or read the wiki :P label Jul 1, 2023
@carsten0407
Copy link
Author

PSVersion : 5.1.22621.1778
PSEdition : Desktop
OS : Microsoft Windows 11 Enterprise
PrtgAPIVersion : 0.9.18
Culture : de-DE
CLRVersion : 533320
PrtgVersion : 23.2.83.1760
PrtgLanguage : german.lng

@lordmilko
Copy link
Owner

After executing this line

$param = Get-Device -id 127399 | New-SensorParameters -RawType exexml -Target PSx64.exe

Can you provide the output of $param

$param

In addition, what is the output of

get-device -id 127399 | Add-Sensor $params -Verbose

Please remove any sensitive information (such as your server address, username and passhash) in the verbose output

@carsten0407
Copy link
Author

carsten0407 commented Jul 1, 2023 via email

@carsten0407
Copy link
Author

carsten0407 commented Jul 1, 2023 via email

@lordmilko
Copy link
Owner

Hi @carsten0407,

When you do get-device -id 127399 | Add-Sensor $param -Verbose it displays the raw HTTP request PrtgAPI attempted to execute. It appears you have completely omitted this text. Can you please provide the verbose output with just the server, username and password redacted

@carsten0407
Copy link
Author

carsten0407 commented Jul 1, 2023

AUSFÜHRLICH: Ausführen des Vorgangs "Add-Sensor" für das Ziel "XML Custom EXE/Script Sensor (Destination: SRV-BACKUP01-19.thuemlein.local (ID: 127399))".
AUSFÜHRLICH: Add-Sensor: Synchronously executing request
https://monserver.intern.de/api/table.xml?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,minigraph,sc 
hedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_parentid=127399&filter_type=exexml&username=AA_monserver-PowershellUser&passhash=xxxxxxxxxx
AUSFÜHRLICH: Add-Sensor: Synchronously executing request https://monserver.intern.de/controls/addsensor2.htm?id=127399&sensortype=exexml&username=AA_monserver-PowershellUser&passhash=xxxxxxxxxx
AUSFÜHRLICH: Add-Sensor: Synchronously executing request 
https://monserver.intern.de/addsensor5.htm?name_=XML+Custom+EXE%2FScript+Sensor&priority_=3&inherittriggers=1&intervalgroup=1&interval_=60%7C60+seconds&errorintervalsdown_=1&tags_=xmlexesensor&scriptplaceholdergroup=1&scriptplaceholder1de 
scription_=&scriptplaceholder1_=&scriptplaceholder2description_=&scriptplaceholder2_=&scriptplaceholder3description_=&scriptplaceholder3_=&scriptplaceholder4description_=&scriptplaceholder4_=&scriptplaceholder5description_=&scriptplaceholder5_=&exefil 
elabel=&exeparams_=&environment_=0&usewindowsauthentication_=0&mutexname_=&timeout_=60&writeresult_=0&anti-csrf-token=Nzc5MDJkNzE1OTAxMjdjY2U3ZTg0NzFkNmJhMWU3YzY5MjI4ODJiMzExMDI5MzFmNGY2OWE5ZTc3ZmEzZDdjNg%3D%3D&exefile=PSx64.exe%7CPSx64.exe%7C%7C&sens 
ortype=exexml&id=127399&tmpid=62
Add-Sensor : PRTG was unable to complete the request. The server responded with the following error: Nothing was selected, no sensors could be created.
In Zeile:1 Zeichen:25
+ get-device -id 127399 | Add-Sensor $param -Verbose
+                         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Add-Sensor], PrtgRequestException
    + FullyQualifiedErrorId : PrtgRequestException,PrtgAPI.PowerShell.Cmdlets.AddSensor

@carsten0407
Copy link
Author

Any updates?

@carsten0407
Copy link
Author

Strange, if I rename my wanted exefile to 1st place in alphabetical order it works. If not he always uses arcserve.exe
Any ideas?
2023-07-07 08_33_22-Window

@lordmilko
Copy link
Owner

Hi @carsten0407,

Please be advised I have managed to reproduce this error and am investigating

@lordmilko
Copy link
Owner

I couldn't see anything immediately obvious in my investigation aside from the fact PRTG uses POST to execute addsensor5.htm (PrtgAPI uses GET). This has always been the case and worked without issue; it's possible PRTG have changed things in a recent version such that GET no longer works on this endpoint. A bit of investigation/work would need to be done to try and resolve this; I am currently having medical issues so don't have the time to investigate this at the moment. I'm unable to give any ETA as to when this might be resolved

@carsten0407
Copy link
Author

carsten0407 commented Jul 17, 2023 via email

@lordmilko lordmilko added bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version and removed question Questions raised by people who don't know how to program or read the wiki :P labels Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that have been confirmed to be bugs in PrtgAPI and will be fixed in a future version
Projects
None yet
Development

No branches or pull requests

2 participants