Hasoke
Hasoke

Reputation: 1

Is there a possibility for configurating via CLI and not by web interfaces for installing Centreon?

I am trying to use only CLI to install centreon, I don't want to use the web interface. ( I am trying to create an Ansible role who install centreon) Is there a methode to do the web interface part via CLI ?

Upvotes: 0

Views: 1573

Answers (1)

Rom
Rom

Reputation: 76

Centreon CLAPI aims to offer (almost) all the features that are available on the user web interface in terms of configuration, through a command-line interface.

The main features are:

  • Add/Delete/Update objects such as hosts, services, host templates, host groups, contacts etc...
  • Generate configuration files
  • Test configuration files
  • Move configuration files to monitoring pollers
  • Restart monitoring pollers Import and export objects

All actions in Centreon CLAPI will require authentication, so your commands will always start like this:

# cd /usr/share/centreon/bin
# ./centreon -u admin -p centreon [...]

Obviously, the -u option is for the username and the -p option is for the password. The password can be in clear or the one encrypted in the database.

Here is an example for a HOST object (Object name: HOST)

In order to list available hosts, use the SHOW action:

[root@centreon ~]# ./centreon -u admin -p centreon -o HOST -a show
id;name;alias;address;activate
82;sri-dev1;dev1;192.168.2.1;1
83;sri-dev2;dev2;192.168.2.2;1
84;sri-dev3;dev3;192.168.2.3;0

In order to add a host, use the ADD action:

[root@centreon ~]# ./centreon -u admin -p centreon -o HOST -a ADD -v "test;Test host;127.0.0.1;generic-host;central;Linux"

Required parameters:

Order Description

1 Host name

2 Host alias

3 Host IP address

4 Host templates; for multiple definitions, use delimiter |

5 Instance name (poller)

6 Hostgroup; for multiple definitions, use delimiter |

In order to delete one host, use the DEL action.

[root@centreon ~]# ./centreon -u admin -p centreon -o HOST -a DEL -v "test"

You can retrieve all the CLI instructions online in the official doc. https://documentation.centreon.com/docs/centreon/en/19.04/api/clapi/index.html

I also found a useful Ansible Centreon playbook on Github: https://github.com/centreon/centreon-iac-ansible

Upvotes: 1

Related Questions