What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Adding new sensors using PRTG-API

Votes:

1

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

api lordmilko prtg-api wmi

Created on Apr 13, 2018 11:37:05 AM



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

Created on Apr 13, 2018 12:55:07 PM



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

Created on Feb 24, 2023 12:08:39 PM



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

Created on Feb 28, 2023 11:04:02 AM



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 

Created on Sep 13, 2023 11:28:18 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.