New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Http Sensor that triggers www service restart

Votes:

0

Your Vote:

Up

Down

I have a website that runs internally on a windows IIS server. Sometimes the site stops responding. I have an HTTP full page load sensor and I have a wmi w3svc service sensor. Is there a way to have a failure on the HTTP sensor trigger a w3svc service restart?

http iis restart-service

Created on Jun 20, 2014 1:43:58 AM by  lkepford (0) 1



Best Answer

Accepted Answer

Votes:

1

Your Vote:

Up

Down

Ok, I have to admit that although my previous answer in theory will work, there are some point left for improvement:

  • Check if the service really stops and starts.
  • Timeout between stopping and starting the service.
  • Error handling.
  • As the PRTG service by default runs under the local system account, it cannot rerstart services on a remote computer.

The above has been integrated into Custom Notification PTF.ServiceRestart

PTF.ServiceRestart allows you to (re)start a service on a (remote) computer and takes the following parameters:

-c= The hostname or IP of the computer running the service.
-s= The name of the service to restart.
-u= Optional the domain\username of an account that is allowed to restart the service.
-p= Optional the password or PassHash(*) of an account that is allowed to restart the service.
-t= Optional the number of seconds for the service to stop and start.
 (Default = 15 sec)

PTF.Servicerestart can be downloaded from http://PRTGToolsFamily.com/?page=downloads_notifications

Created on Jun 20, 2014 1:14:13 PM by  PRTG Tools Family [prtgtoolsfamily.com] (12,915) 3 4



4 Replies

Votes:

0

Your Vote:

Up

Down

How about having a .bat file as a notification?

Create a new .bat file in the "\Notifications\EXE" folder of your PRTG installation and paste the content below.

@echo off
rem stop service
sc <server> stop <service name>
rem start service again
sc <server> start <service name>

Replace <server> and <service name> with the actual names of the server running the service and the service name. Next create a new notification, set this notification to execute a program and select the .bat file you created.

Created on Jun 20, 2014 10:40:26 AM by  PRTG Tools Family [prtgtoolsfamily.com] (12,915) 3 4



Accepted Answer

Votes:

1

Your Vote:

Up

Down

Ok, I have to admit that although my previous answer in theory will work, there are some point left for improvement:

  • Check if the service really stops and starts.
  • Timeout between stopping and starting the service.
  • Error handling.
  • As the PRTG service by default runs under the local system account, it cannot rerstart services on a remote computer.

The above has been integrated into Custom Notification PTF.ServiceRestart

PTF.ServiceRestart allows you to (re)start a service on a (remote) computer and takes the following parameters:

-c= The hostname or IP of the computer running the service.
-s= The name of the service to restart.
-u= Optional the domain\username of an account that is allowed to restart the service.
-p= Optional the password or PassHash(*) of an account that is allowed to restart the service.
-t= Optional the number of seconds for the service to stop and start.
 (Default = 15 sec)

PTF.Servicerestart can be downloaded from http://PRTGToolsFamily.com/?page=downloads_notifications

Created on Jun 20, 2014 1:14:13 PM by  PRTG Tools Family [prtgtoolsfamily.com] (12,915) 3 4



Votes:

0

Your Vote:

Up

Down

Thanks so much for your help. I believe this is exactly what I need. I have downloaded the notification, however, I do not see any instructions for implementing. I understand that I need to place the exe in the correct folder on my PRTG server, but what then how is the notification configured?

Created on Jun 24, 2014 4:37:32 PM by  lkepford (0) 1



Votes:

0

Your Vote:

Up

Down

The .exe needs to be copied to the '\Notifications\EXE' folder of your PRTG installation.

Next, setup a new notification and choose to 'Execute Program'. Select the ServiceRestart.exe and provide the parameters as explained above.

You can also double click the .exe for a listing of parameters supported.

Tip: before implementing the notification, run to .exe from the command line (including its parameters) to make sure you go the parameters correct.

Created on Jun 25, 2014 10:06:44 AM by  PRTG Tools Family [prtgtoolsfamily.com] (12,915) 3 4



Please log in or register to enter your reply.


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.