I would like to create a report which includes the notifications (like a custom speed trigger) and the downtime of a sensor. I have searched the help, forums and knowledge base, but there doesn't appear to be a template to generate the report. Is there some way to create such a report?
How can I create a report about the notifications, alarms and downtime of a sensor?
8 Replies
Add an extra action to every notification
1. Create a batch file
Create a batch file in the notifications/exe subfolder of your PRTG installation call it Logging.bat and paste the following code.
@echo off echo %date% %time% %~1 >> "c:\temp\%date%.txt"
2. Modify every notification
Next, set every existing notification to also execute a program and select Logging.bat
In the parameter section make sure to have double quotes at the start and end, reading it like:
"[%sitename] %device %name %status %down (%message)"
You can of course use any fixed text and placeholders you like:
"This is the email notification to John %device %status"
3. Finished
By adding this action to every existing notification, the existing notification will do the logging for you and write the output into a daily based file in the c:\temp folder of your PRTG server.
Created on Aug 18, 2010 6:43:47 PM by
PRTG Tools Family [prtgtoolsfamily.com]
(13,413)
●3
●4
Last change on Aug 23, 2010 8:07:52 AM by
Daniel Zobel [Product Manager]
good morning
I tried running the bat file a notice and not working. However if I run on the server if it works.
What can be wrong?
Thanks
I have followed the steps on this but dose not seem to work at all will this work on version PRTG 15 ?
What version of PRTG are you using? Did you use "[%sitename] %device %name %status %down (%message)" (including the quotes) as parameter? Otherwise, it won't work.
Sorry to revive old thread... I am trying to get this to work in PRTG 18.2.41.1591 and I get the following error when I try to test the notification:
Error sending "EXE": Access violation at address 000000000040E8F5 in module 'PRTG Server.exe'. Read of address FFFFFFFFFFFFFFFF
Here's the full contents of the .bat file:
@echo off echo %date% %time% %~1 >> "c:\BranchStatusLog\BranchStatusLog.txt"
Here's the Parameters field of the notification:
"[%sitename] %device %name %status %down (%message)"
Created on Jun 28, 2018 1:23:32 PM by
Curtis
(10)
Last change on Jun 29, 2018 10:48:45 AM by
Stephan Linke [Paessler Support]
Are you using a specific user account in the notification to execute the batch file? You could also use the following PowerShell script:
param( [string]$sitename = "www.paessler.com", [string]$device = "My Testdevice", [string]$sensor = "SNMP Traffic INET", [string]$message = "The traffic for this interface is unusually high for this day of the week", [string]$lastValue = "422344 kbit/s", [string]$status = "Unusual", [string]$downtimesince = "" ) $logfilePath = "c:\temp\$($sitename).$($device).$($sensor).log" ([string]::Format("[{3}] STATUS: {0} - LAST VALUE: {1} - LAST MESSAGE: {2} - DOWN SINCE: {4}",$status,$lastValue,$message, (Get-Date),$downtimesince)) | Out-File -Append $logfilePath
The parameter field needs to look like this:
'%sitename' '%device' '%sensor' '%lastmessage' '%lastValue' '%status' '%downtimesince'
It'll then log to C:\temp. Please check the following for PowerShell based notifications and sensors: https://kb.paessler.com/en/topic/71356-guide-for-powershell-based-custom-sensors
Kind regards,
Stephan Linke, Tech Support Team
I've used both the bat suggested at the top, and the powershell at the bottom. PRTG shows the exe being successful with both, but for the bat, I get no output in c:/temp (or anywhere else I try to send it), and for the powershell script, I only get an output when I send test notification. Has anyone improved this, or is there a better option at this point?
Hello,
Thank you for your message.
To troubleshoot the issue, I invite you to write the exception of the script (in case an error occurs but is not visible in PRTG) by using Try Catch:
param( [string]$sitename = "www.paessler.com", [string]$device = "My Testdevice", [string]$sensor = "SNMP Traffic INET", [string]$message = "The traffic for this interface is unusually high for this day of the week", [string]$lastValue = "422344 kbit/s", [string]$status = "Unusual", [string]$downtimesince = "" ) try{ $logfilePath = "c:\temp\Log_$($sitename).$($device).$($sensor).log" ([string]::Format("[{3}] STATUS: {0} - LAST VALUE: {1} - LAST MESSAGE: {2} - DOWN SINCE: {4}",$status,$lastValue,$message, (Get-Date),$downtimesince)) | Out-File -Append $logfilePath } catch { "$($_.exception.message) At line : $($_.InvocationInfo.ScriptLineNumber)" | Out-File -Append $logfilePath }
You can replace configure a new path for the debug file as well.
Then, create a new device on which you configure a Ping sensor with the appropriate notification trigger. When you have done that, simulate an error on the sensor by using the contextual menu > Simulate Error Status, and check if there is you get a message in the file.
Regards.
Created on Jun 21, 2021 12:43:38 PM by
Florian Lesage [Paessler Support]
Last change on Jun 21, 2021 12:44:47 PM by
Florian Lesage [Paessler Support]
Add comment