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

Batch file not running in PRTG custom notifications script

Votes:

0

We have a application that occasionally will need its apache tomcat9 service/process restarted... but it doesn't restart cleanly unless we also restart the mysql database along with it. We have the html sensor monitoring the webpage , so whenever it becomes inaccessible we can go restart the services manually. I thought about using the WMI service sensor for apache tomcat, but the issue is that often when the webpage hangs, the service itself is still 'started' so it won't always be reliable in determining when the webpage is hung and needs a restart. So it seems a custom notification script would work best. I created a simple batch file that when I run on my local match it works on the application server as desired, but when I put this in the PRTG core server notificaiton/exe location and set the customized notification in the html sensor to run the batch file when the html sensor detects failure, it doesn't do its job. Is there anything i'm missing or some other permissions that need to be set to get this to be working? there is nothing wrong with the batch file itself and works 100% when ran manually but just when tied to html sensor as custom script notification it doesn't do anything at all.

batch-file custom-html custom-notification custom-script-exe custom-sensor html

Created on Jan 9, 2019 2:41:02 AM



4 Replies

Votes:

0

Hello bochenlonestar,

thank you for the KB Post. Just to check if I understood things correctly. You can run the script on the PRTG host, and it does have connection code in it, so that it does restart Apache&MySQL on the remote target, right?

And when you do this (on the PRTG host) manually from CMD with your (admin?) account it works fine too?

Does it work if you just only test the Exe-Notification from within PRTG (without tying it to the HTTP-Sensor)?

best regards.

Created on Jan 9, 2019 1:10:57 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Hello bochenlonestar,

Is there anything in your batch file that interacts with the desktop, like popping up a window?


Sensors | Multi Channel Sensors | Tools | Notifications

Kind regards,

[[http://prtgtoolsfamily.com]] PRTGToolsFamily

Created on Jan 9, 2019 2:34:44 PM



Votes:

0

No, its just a bunch of dos commands like

Taskkill /S appserver2016 /IM tomcat9.exe /t /f timeout /t 2 /nobreak sc
appserver2016 stop Tomcat9 timeout /t 2 /nobreak sc
appserver2016 stop MySQL5 timeout /t 3 /nobreak sc
appserver2016 stop QMSI timeout /t 3 /nobreak sc
appserver2016 start MySQL5 timeout /t 3 /nobreak sc
appserver2016 start QMSI timeout /t 3 /nobreak sc
appserver2016 start Tomcat9 exit

etc

It runs on the Windows Server 2016 (both the prtg core server and the remote /target application server itself)

Anything I need to add to get it to work? I can run it manually on my own workstation endpoint just fine. (Windows 10 1809)

Created on Jan 9, 2019 2:45:55 PM



Votes:

0

  1. Does it work when you run it on the PRTG Host?
  2. Does it work if you just only test the Exe-Notification from within PRTG (without tying it to the HTTP-Sensor)? If 1. yes, and 2. no, check the account under which the PRTG Core Service runs, often the LOCAL SYSTEM account does not have permissions to connect into the network / remote machines, and running the Core Service, for example under your account should fix this.

Created on Jan 9, 2019 2:56:58 PM by  Torsten Lindner [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.