Hello,
is there a way to make PRTG create a logfile and record there all the "execute program" calls so that it would show the commands as they were used in the notifications? Sometimes the notification fails but when I run the notification script with exactly the same command line including all the populated variables, it doesn't fail.
Article Comments
I was not asking for error messages returned by the application started by PRTG. I was asking for the whole call, i.e. full command that was executed by PRTG.
The thing is that PRTG's variables may contain some special characters that may have a special meaning for particular applications that are started by PRTG. And once the command is issued, the parameters containing these special characters may be parsed differently. Imagine e.g. how unexpected quotation marks may change the meaning of issued command. Such command won't necessarily fail, it will just be a different command than the one which was meant to be issued.
This brings me to escaping special characters. Can you provide some way how to make sure that some special characters contained in your variables will be escaped as needed by the application that is triggered by notifications?
Apr, 2017 - Permalink
Hi there,
The PRTG Server executes the executable as in the following example:
'Notification.ps1 -parameter1="1234" -parameter2="5678"' |
So it is better to put the values of a parameter into double-quotes as the whole call be escaped with single quotes.
Additionally, please have a look at the following sites to debug this kind of notification:
https://helpdesk.paessler.com/en/support/solutions/articles/76000063264
https://helpdesk.paessler.com/en/support/solutions/articles/76000065185
Best regards.
Apr, 2017 - Permalink
Well, this doesn't handle the situation in which some of the PRTG variables contain characters like quotation marks. In such case, only part of the parameter would be received by the script.
Apr, 2017 - Permalink
Hi there,
If a parameter has double quotes, then use single quotes to escape the double quotes. Maybe you can give me an example of your parameters with special characters so I can test this in our test-environment to give you a more precise answer how you can escape them. :)
Best regards.
Apr, 2017 - Permalink
Hi there,
What error messages or log infos do you get under "Logs > System Events > Notifications"? There you should see the error message that is thrown by the EXE file.
Apr, 2017 - Permalink