I've done something similar.
In my case, my Java application received http requests from the Nagios system and returned the responses in pre-defined folders, so that Nagios could display them.
When a request was received by the application, it raised the status of the monitored resources and sent the response to Nagios.
If you use this mechanism, there are 3 things to consider:
What kind of monitoring should be done? With alarm in case of
problems in monitored resources? Read only status on
resources?
Response time of monitored requests has to be relatively small, so there is no http timeout since Nagios works synchronously.
Response type being returned to Nagios:
- should contain all data already ready so that Nagios does not need to calculate anything.
- It should also contain readable and understandable messages for end users.
I hope I was clear enough and could have helped.
If you have questions, do not hesitate to write them.