As a test I'm trying to use the included "Demo EXE Notification - OutFile.ps1" in a custom notification. The script runs fine manually (at the PS 32bit console).
This script needs a file as an argument "c:\temp\test.txt", the folder exist. I set the local admin account to run the script, left the domain/machine field empty.
I set powershell 32 bit to run unrestricted.
I got this error in the log:
Error sending "EXE": Error1. MYSERVER : The term 'MYSERVER' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 ch[...]
Why is it trying to use my server's name as a ps cmdlet? Nothing in the script even uses the machine name.
Also a question about notifications running exe.
I understand that the Probe themselves does not have a notifications folder. So all the programs are located on the server?
Does the server copy the script to the probe and run it locally?
Thanks!
Article Comments
Slightly modified Demo file below. The parameter I use is: "c:\temp\test.txt" "reason ". I have used no quotes, single quotes, etc. Same result.
>Notifications and exe notifications are send only from the core server not from remote probes.
So how do we grab information of a device that breached a threshold? For example: CPU over 80, send notification, notification runs script to get some info(top processes that consumes CPU, etc.) from that trouble device.
How do we do this if the script is run on the server? Use WMI ? What does the Probe do in the context of notifications running scripts. Nothing?
Thanks!
(again, this script works when run normally on a 32 bit PS console)
if ($Args.Count -eq 0) { #No Arguments. Filename must be specified. exit 1; }elseif ($Args.Count -eq 2){ Write-Host "here's arg 0: $($args[0])" Write-Host "here's arg 1: $($args[1])" $Path = split-path $Args[0]; if (Test-Path $Path) { $Text = "{0:D}" -f (Get-Date); $Text+" "+$Args[1] | out-File $Args[0]; exit 0; }else { # Directory does not exist. exit 2; } }
Aug, 2016 - Permalink
Well you need to retrieve the values manually in the script, using Get-WMIObject or Remote Powershell. PRTG can't provide the metrics at real time when a notification is triggered.
Aug, 2016 - Permalink
Hello,
Could you please forward us your script to Supportpaessler.com for analysis? Which parameter you are using for the notification exe? Please refer to this kb post.
Notifications and exe notifications are send only from the core server not from remote probes.
Aug, 2016 - Permalink