Solved

Adding monitoring from a file

  • 6 June 2023
  • 3 replies
  • 351 views

Userlevel 1
Badge +7

Hello The Watch Community !

I’ve received this request from a user : to add in Centreon a monitoring from a file (CSV or Excel) or a mail, with this kind if information :

DateTime | Status (OK or KO)

Data are sent each 15 minutes. The request is to exploit the data to create a chart, and be able, as usual with Centreon monitoring, to handle issues, by sending mail to a dedicated email address.

I really don’t know if the content of a file or a mail can be used as a source for monitoring.

Thank you !

icon

Best answer by christophe.niel-ACT 12 June 2023, 10:58

View original

3 replies

Userlevel 5
Badge +14

hello

out of the box : there is nothing to answer your specific need

there is a check_files that will check the presence of file, and check_logfiles which will parse log with a specific syntax, but that will probably not be what you want.

 

howerver, you could code your own business logic in a script (bash, batch, powershell, python, whatever) that will be called by centreon and output centreon check specific output

Plugins development guidelines | Centreon Documentation

(your program/screen need to ouput 1 line with text, and an exit code to tell centreon “ok”, warning, critical, unknown)

 

you will be able to make your own test and a logic, and create a custom “check command” that will be called once every 15min

 

the script can be put on the windows/linux you want and be called through nrpe, ssh or nsclient, each technology has its own way to call a custom script (usually by declaring the script in a config file on the local server)

can’t help you more, here, it will depend on the scripting you will use, the os of the server that host the file etc… 

Userlevel 1
Badge +7

Thank you ! When I’ve time I’ll test your proposal.

Userlevel 1
Badge +7

Hello, I’ve started to work on the topic. My understanding is the following.

  1. A csv file with timestamp, OK or CRITICAL on each line is available on a folder
  2. A shell, installed in a server, reads the file each 15 minutes and copy the last line (only the value OK or CRITICAL)
  3. A Centreon check command is executed each 15 minutes to read this value
  4. This command is associated to a host, and the result is displayed

So 2 actions have to be performed :

  1. Write the shell
  2. Create the check command

Do you validate this explanation ?

Thanks,

Reply