I can read a sensors last value without any problems, however I need to fetch the value which would trigger a notification. What api call would I make? Please help. Thanks


Article Comments

Hi,
what precise field do you want to access in the sensor? The limits?
Best regards


Oct, 2012 - Permalink

It is a Threshold Trigger "When x channel is Above y for at least 60 seconds perform Email to all members of group xxx"

How can I get this value of this trigger notification?


Oct, 2012 - Permalink

Hi,
I'm afraid it is not possible to get this value via the PRTG API. Sorry.
Best regards


Oct, 2012 - Permalink

This was a question of October 2012. Now it is March 2016. Maybe in the latest version of PRTG possible?

We want to have an overview of sensors that are configured to send a mail and the ones that are nog configured to do so. An we want to kno is a mail is sent, to who.

So I think this should be done using the api to export the next information of each sensor: (inherited of on the object itself) It is a Threshold Trigger "When x channel is Above y for at least 60 seconds perform Email to all members of group xxx"

is this possible to use api/getobjectproperty.htm?id=<sensorid>&name=<?>

what would be used as name here?


Mar, 2016 - Permalink

Hi,
still not possible. Sorry.
Best regards


Mar, 2016 - Permalink

Using the ChannelLimits tool from http://prtgtoolsfamily.com/downloads/tools you can get an overview on how your channel limits are set.


Mar, 2016 - Permalink

My Powershell module will let you access the limits and thresholds of any sensor / channel combo.

Read more about it here: https://thedomainiown.wordpress.com/prtg-related/prtg-script-powershell-admin-module/

Change log last week was:

2016/3/15

  • Added Get-PRTGSensorData, for getting historical data.
  • Added Get-PRTGChannelSettings for getting settings like channel thresholds / limits
  • Added Set-PRTGChannelSettings for setting settings like channel thresholds / limits
  • Added Get-PRTGSensorChannelPrediction used for estimating when a sensor will reach a certain limit. For example, days until disk is full.

The functions are rather new, and not part of the official PRTG API, so be warned that it might stop working at any time. I also don't have an example that uses the Get-PRTGChannelSettings function yet.

A full list of function is here: https://thedomainiown.wordpress.com/prtg-related/prtg-relatedprtg-admin-module-function-list/


Mar, 2016 - Permalink

WARNING: THIS IS NOT USING THE API AND MAY CHANGE AT ANY TIME
Edit by Paessler Support: This script comes without any support.

#This is powershell
$DeviceID = 2034
$ChannelID = 2
$auth = "username=api_access&passhash=1234567890"
$PRTGHost = "192.168.0.89"

$url = "http://$PRTGHost/controls/channeledit.htm?_hjax=true&id=$DeviceID&channel=$ChannelID&$auth"
    
$request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
$ret = $request.AllElements | select name,value | where {$_.name -like "*_*"}
foreach ($line in $ret)
{
  $line.name = $line.name -replace "_$ChannelID",""
}
$ret

This returns the following:

name                   value
----                   -----
customunit             Days 
factorm                1    
factord                1    
valuelookup                 
showchart              1    
showchart              0    
show                   1    
show                   0    
colmode                0    
colmode                1    
color                       
linewidth              1    
percent                0    
percent                1    
ref100percent               
ref100percent_factor   1    
avgmode                0    
avgmode                1    
avgmode                2    
decimalmode            0    
decimalmode            1    
decimalmode            2    
decimaldigits          2    
spikemode              0    
spikemode              1    
spikemax                    
spikemax_factor        1    
spikemin                    
spikemin_factor        1    
axismode               0    
axismode               1    
axismax                     
axismax_factor         1    
axismin                     
axismin_factor         1    
limitmode              0    
limitmode              1    
limitmaxerror               
limitmaxerror_factor   1    
limitmaxwarning             
limitmaxwarning_factor 1    
limitminwarning             
limitminwarning_factor 1    
limitminerror               
limitminerror_factor   1    
limiterrormsg               
limitwarningmsg             

Tested with version 16.1.22.2391


Mar, 2016 - Permalink

You can retrieve the properties of a notification trigger (including the thresholds at which the trigger activates as well as the name of the Notification Action that will be triggered) via the Get-NotificationTrigger cmdlet of PrtgAPI

C:\> Get-Sensor -Id 1001 | Get-NotificationTrigger

Type      ObjectId SubId Inherited ParentId Latency Condition Threshold Unit       OnNotificationAction
----      -------- ----- --------- -------- ------- --------- --------- ----       --------------------
State     1        1     True      0        600     Equals    Down                 Ticket Notification

The Get-NotificationTrigger cmdlet will list all triggers defined on an object, both inherited as well as explicitly defined. You can see all the properties you can interface with by piping to Format-List.


Feb, 2018 - Permalink

H. 4 years late, 2022. Any changes, can this functionality be used via the official PRTG API?


Nov, 2022 - Permalink

Hello Anca,

We are currently working on a new web interface that comes with a new version of the API.
With the new API we aim to have everything accessible in the web interface also accessible in the API.

To read more about our new web interface, the included new API and how to use it already is described in our blog post here: https://blog.paessler.com/paessler-prtg-brings-an-entirely-new-user-experience-with-brand-new-ui


Kind regards,
Johannes Beyerlein, Technical Support Team


Nov, 2022 - Permalink