LinuxMicrosoftTools

Using Xymon and BBWin to auto start failed services

I was recently informed by David you can use BBWin on a windows server to automatically restart/start a service if the status changes to red for example. So I decided to give it a try. Print Servers (the Baine of our existence) are some of the most unreliable services we run.

We run both Server 2019 Print Server along with PaperCut NG installed on it. Let’s create a rule if any of the services turn red, restart them! I already have a scheduled task each day to stop the print spooler and clear out stuck jobs but this will be a great addition especially when you’re not onsite.

How to define the services to monitor

Run Notepad or Notepad++ as an administrator and open the BBWin.cfg file.

C:\Program Files (x86)\BBWin\etc\BBWin.cfg

Scroll to the bottom and find the <svcs> (services) section. It will look like this:

<svcs>
	<!-- If true, the agent  will always report with green status -->
	<setting name="alwaysgreen" value="false" />
	<!-- If true, the agent will restart all "automatic  services" which would be stopped-->
	<setting name="autoreset" value="false" />
	<setting name="alarmcolor" value="yellow" />
	<!-- The line bellow show you svcs rules. If the "Automatic Updates" service is stopped,  it will be automatically restarted and a red status will be sent
	until the service get it's correct status 
	<setting name="Automatic Updates" value="started" autoreset="true" alarmcolor="red" />
	-->
</svcs>

At the bottom let add some new services to monitor. For this I’m going to monitor PaperCut Application Server, Papercut Print Provider, Papercut Web Print Server, and Print Spooler. Specify the alarm color and if you want to auto reset the service.

	
	<setting name="Print Spooler" value="started" autoreset="true" alarmcolor="red" />
    <setting name="PaperCut Application Server" value="started" autoreset="true" alarmcolor="red" />
    <setting name="PaperCut Print Provider" value="started" autoreset="true" alarmcolor="red" />
    <setting name="PaperCut Web Print Server" value="started" autoreset="true" alarmcolor="red" />

My svcs section now looks like this:

<svcs>
	<!-- If true, the agent  will always report with green status -->
	<setting name="alwaysgreen" value="false" />
	<!-- If true, the agent will restart all "automatic  services" which would be stopped-->
	<setting name="autoreset" value="false" />
	<setting name="alarmcolor" value="yellow" />
	<!-- The line bellow show you svcs rules. If the "Automatic Updates" service is stopped,  it will be automatically restarted and a red status will be sent
	until the service get it's correct status 
	<setting name="Automatic Updates" value="started" autoreset="true" alarmcolor="red" />
	-->
	
	<setting name="Print Spooler" value="started" autoreset="true" alarmcolor="red" />
    <setting name="PaperCut Application Server" value="started" autoreset="true" alarmcolor="red" />
    <setting name="PaperCut Print Provider" value="started" autoreset="true" alarmcolor="red" />
    <setting name="PaperCut Web Print Server" value="started" autoreset="true" alarmcolor="red" />

</svcs>

Save it!

Testing it out

Stop one of the services and go check out the services page in Xymon for that server.

Stopped one of the services

Xymon now shows one of the services as not running and red.

Xymon noticed the service is not running and will automatically restart the service

Give it a minute and the service should AutoStart. Then a few minutes for Xymon web interface to report it back to green.

Xymon reporting green after successfully auto restarting the service.

Done!

Show More

Cory Fiala

Technology and outdoor enthusiast. Currently the sole systems administrator for a local K-12 school district with 800+ staff and 5,500+ students. I support windows servers, Linux systems (FreeBSD and Ubuntu), along with vSphere (4 node cluster). 60+ virtual machines and 8 physical servers. This doesn't include my personal homelab.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button