So this is largely for the attention of Lord Milko however PRTG may be able to help. I need to add WMI Memory Sensor to PRTG for over 450 devices. How can this be achieved with API / Batch
Adding new sensors using PRTG-API
Votes:
1
5 Replies
Votes:
2
Please see Object Creation / Dynamic Parameters
Creation of arbitrary sensor types is a three step process
1. Identify the raw sensor type name
2. Create a set of sensor parameters from a single compatible device
3. Mass deploy your parameters to all desired devices
The following example demonstrates how a set of sensor parameters were derived from a Domain Controller and then deployed to all Exchange Servers
Step 1: Identify the type name
PS C:\> get-sensortype *memory* Id Name Description -- ---- ----------- dockercontainer Docker Container Status BETA Monitors the status, upt netappcdotsystem NetApp System Health Monitors CPU and memory wmimemory WMI Memory Monitors available syste wmivitalsystemdata WMI Vital System Data (V2) Monitors vital system pa ...
From the Id column we can see the type we're after is "wmimemory".
Step 2: Now create a set of parameters, optionally modifying any properties you desire
PS C:\> $params = get-device dc-1|new-sensorparameters -rawtype wmimemory PS C:\> $params wmialternative : 0 Targets : {} Source : dc-1 SensorType : wmimemory Priority : Three InheritTriggers : True InheritInterval : True Interval : 00:01:00 IntervalErrorMode : OneWarningThenDown Name : Memory Tags : {memorysensor, wmimemorysensor}
Step 3: Deploy your parameters to all desired devices
PS C:\> get-device exch* | Add-Sensor $params
Regards,
lordmilko
Votes:
0
Hello PRTG-Team.
We use the Powershell/prtgAPI to add new devices and sensors in our PRTG-structure.
The similar commands
$params = get-device dc-1|new-sensorparameters -rawtype ping
get-device exch* | Add-Sensor $params
works for years fine, since unknown period we get
new-sensorparameters : Could not authenticate to PRTG; the specified username and password were invalid
Today I start debug, but I can't find a bug
Connect-PrtgServer -Server "$prtgServer" , AUTH USER/PW , echo $? , True ... OK
get-prtgclient ... OK
get-group -id ${prtgGroupId} ... OK
get-device "${vmNameRaw}" ... OK
$params = get-device "${vmNameRaw}" |new-sensorparameters -rawtype ping , echo $? , False ... FAILS
Any idea whats doing wrong?
Thanks.
Created on Feb 24, 2023 8:51:55 AM
Last change on Feb 24, 2023 11:29:07 AM by
Felix Saure [Paessler Support]
Votes:
0
Please be advised that PrtgAPI is a third party library and is not supported by Paessler. For any issues with PrtgAPI please open an issue on GitHub
Can you please confirm what version of PrtgAPI you are using? From the sounds of things, you may be using an old version of PrtgAPI. As per this issue, this issue should be resolved in PrtgAPI 0.9.17+. If you are using a version of PrtgAPI earlier than 0.9.17, please do
Update-Module PrtgAPI
and reopen PowerShell
Votes:
0
Hello lordMilko. Thank you for your answer. Please be advised that PrtgAPI is a third party library... I know. what version of PrtgAPI you are using?... was 0.9.16. using an old version... yes. Update-Module PrtgAPI... I updated to 0.9.18. Success with the update, succes with scripting. For future I notice "https://github.com/lordmilko/PrtgAPI/issues". For today: thank you very much. Dirk
Votes:
0
I am at 0.9.18 but still get the issue.
Add-Sensor : Could not authenticate to PRTG; the specified username and password were invalid.
At line:15 char:34
+ Get-Device -Id $ParentDeviceId | Add-Sensor $params
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Sensor], HttpRequestException
+ FullyQualifiedErrorId : System.Net.Http.HttpRequestException,PrtgAPI.PowerShell.Cmdlets.AddSensor
get-command add-sensor CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Add-Sensor 0.9.18 PrtgAPI
Add comment