Spring boot Actuator - with Nagios

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Nags007
Posts: 58
Joined: Wed Mar 08, 2017 12:32 pm

Spring boot Actuator - with Nagios

Post by Nags007 »

Hi Team,
Please provide the complete setup / configuration process for - Monitoring Java EE Microservices with Spring Boot Actuator ?
Would like to have basic examples with Spring Boot Actuator for Nagios ?

Thank you,
Nag.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Spring boot Actuator - with Nagios

Post by tmcdonald »

I can't say that is something we have documentation for, letalone a complete setup and configuration guide.

I was able to find a Python plugin someone wrote, but it seems pretty rudimentary: https://gist.github.com/jonmcewen/50c57c4753224735f9dd
Former Nagios employee
Nags007
Posts: 58
Joined: Wed Mar 08, 2017 12:32 pm

Re: Spring boot Actuator - with Nagios

Post by Nags007 »

Thanks Donanld.

I can see : springboot.py with below code.
============================================================
#!/usr/bin/env python

import requests, sys, getopt

try:
opts, args = getopt.getopt(sys.argv[1:], "p:", ["port="])
except getopt.GetoptError:
print('springboot.py -p <port>')
sys.exit(2)

for opt, arg in opts:
if opt == '-h':
print('springboot.py -p <port>')
sys.exit()
elif opt in ("-p", "--port"):
PORT = arg

try:
resp = requests.get('http://localhost:{PORT}/health'.format(**locals())).json()
except:
print sys.exc_info()[0]
sys.exit(2)

if resp['status'] == 'UP':
print "OK"
sys.exit(0)
else:
print "FAIL!"
sys.exit(2)

===================================================================

How can i make use of this python script to verify the Spring boot with Nagios ? can you please provide any basic example of using Spring boot actuator with Nagios ?

Thanks,
Nag.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Spring boot Actuator - with Nagios

Post by tmcdonald »

We don't use Spring Boot in-house so we don't really have any prepared documentation, but looking at the plugin it seems you would run it like so according to the help output:

./springboot.py -p <port>

So you would just replace <port> with whatever the port is. 8080 seems to be the default from what I am reading.

Then once you have the plugin working, you will need to create a command for it, then use that command in a service definition. This doc is a good intro to the process: https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Former Nagios employee
Locked