Three must-have Nagios services for your Minecraft server
Is the server alive?
A simple check on the TCP port should do it. We additionally want performance data for drawing graphs. Add this to your /etc/check_mk/mrpe.cfg:
mc_server /omd/sites/nagios/lib/nagios/plugins/check_tcp -H www.erschaffe.de -p 25565 -w 5 -c 10
The bad thing is that sometimes the server crashes but still returns STATE_OK. I might sometimes find out more about the protocol used in Minecraft for trying to talk with the server.
How big is my world?
I’m using the script CheckDirSize V1.1 for checking directory size of the world used by the server. It also provides performance data, see the server stats page for an example.
mc_world_size /omd/sites/nagios/lib/nagios/plugins/check_dirsize11.sh -d /home/minecraft/minecraft/world -w 8000000 -c 10000000 -f
Everything’s right in server.log?
There’s a wonderful plugin made by Gerhard Lausser: check_logfiles. It has some nice features. For example, you can specify several logfiles to be monitored by one service, with different search patterns for providing warning and critical states. Another thing I like about it is the sticky option: When a ‘bad’ pattern is found, the service switches to warning or critical state. But, when no error is occuring any more in the time period you specified with ‘sticky’, the service goes back to OK state. One mighty plugin, shame on me that I’m using only a very small portion of all its features!
mc_serverlog /omd/sites/nagios/lib/nagios/plugins/check_logfiles --config /omd/sites/nagios/check_logfiles.cfg
And the config file:
@searches = (
{
tag => 'mc_server.log',
logfile => '/home/minecraft/minecraft/server.log',
criticalpatterns => 'SEVERE',
warningpatterns => 'WARNING',
options => 'sticky=600, perfdata'
},
{
tag => 'mc_service.log',
logfile => '/home/minecraft/minecraft/service.log',
criticalpatterns => 'SEVERE',
warningpatterns => 'WARNING',
options => 'sticky=600, perfdata'
},
);
I think with those three pretty simple services a Minecraft admin is able to monitor very important things. Small effort, great results.. What do you think?
Posted in Nagios
