How to monitor a new device with rest api?

Hi, I am new to icinga2. I pull the docker image and run it, I add a host with hostalive check as icinga2 doc. But I do not understand it.

  1. I want to monitor a router which has restapi(get interface speed, link status, and so on), need I to write a plugin to call the rest api on the router?
  2. I see 2 parts about rest spi in icinga2 doc, the first is manage configuration objects and resources(https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/,it seems not about call rest api on monitored device), the second is ‘Agents sending Check Results via REST API’(Agent Based Monitoring - Icinga 2) , I do not understand it, is there some example?
  3. If I add a new plugin(get interface speed on monitored device ), I need to process the result and modify icinga2 web, show it on icinga2 web finally?
  4. I see the icinga web get data from database, then. Or should I get data from database on the monitored device directly(store interface speed in database)?
    Is there some example or instruction?Thanks a lot!

Icinga2 can only monitor other things with plugins.

you can also use icinga compatible plugins like nagios checks:

fire up your bash and check if these plugins satisfy your needs.

or google for the device and check if someone has created such a check

If there is no such check, you have to write your own check in any programming language you are familiar with and your script / program should return with the following exitcodes:
https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#check-result-state-mapping
and print something like “[CRITICAL] YOUR MESSAGE”

If your check is ready you can decide how do you want to mange the checks.
config files or icinga director

depending on that you add the command, and the service to the icinga2 config and your check should run

2 Likes