Keep the Telegraf Windows Service running 24/7 with Service Protector

How to Keep the Telegraf Windows Service Running 24/7 with Service Protector

Automatically restart Telegraf when it stops for any reason. Survive crashes, accidental shutdowns and avoid costly downtime.

Telegraf is an open source server-based agent that collects and sends metrics and events from databases, systems, and IoT sensors. Telegraf installs as a native service on Windows, to start whenever your server boots:

To protect the Telegraf Windows Service with Service Protector:

  1. Download and install Telegraf as a service, if necessary

  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, choose Telegraf Data Collector Service.

    You will notice a green circle on the left if Telegraf is already running, as was the case on our server:

    Telegraf Windows Service: General Tab

  6. Do you find that Telegraf runs into trouble when it uses too much memory? If so:

    • Switch to the Monitor tab

    • Check the Whenever its memory usage exceeds box

    • In the field on the right, enter a suitable memory threshold (in Megabytes). We've entered 200 MB:

    Telegraf Windows Service: Monitor Tab

  7. Click the Save button. In a few seconds, an entry for Telegraf will show up in the Service Protector window. The service is already being protected from failure, as evidenced by the green shield:

    Telegraf Windows Service Protected

  8. That's it! Next time your computer boots, Telegraf will start automatically and Service Protector will watch the service to quickly restart it if it exits for any reason.

    We encourage you to edit Telegraf in Service Protector and check out the many other settings that may be appropriate for your environment. For example, send an email when the service fails, guard against runaway CPU use, restart the service weekly to avoid memory leaks, and much more.



Trouble protecting the Telegraf Windows Service?