Hi,
1. I set up a notification using Execute Program. The Parameters is:
%probe %group %device %name %sensorid %status %down %message
2. The code of powershell script:
$outfile = "C:\PRTGtoZendesk\ha.txt" for ($i=0; $i -lt 8; $i++) { $newline = "hello " + $args[$i] + "`n" Add-Content $outfile $newline }
3. I selected "Send test notification", then opened the file "C:\PRTGtoZendesk\ha.txt". The result was:
hello %probe
hello %group
hello %device
hello %name
hello %sensorid
hello %status
hello %down
hello %message
So my question is: how can I transfer the values of the placeholders to the powershell script ?
Thanks.
Article Comments
Hi, The problem here is the values of %probe, %group, %device, ... are not transferred to the powershell script. Instead, it transfer the string "%probe", "%group", "%device", ... to the powershell script.
E.g. it should be "hello 1234" instead of "hello %sensorid" in the text file.
Jul, 2020 - Permalink
Hi,
In this case, how do you tried to test this connection? A test notification (triggered via the bell icon in PRTG), no placeholders are translated since no real values are provided by any device or sensor. For a real test, you can configure a state trigger in one sensor and then trigger a "Simulated Error" via the context menu of the Sensor.
Jul, 2020 - Permalink
Hi there,
Please note that the placeholders are resolved and transmitted according to their order. Therefore, you need to configure the same amount of parameters in you script as transferred:
Notification template: %probe %group %device %name %sensorid %status %down %message
Script: $para1 $para2 .....
Afterwards, the parameters are filled with the resolved placeholders.
Jul, 2020 - Permalink