Page 1 of 1
Spring boot Actuator - with Nagios
Posted: Thu Apr 20, 2017 10:22 am
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.
Re: Spring boot Actuator - with Nagios
Posted: Thu Apr 20, 2017 10:25 am
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
Re: Spring boot Actuator - with Nagios
Posted: Thu Apr 20, 2017 10:37 am
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.
Re: Spring boot Actuator - with Nagios
Posted: Thu Apr 20, 2017 4:37 pm
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