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

Notifications does not run EXE

Votes:

0

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!

custom-script-exe notifications prtg

Created on Aug 4, 2016 5:03:54 PM



3 Replies

Votes:

0

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.

Created on Aug 5, 2016 11:54:09 AM by  [email protected]



Votes:

0

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;
  }
}

Created on Aug 5, 2016 1:57:29 PM

Last change on Aug 8, 2016 11:43:06 AM by  [email protected]



Votes:

0

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.

Created on Aug 9, 2016 7:23:36 AM by  Stephan Linke [Paessler Support]




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.