Skip to main content

Hi,
I would like to know how to change the status of a service using the command line in my Centreon server.

Thanks.

Hello

are you using “passive check” or “active” check?

there is an api on the restapi v1 endpoint that allow you to submit a status : 

Rest API (v1) | Centreon Documentation

you would need to code something with some curl command (or whatever script you like, python, perl) to use the api.

 

I’m not really sure why you would want to do this, as an active check will run with the centreon engine scheduler and overwrite the result you would push with your command.

this could be used with passive a check (I never tried on an active check)

you can use Postman or Insomnia to test the API without coding the script to test the submit API.

 

Christophe


Hello,
I’m using python3 sockets. I’m trying to do a passive check by my own.

I have a server to make backups, when it does a backup it sends the backup info in a dicionary (shows the status of the backup and some more info).
The dicionary is sent to a python3 socket (in the centreon server), it gets the dicionary from the backups server. If in the dicionary reflects any issue about the backup status it will change the status of the service.


Hey, I finally made it, I used the socket centreon: 

timestamp = int(datetime.datetime.now().timestamp())
commandfile = '/var/lib/centreon-engine/rw/centengine.cmd'
subprocess.run(n'/bin/bash', '-c', f"echo \"\{timestamp}] PROCESS_SERVICE_CHECK_RESULT;10.0.2.249;backup_status;{status_centreono0]};{status_centreono1]}\" > {commandfile}"])

But there is a problem. I only can use it with Centreon v.22.04.4 it works, but with v.23.10.9 it doesn’t work. Where I need to create a ticket about this problem?


Reply