Question

New device Monitoring

  • 31 May 2023
  • 1 reply
  • 55 views

Badge

Hi All,

 

We have a h5 device and hosted website which  records the status of different devices and creates graphs like proxy graph etc.

I need to create new template to add this h5 device to monitoring to check CPU+Memmory+Ping OS.

Also need to check the website availability and the graph status from the website where the graph refers the different status of devices which are added in this H5 monitoring website.Graph status need to be categorized for threshold to critical and Warning so that in future this can be used to generate alert when the value reaches above the graph value consider as threshold.

 Is this monitoring can be enabled using API in centreon?


Also, please provide details  :

- if it's possible to request with REST API to the H5 device ?
- if yes :  how to proceed ?
- Does Centreon accept answer with JSON ?
 


1 reply

Userlevel 5
Badge +14

hello

the answer is long, and is generic, TL;DR : you need to code your own plugin if the thing you want to monitor has an API, and sorry if I repeat myself a lot below

 

- Does Centreon accept answer with JSON ?

=> as the result of a check : no, every command you will run with centreon has to output data in a specific way, I can’t find the documentation right now, but if you don’t use the “centreon plugin” method you need to make command that will need to respect this output and exit with an error code that represent the status OK/WARNING…

edit : found the doc Plugins development guidelines | Centreon Documentation

working with json is possible of course, but that will be the job of the check command to work with the json to produce an output

 

- if it's possible to request with REST API to the H5 device ? 

=> what is a H5 device? and does it have Rest API? you need to find that before going further

google show me some audio recorder or a biometric security handheld device, I will assume it’s the later, when you talk about hosted website, do you mean the devices are connected to a management server that has an interface and this is a public website? if it’s that, then you need to check the documentation of your solution and see what this solution propose as api or method to query the data

That’s a question for you and you vendor basically. they may have available documentation on how to login to the api (really important) and what the api can give you 

if the data is not there, you can stop here, there will be nothing more (maybe webscrapping the web page with some python scrapping voodoo will be your solution)

 

- if yes :  how to proceed ?

=> assuming there is an api (whatever the method it is) you now need to code, there are no magic way to consume an API in centreon directly (they made a sql and snmp generic plugin, but the reason is that the method to authenticate is known… Rest API authentication is more like the wild wild west)

 

so to code the thing that will consume the API, you can make a simple curl and awk your way in bash, make python scripts, or go the hard way and learn the centreon developper guideline to code in perl and add your plugin to the community, but in every case something need to be interfaced between the third party api and the consumer (centreon)

if you go the script way, you need to respect the output I wrote above,

if you want to code a real centreon plugin here is a start Develop with centreon-plugins | Centreon Documentation . this has a tutorial specifically on how to consume a json from a website and do stuff with the output, looks like that’s what you want, and you are ok with perl

 

there is a big misconception with word “api”, API is a way for a provider to say “here is my data, don’t bother me anymore, code your own app that suits your need” 

the centreon API is a way for you to code an app that will manage host or get info from centreon.

Centreon will not consume an API. a plugin might.

the H5 API (if it exist) will give you information on your device, and probably the raw data of the graph you mentionned (maybe)

so the centreon api is not what you need (unless you want to automatize the adding and removing of the H5 device from centreon maybe, you will need to code something that will periodically check the h5 api and do stuff in centreon)

 

Consuming a API needs coding. 

 

and finally, if you can’t code or have no developper in your company, you can try to contact centreon and ask for a specific development providing you can give them access to the device remotely or the website is on the web and you can provide them with login, and probably buy work days (don’t quote me on this I’m not working there, I’ll let a Centreonian correct me)

Reply