Keep Grafana Windows Service running 24/7 with Service Protector

How to Keep your Grafana Windows Service Running 24/7 with Service Protector

Automatically restart Grafana whenever it stops, crashes or has trouble serving web requests. Ensure that your visualization subsystem is always available.

Grafana is a popular open-source analytics/visualization platform.

Version 7.0 and later can be installed as a Windows Service, to start automatically whenever your computer boots:


To monitor & protect Grafana with Service Protector:

  1. If necessary, download and install Grafana. We recommend using the Windows MSI installer, which has the option to set up Grafana as a Windows Service. (You have to configure the service manually if you download and extract the zip file.)

    After installation, make sure everything works as expected:

    Grafana Installation Home Page

  2. Download and install Service Protector, if necessary.

  3. Start Service Protector.

  4. Select Protector > Add to open the Add Protector window:

    Add Protector

  5. On the General tab, in the Service to protect field, select the Grafana windows service:

    Grafana Windows Service: General Tab

  6. To monitor and restart Grafana if it stops serving HTML pages (at http://localhost:3000), switch to the Monitor tab. We'll set up a failure detection batch file to detect when the Grafana web server has failed.

    1. Follow these instructions to create the failure detection BAT file. We have called ours check-grafana-web-server.bat and placed it in the Service Protector installation folder (C:\Program Files (x86)\ServiceProtector).

      Check Web Server Batch File

    2. Click the "..." button in the Whenever it fails a "sanity check" section to bring up the Configure Sanity Check window.

      Specify the full path to the batch file in the Run field.

      And change the Every controls to a frequency that works in your environment. More time means less frequent checks and less load on the server but with a reduced sensitivity to failures. 5 minutes is good for us:

      Configure Sanity Check

    3. Click the OK button to save your settings.

    Here's what the Monitor tab should look like when you're done:

    Grafana Windows Service: Monitor Tab

  7. Click the Save button to record your settings. In a few seconds, a new entry will appear in the Service Protector window.

    The green shield indicates that Service Protector is already actively monitoring Grafana to detect failures:

    Grafana Windows Service: Protected

  8. That's it! Next time your computer boots, Grafana will start automatically and Service Protector will babysit the service to promptly restart it if it terminates for any reason.

    We encourage you to edit your Grafana entry in Service Protector and browse through the many other settings that may be appropriate for your environment. For example, send an email when the service fails, schedule a regular restart to cure memory leaks, and much more.



Trouble protecting the Grafana Windows Service?