Aller au contenu principal
Version: 23.04

Command Line API (v1) - CLAPI

Cette documentation n'est disponible qu'en anglais.

Overview

Centreon CLAPI aims to offer (almost) all the features that are available on the user interface in terms of configuration. Only administrators can use CLAPI.

Features

  • 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

Basic usage

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

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 encrypted in the database.

NOTE: If your passwords are encoded with SHA1 in database (MD5 by default), use the -s option:

centreon -u admin -p 'centreon' -s [...]

Objects

ACL

Object name: ACL

Reload

In order to reload ACL, use the RELOAD command:

centreon -u admin -p 'centreon' -o ACL -a reload

Lastreload

In order to check when the ACL was last reloaded, use the LASTRELOAD command:

centreon -u admin -p 'centreon' -o ACL -a lastreload
1329833702

If you wish to get a human readable time format instead of a timestamp, use the following command:

centreon -u admin -p 'centreon' -o ACL -a lastreload -v "d-m-Y H:i:s"
21-02-2012 15:17:01

You can change the date format:

Format characterDescription
dDay
mMonth
YYear
HHour
iMinute
sSecond

ACL Groups

Object name: ACLGROUP

Show

In order to list available ACL Groups, use the SHOW action:

centreon -u admin -p 'centreon' -o ACLGROUP -a show
id;name;alias;activate
1;ALL;ALL;1
[...]

Columns are the following :

ColumnDescription
IDID
NameName
AliasAlias
Activate1 when ACL Group is enabled, 0 otherwise

Add

In order to add an ACL Group, use the ADD action:

centreon -u admin -p 'centreon' -o ACLGROUP -a add -v "ACL Group test;my alias"

Required fields are:

ColumnDescription
NameName
AliasAlias

Del

If you want to remove an ACL Group, use the DEL action. The Name is used for identifying the ACL Group to delete:

centreon -u admin -p 'centreon' -o ACLGROUP -a del -v "ACL Group test"

Setparam

If you want to change a specific parameter of an ACL Group, use the SETPARAM action. The Name is used for identifying the ACL Group to update:

centreon -u admin -p 'centreon' -o ACLGROUP -a setparam -v "ACL Group test;alias;my new alias"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL Group
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
name
alias
activate1 when ACL Group is enabled, 0 otherwise

Getmenu

If you want to retrieve the Menu Rules that are linked to a specific ACL Group, use the GETMENU action:

centreon -u admin -p 'centreon' -o ACLGROUP -a getmenu -v "ACL Group test"
id;name
1;Configuration
3;Reporting
4;Graphs
2;Monitoring + Home

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group

Getaction

If you want to retrieve the Action Rules that are linked to a specific ACL Group, use the GETACTION action:

centreon -u admin -p 'centreon' -o ACLGROUP -a getaction -v "ACL Group test"
id;name
1;Simple action rule

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group

Getresource

If you want to retrieve the Resource Rules that are linked to a specific ACL Group, use the GETRESOURCE action:

centreon -u admin -p 'centreon' -o ACLGROUP -a getresource -v "ACL Group test"
id;name
1;All Resources

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group

Getcontact and Getcontactgroup

If you want to retrieve the Contacts that are linked to a specific ACL Group, use the GETCONTACT action:

centreon -u admin -p 'centreon' -o ACLGROUP -a getcontact -v "ACL Group test"
id;name
1;user1

If you want to retrieve the Contact Groups that are linked to a specific ACL Group, use the GETCONTACTGROUP action:

centreon -u admin -p 'centreon' -o ACLGROUP -a getcontactgroup -v "ACL Group test"
id;name
1;usergroup1

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group

Setmenu, Setaction, Setresource, Addmenu, Addaction, Addresource

If you want to link rules to a specific ACL Group, use the following actions: SETMENU, SETACTION, SETRESOURCE, ADDMENU, ADDACTION, ADDRESOURCE:

centreon -u admin -p 'centreon' -o ACLGROUP -a setmenu -v "ACL Group test;Menu rule 1|Menu rule 2"
centreon -u admin -p 'centreon' -o ACLGROUP -a addresource -v "ACL Group test;All Routers"
Command typeDescription
set*Overwrites previous definitions. Use the delimiter
add*Appends new rules to the previous definitions. Use the delimiter

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group
2Name of the ACL rule to link

Delmenu, Delaction, Delresource

If you want to remove rules from a specific ACL Group, use the following actions: DELMENU, DELACTION, DELRESOURCE:

centreon -u admin -p 'centreon' -o ACLGROUP -a delaction -v "ACL Group test;Ack rule|Downtime rule"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group
2Name of the ACL rule to remove

Setcontact, Setcontactgroup, Addcontact, Addcontactgroup

If you want to link contacts or contact groups to a specific ACL Group, use the following actions: SETCONTACT, SETCONTACTGROUP, ADDCONTACT, ADDCONTACTGROUP:

centreon -u admin -p 'centreon' -o ACLGROUP -a setcontact -v "ACL Group test;user1"
centreon -u admin -p 'centreon' -o ACLGROUP -a addcontactgroup -v "ACL Group test;usergroup1"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group
2Contact/Contact group to add/set
Command typeDescription
set*Overwrites previous definitions. Use the delimiter
add*Appends new contacts/contact groups to the previous definitions. Use the delimiter

Delcontact, Delcontactgroup

If you want to remove rules from a specific ACL Group, use the following actions: DELCONTACT, DELCONTACTGROUP:

centreon -u admin -p 'centreon' -o ACLGROUP -a delcontact -v "ACL Group test;user1"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group
2Contact/Contact group to remove from ACL group

Action ACL

Object name: ACLACTION

Show

In order to list available ACL Actions, use the SHOW action:

centreon -u admin -p 'centreon' -o ACLACTION -a show
id;name;description;activate
1;Simple User;Simple User;1
[...]

Columns are the following:

ColumnDescription
ID
Name
Description
Activate1 when ACL Action is enabled, 0 otherwise

Add

In order to add an ACL Action, use the ADD action:

centreon -u admin -p 'centreon' -o ACLACTION -a add -v "ACL Action test;my description"

Required fields:

ColumnDescription
Name
Description

Del

If you want to remove an ACL Action, use the DEL action. The Name is used for identifying the ACL Action to delete:

centreon -u admin -p 'centreon' -o ACLACTION -a del -v "ACL Action test"

Setparam

If you want to change a specific parameter of an ACL Action, use the SETPARAM action. The Name is used for identifying the ACL Action to update:

centreon -u admin -p 'centreon' -o ACLACTION -a setparam -v "ACL Action test;description;my new description"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL action rule
2Parameter name
3Parameter value

Parameters that you may change are the following:

ColumnDescription
name
description
activate1 when ACL Action is enabled, 0 otherwise

Getaclgroup

If you want to retrieve the ACL Groups that are linked to a specific ACL Action, use the GETACLGROUP command.

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL action rule
Example
centreon -u admin -p 'centreon' -o ACLACTION -a getaclgroup -v "ACL Action test"
id;name
1;ALL
3;Operators

Grant and Revoke

If you want to grant or revoke actions in an ACL Action rule definition, use the following commands: GRANT, REVOKE.

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL action rule
2Actions to grant/revoke
Example
centreon -u admin -p 'centreon' -o ACLACTION -a grant -v "ACL Action test;host_acknowledgement|service_acknowledgement"
centreon -u admin -p 'centreon' -o ACLACTION -a revoke -v "ACL Action test;host_schedule_downtime|service_schedule_downtime"

The `*` wildcard can be used in order to grant or revoke all actions:

centreon -u admin -p 'centreon' -o ACLACTION -a grant -v "ACL Action test;*"
centreon -u admin -p 'centreon' -o ACLACTION -a revoke -v "ACL Action test;*"

Below is the list of actions that you can grant/revoke:

ActionDescription
global_event_handlerPermission to globally enable/disable event handlers
global_flap_detectionPermission to globally enable/disable flap detection
global_host_checksPermission to globally enable/disable host active checks
global_host_obsessPermission to globally enable/disable obsess over host
global_host_passive_checksPermission to globally enable/disable host passive checks
global_notificationsPermission to globally enable/disable notifications
global_perf_dataPermission to globally enable/disable performance data
global_restartPermission to restart the monitoring engine
global_service_checksPermission to globally enable/disable service active checks
global_service_obsessPermission to globally enable/disable obsess over service
global_service_passive_checksPermission to globally enable/disable service passive checks
global_shutdownPermission to shut down the monitoring engine
host_acknowledgementPermission to acknowledge hosts
host_checksPermission to enable/disable host active checks
host_checks_for_servicesPermission to enable/disable active checks of a host's services
host_commentPermission to put comments on hosts
host_event_handlerPermission to enable/disable event handlers on hosts
host_flap_detectionPermission to enable/disable flap detection on hosts
host_notificationsPermission to enable/disable notification on hosts
host_notifications_for_servicesPermission to enable/disable notification on hosts' services
host_schedule_checkPermission to schedule a host check
host_schedule_downtimePermission to schedule a downtime on a host
host_schedule_forced_checkPermission to schedule a host forced check
host_submit_resultPermission to submit a passive check result to a host
poller_listingPermission to see the Poller list on the monitoring console
poller_statsPermission to see the poller statistics (on top screen)
service_acknowledgementPermission to acknowledge services
service_checksPermission to enable/disable service active checks
service_commentPermission to put comments on services
service_event_handlerPermission to enable/disable event handlers on services
service_flap_detectionPermission to enable/disable flap detection on services
service_notificationsPermission to enable/disable notification on services
service_passive_checksPermission to enable/disable service passive checks
service_schedule_checkPermission to schedule a service check
service_schedule_downtimePermission to schedule a downtime on a service
service_schedule_forced_checkPermission to schedule a service forced check
service_submit_resultPermission to submit a passive check result to a service
top_counterPermission to see the quick status overview (top right corner of the screen)

Object name: ACLMENU

Show

In order to list available ACL Menus, use the SHOW action:

centreon -u admin -p 'centreon' -o ACLMENU -a show
id;name;alias;comment;activate
1;Configuration;Configuration;;1
2;Monitoring + Home;Monitoring + Home;;1
3;Reporting;Reporting;;1
4;Graphs;Graphs;just a comment;1
[...]

Columns are the following :

ColumnDescription
IDID
NameName
AliasAlias
CommentComment
Activate1 when ACL Menu is enabled, 0 otherwise

Add

In order to add an ACL Menu, use the ADD action:

centreon -u admin -p 'centreon' -o ACLMENU -a add -v "ACL Menu test;my alias"

Required fields are:

ColumnDescription
NameName
AliasAlias

Del

If you want to remove an ACL Menu, use the DEL action. The Name is used for identifying the ACL Menu to delete:

centreon -u admin -p 'centreon' -o ACLMENU -a del -v "ACL Menu test"

Setparam

If you want to change a specific parameter of an ACL Menu, use the SETPARAM action. The Name is used for identifying the ACL Menu to update:

centreon -u admin -p 'centreon' -o ACLMENU -a setparam -v "ACL Menu test;alias;my new alias"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL menu rule
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
nameName
aliasAlias
activate1 when ACL Menu is enabled, 0 otherwise
commentComment

Getaclgroup

If you want to retrieve the ACL Groups that are linked to a specific ACL Menu, use the GETACLGROUP action:

centreon -u admin -p 'centreon' -o ACLMENU -a getaclgroup -v "ACL Menu test"
id;name
1;ALL
3;Operators

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL menu rule

Grant and Revoke

If you want to grant in Read/Write, Read Only or revoke menus in an ACL Menu rule definition, use the following actions: GRANTRW, GRANTRO, REVOKE

Let's assume that you would like to grant full access to the [Monitoring] menu in your ACL Menu rule:

centreon -u admin -p 'centreon' -o ACLMENU -a grantrw -v "ACL Menu test;1;Monitoring"

Then, you would like to grant access to the [Home] > [Poller statistics] menu:

centreon -u admin -p 'centreon' -o ACLMENU -a grantrw -v "ACL Menu test;1;Home;Poller statistics"

Then, you would like to grant access in read only to the [Configuration] > [Hosts] menu:

centreon -u admin -p 'centreon' -o ACLMENU -a grantro -v "ACL Menu test;1;Configuration;Hosts"

Then, you decide to revoke access from [Monitoring] > [Event Logs]:

centreon -u admin -p 'centreon' -o ACLMENU -a revoke -v "ACL Menu test;1;Monitoring;Event Logs"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL menu rule
2Grant/revoke children menus
3Menu name to grant/revoke
nPossible sub menu name

Resource ACL

Object name: ACLRESOURCE

Show

In order to list available ACL Resources, use the SHOW action:

centreon -u admin -p 'centreon' -o ACLRESOURCE -a show
id;name;alias;comment;activate
1;All Resources;All Resources;;1
[...]

Columns are the following :

ColumnDescription
IDID
NameName
AliasAlias
CommentComment
Activate1 when ACL Resource is enabled, 0 otherwise

Add

In order to add an ACL Resource, use the ADD action:

centreon -u admin -p 'centreon' -o ACLRESOURCE -a add -v "ACL Resource test;my alias"

Required fields are:

ColumnDescription
NameName
AliasAlias

Del

If you want to remove an ACL Resource, use the DEL action. The Name is used for identifying the ACL Resource to delete:

centreon -u admin -p 'centreon' -o ACLRESOURCE -a del -v "ACL Resource test"

Setparam

If you want to change a specific parameter of an ACL Resource, use the SETPARAM action. The Name is used for identifying the ACL Resource to update:

centreon -u admin -p 'centreon' -o ACLRESOURCE -a setparam -v "ACL Resource test;alias;my new alias"

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL resource rule
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
nameName
aliasAlias
activate1 when ACL Resource is enabled, 0 otherwise

Getaclgroup

If you want to retrieve the ACL Groups that are linked to a specific ACL Resource, use the GETACLGROUP action:

centreon -u admin -p 'centreon' -o ACLRESOURCE -a getaclgroup -v "ACL Resource test"
id;name
1;ALL
3;Operators

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group

Grant and revoke

Arguments are composed of the following columns:

OrderColumn description
1Name of ACL group
2Name of resource

If you want to grant or revoke resources in an ACL Resource rule definition, use the following commands:

CommandDescriptionExampleWildcard '*' supported
grant_hostPut host name(s)[...] -a grant_host -v "ACL Resource Test;srv-esx"Yes
grant_hostgroupPut hostgroup name(s)[...] -a grant_hostgroup -v "ACL Resource Test;Linux servers"Yes
grant_servicegroupPut servicegroup name(s)[...] -a grant_servicegroup -v "ACL Resource Test;Ping"Yes
grant_metaservicePut metaservice name(s)[...] -a grant_metaservice -v "ACL Resource Test;Traffic Average"No
addhostexclusionPut host name(s)[...] -a addhostexclusion -v "ACL Resource Test;srv-test"No
revoke_hostPut host name(s)[...] -a revoke_host -v "ACL Resource Test;srv-esx"Yes
revoke_hostgroupPut hostgroup name(s)[...] -a revoke_hostgroup -v "ACL Resource Test;Linux servers"Yes
revoke_servicegroupPut servicegroup name(s)[...] -a revoke_servicegroup -v "ACL Resource Test;Ping"Yes
revoke_metaservicePut metaservice name(s)[...] -a revoke_metaservice -v "ACL Resource Test;Traffic Average"Yes
delhostexclusionPut host name(s)[...] -a delhostexclusion -v "ACL Resource Test;srv-test"Yes
addfilter_instancePut instance name(s)[...] -a addfilter_instance -v "ACL Resource Test;Monitoring-2"No
addfilter_hostcategoryPut host category name(s)[...] -a addfilter_hostcategory -v "ACL Resource Test;Customer-1"No
addfilter_servicecategoryPut service category name(s)[...] -a addfilter_servicecategory -v "ACL Resource Test;System"No
delfilter_instancePut instance name(s)[...] -a delfilter_instance -v "ACL Resource Test;Monitoring-2"Yes
delfilter_hostcategoryPut host category name(s)[...] -a delfilter_hostcategory -v "ACL Resource Test;Customer-1"Yes
delfilter_servicecategoryPut service category name(s)[...] -a delfilter_servicecategory -v "ACL Resource Test;System"Yes

NOTE: Use delimiter "|" for defining multiple resources.

Centreon Broker

Object name: CENTBROKERCFG

Show

In order to list available Centreon Broker CFG, use the SHOW action:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a show
config id;config name;instance
1;Central CFG;Central
2;Sattelite CFG;Sattelite
[...]

Columns are the following:

OrderDescription
1ID
2Name of configuration
3Instance that is linked to broker cfg

Add

In order to add a Centreon Broker CFG, use the ADD action:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a add -v "broker cfg for poller test;Poller test"

Required fields are:

OrderDescription
1Name of configuration
2Instance that is linked to broker cfg

Del

If you want to remove a Centreon Broker CFG, use the DEL action. The Name is used for identifying the configuration to delete:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a del -v "broker cfg for poller test"

Setparam

If you want to change a specific parameter of a Centreon Broker configuration, use the SETPARAM action. The configuration name is used for identifying the configuration to update:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a setparam -v "broker cfg for poller test;name;new broker cfg name"

Arguments are composed of the following columns:

OrderColumn description
1Name of Centreon Broker configuration
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
filenameFilename of configuration (.json extension)
nameName of configuration
instanceInstance that is linked to Centreon Broker CFG
event_queue_max_sizeEvent queue max size (when number is reached, temporary output will be used).
event_queues_total_sizeEvent queues maximum total size
cache_directoryPath for cache files
daemonLink this configuration to cbd service (0 or 1)
pool_sizeNumber of threads used (by default, use the number of CPUs)
stats_activate
command_fileFilename of command
log_directoryDirectory of log files
log_filenameFilename of log file

Listinput and Listoutput

If you want to list specific input output types of Centreon Broker, use one of the following commands:

  • listinput
  • listoutput

Example:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a listoutput -v "broker cfg for poller test"
id;name
1;Storage
2;RRD
3;PerfData

Columns are the following:

ColumnDescription
IDI/O ID
NameI/O Name

Getinput and Getoutput

In order to get parameters of a specific I/O object, use one of the following commands:

  • getinput
  • getoutput

Example:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a getoutput -v "broker cfg for poller test;3"
parameter key;parameter value
db_host;localhost
db_name;centreon_storage
db_password;centreon
db_port;3306
db_type;mysql
db_user;centreon
interval;60
length;
name;PerfData
type;storage

The ID is used for identifying the I/O to get.

Columns are the following:

OrderDescription
1Parameter key of the I/O
2Parameter value of the I/O

Addinput and Addoutput

In order to add a new I/O object, use one of the following commands:

  • ADDINPUT
  • ADDOUTPUT

Example:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a addoutput -v "broker cfg for poller test;MyFileOutput;file"
centreon -u admin -p 'centreon' -o CENTBROKERCFG -a listoutput -v "broker cfg for poller test"
id;name
1;Storage
2;RRD
3;PerfData
4:MyFileOutput

Arguments are composed of the following columns:

OrderColumn description
1Name of Centreon Broker CFG
2Name of the I/O object
3Nature of I/O object

Delinput and Deloutput

In order to remove an I/O object from the Centreon Broker configuration, use one of the following commands:

  • DELINPUT
  • DELOUTPUT

Example:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a deloutput -v "broker cfg for poller test;4"

The I/O ID is used for identifying the object to delete.

Setintput and Setoutput

In order to set parameters of an I/O object, use one of the following commands:

  • SETINPUT
  • SETOUTPUT

Example:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a setoutput -v "broker cfg for poller test;1;retry_interval;5'"

Arguments are composed of the following columns:

OrderColumn description
1Name of Centreon Broker CFG
2ID of I/O object
3Parameter name
4Parameter value, for multiple values, use the "," delimiter

You may get help with the following CLAPI commands:

  • GETTYPELIST
  • GETFIELDLIST
  • GETVALUELIST

Example:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a gettypelist -v "output"
type id;short name;name
27;bam_bi;BI engine (BAM)
16;sql;Broker SQL Database
32;correlation;Correlation
28;db_cfg_reader;Database configuration reader
29;db_cfg_writer;Database configuration writer
11;file;File
3;ipv4;IPv4
10;ipv6;IPv6
26;bam;Monitoring engine (BAM)
14;storage;Perfdata Generator (Centreon Storage)
13;rrd;RRD File Generator
30;graphite;Storage - Graphite
31;influxdb;Storage - InfluxDB
centreon -u admin -p 'centreon' -o CENTBROKERCFG -a getfieldlist -v "ipv4"
field id;short name;name
3;ca_certificate;Trusted CA's certificate;text
2;host;Host to connect to;text
46;negotiation;Enable negotiation;radio
48;one_peer_retention_mode;One peer retention;radio
1;port;Connection port;int
4;private_key;Private key file.;text
12;protocol*;Serialization Protocol;select
5;public_cert;Public certificate;text
6;tls;Enable TLS encryption;radio

NOTE: Note that the "protocol" entry is followed by a star. This means that you have to use one of the possible values.

This is how you get the list of possible values of a given field:

centreon -u admin -p 'centreon' -o CENTBROKERCFG -a getvaluelist -v "protocol"
possible values
ndo

The following chapters describes the parameters of each Object type

ipv4:

IDLabelDescriptionPossible values

buffering_timeout

Buffering timeout

Time in seconds to wait before launching failover.

compression

compression_buffer

compression_level

Compression (zlib)

Compression buffer size

Compression level

Enable or not data stream compression.

The higher the buffer size is, the best compression. This however increase data streaming latency. Use with caution.

Ranges from 0 (no compression) to 9 (best compression). Default is -1 (zlib compression)

retry_interval

Retry interval

Time in seconds to wait between each connection attempt.

category

Filter category

Category filter for flux in input

ca_certificate

host

Trusted CA's certificate

Host to connect to

Trusted CA's certificate.

IP address or hostname of the host to connect to (leave blank for listening mode).

one_peer_retention_mode

port

One peer retention

Connection port

This allows the retention to work even if the socket is listening

Port to listen on (empty host) or to connect to (with host filled).

private_key

Private key file.

Private key file path when TLS encryption is used.

protocol

Serialization protocol

Serialization protocol.

ndo

public_cert

Public certificate

Public certificate file path when TLS encryption is used.

tls

Enable TLS encryption

Enable TLS encryption.

ipv6:

IDLabelDescriptionPossible values

buffering_timeout

Buffering timeout

Time in seconds to wait before launching failover.

compression

compression_buffer

compression_level

Compression (zlib)

Compression buffer size

Compression level

Enable or not data stream compression.

The higher the buffer size is, the best compression. This however increase data streaming latency. Use with caution.

Ranges from 0 (no compression) to 9 (best compression). Default is -1 (zlib compression)

retry_interval

Retry interval

Time in seconds to wait between each connection attempt.

category

Filter category

Category filter for flux in input

ca_certificate

host

Trusted CA's certificate

Host to connect to

Trusted CA's certificate.

IP address or hostname of the host to connect to (leave blank for listening mode).

one_peer_retention_mode

port

One peer retention

Connection port

This allows the retention to work even if the socket is listening

Port to listen on (empty host) or to connect to (with host filled).

private_key

Private key file.

Private key file path when TLS encryption is used.

protocol

Serialization protocol

Serialization protocol.

ndo

public_cert

Public certificate

Public certificate file path when TLS encryption is used.

tls

Enable TLS encryption

Enable TLS encryption.

file:

IDLabelDescriptionPossible values

buffering_timeout

Buffering timeout

Time in seconds to wait before launching failover.

compression

compression_buffer

compression_level

Compression (zlib)

Compression buffer size

Compression level

Enable or not data stream compression.

The higher the buffer size is, the best compression. This however increase data streaming latency. Use with caution.

Ranges from 0 (no compression) to 9 (best compression). Default is -1 (zlib compression)

retry_interval

Retry interval

Time in seconds to wait between each connection attempt.

max_size

Maximum size of file

Maximum size in bytes.

path

File path

Path to the file.

protocol

Serialization protocol

Serialization protocol.

ndo

logger

file:

IDLabelDescriptionPossible values

config

Configuration messages

Enable or not configuration messages logging.

debug

Debug messages

Enable or not debug messages logging.

error

Error messages

Enable or not error messages logging.

info

Informational messages

Enable or not informational messages logging.

level

Logging level

How much messages must be logged.

high,low,medium

max_size

name

Max file size in bytes

Name of the logger

The maximum size of log file.

For a file logger this is the path to the file. For a standard logger, one of 'stdout' or 'stderr'.

standard:

IDLabelDescriptionPossible values

config

Configuration messages

Enable or not configuration messages logging.

debug

Debug messages

Enable or not debug messages logging.

error

Error messages

Enable or not error messages logging.

info

Informational messages

Enable or not informational messages logging.

level

name

Logging level

Name of the logger

How much messages must be logged.

For a file logger this is the path to the file. For a standard logger, one of 'stdout' or 'stderr'.

high,low,medium

syslog:

IDLabelDescriptionPossible values

config

Configuration messages

Enable or not configuration messages logging.

debug

Debug messages

Enable or not debug messages logging.

error

Error messages

Enable or not error messages logging.

info

Informational messages

Enable or not informational messages logging.

level

Logging level

How much messages must be logged.

high,low,medium

monitoring:

IDLabelDescriptionPossible values

config

Configuration messages

Enable or not configuration messages logging.

debug

Debug messages

Enable or not debug messages logging.

error

Error messages

Enable or not error messages logging.

info

Informational messages

Enable or not informational messages logging.

level

name

Logging level

Name of the logger

How much messages must be logged.

For a file logger this is the path to the file. For a standard logger, one of 'stdout' or 'stderr'.

high,low,medium

output

ipv4:

IDLabelDescriptionPossible values
buffering_timeoutBuffering timeoutTime in seconds to wait before launching failover.-
compressionCompression (zlib)Enable or not data stream compression.-
compression_bufferCompression buffer sizeThe higher the buffer size is, the best compression. This however increase data streaming latency. Use with caution.-
compression_levelCompression levelRanges from 0 (no compression) to 9 (best compression). Default is -1 (zlib compression)-
retry_intervalRetry intervalTime in seconds to wait between each connection attempt.-
categoryFilter categoryCategory filter for flux in input-
ca_certificateTrusted CA's certificateTrusted CA's certificate.-
hostHost to connect toIP address or hostname of the host to connect to (leave blank for listening mode).-
one_peer_retention_modeone peer retentionThis allows the retention to work even if the socket is listening-
portConnection portPort to listen on (empty host) or to connect to (with host filled).-
private_keyPrivate key file.Private key file path when TLS encryption is used.-
protocolSerialization protocolSerialization protocol.ndo
public_certPublic certificatePublic certificate file path when TLS encryption is used.-
tlsEnable TLS encryptionEnable TLS encryption-

ipv6:

IDLabelDescriptionPossible values
buffering_timeoutBuffering timeoutTime in seconds to wait before launching failover.-
compressionCompression (zlib)Enable or not data stream compression.-
compression_bufferCompression buffer sizeThe higher the buffer size is, the best compression. This however increase data streaming latency. Use with caution.-
compression_levelCompression levelRanges from 0 (no compression) to 9 (best compression). Default is -1 (zlib compression)-
retry_intervalRetry intervalTime in seconds to wait between each connection attempt.-
categoryFilter categoryCategory filter for flux in input-
ca_certificateTrusted CA's certificateTrusted CA's certificate.-
hostHost to connect toIP address or hostname of the host to connect to (leave blank for listening mode).-
one_peer_retention_modeone peer retentionThis allows the retention to work even if the socket is listening-
portConnection portPort to listen on (empty host) or to connect to (with host filled).-
private_keyPrivate key file.Private key file path when TLS encryption is used.-
protocolSerialization protocolSerialization protocol.ndo
public_certPublic certificatePublic certificate file path when TLS encryption is used.-
tlsEnable TLS encryptionEnable TLS encryption-

file:

IDLabelDescriptionPossible values
buffering_timeoutBuffering timeoutTime in seconds to wait before launching failover.-
compressionCompression (zlib)Enable or not data stream compression.-
compression_bufferCompression buffer sizeThe higher the buffer size is, the best compression. This however increase data streaming latency. Use with caution.-
compression_levelCompression levelRanges from 0 (no compression) to 9 (best compression). Default is -1 (zlib compression)-
failoverFailover nameName of the output which will act as failover-
retry_intervalRetry intervalTime in seconds to wait between each connection attempt.-
categoryFilter categoryCategory filter for flux in output.-
max_sizeMaximum size of fileMaximum size in bytes.-
pathFile pathPath to the file.-
protocolSerialization protocolSerialization protocol.ndo

rrd:

IDLabelDescriptionPossible values

buffering_timeout

Buffering timeout

Time in seconds to wait before launching failover.

failover

Failover name

Name of the output which will act as failover

retry_interval

Retry interval

Time in seconds to wait between each connection attempt.

category

Filter category

Category filter for flux in output.

metrics_path

path

port

RRD file directory for metrics

Unix socket

TCP port

RRD file directory, for example /var/lib/centreon/metrics

The Unix socket used to communicate with rrdcached. This is a global option, go to Administration > Options > RRDTool to modify it.

The TCP port used to communicate with rrdcached. This is a global option, go to Administration > Options > RRDTool to modify it.

status_path

RRD file directory for statuses

RRD file directory, for example /var/lib/centreon/status

write_metrics

Enable write_metrics

Enable or not write_metrics.

write_status

Enable write_status

Enable or not write_status.

store_in_data_bin

Enable store_in_data_bin

Enable or not store in performance data in data_bin.

storage:

IDLabelDescriptionPossible values

buffering_timeout

Buffering timeout

Time in seconds to wait before launching failover.

failover

Failover name

Name of the output which will act as failover

retry_interval

Retry interval

Time in seconds to wait between each connection attempt.

category

check_replication

Filter category

Replication enabled

Category filter for flux in output.

When enabled, the broker engine will check whether or not the replication is up to date before attempting to update data.

db_host

DB host

IP address or hostname of the database server.

db_name

DB name

Database name.

db_password

DB password

Password of database user.

db_port

DB port

Port on which the DB server listens

db_type

DB type

Target DBMS.

db2,ibase,mysql,oci,odbc,postgresql,sqlite,tds

db_user

DB user

Database user.

interval

Interval length

Interval length in seconds.

length

RRD length

RRD storage duration in seconds.

queries_per_transaction

Maximum queries per transaction

The maximum queries per transaction before commit.

read_timeout

rebuild_check_interval

Transaction commit timeout

Rebuild check interval in seconds

The transaction timeout before running commit.

The interval between check if some metrics must be rebuild. The default value is 300s

store_in_data_bin

Enable store_in_data_bin

Enable or not store in performance data in data_bin.

sql:

IDLabelDescriptionPossible values

buffering_timeout

Buffering timeout

Time in seconds to wait before launching failover.

failover

Failover name

Name of the output which will act as failover

retry_interval

Retry interval

Time in seconds to wait between each connection attempt.

category

check_replication

Filter category

Replication enabled

Category filter for flux in output.

When enabled, the broker engine will check whether or not the replication is up to date before attempting to update data.

db_host

DB host

IP address or hostname of the database server.

db_name

DB name

Database name.

db_password

DB password

Password of database user.

db_port

DB port

Port on which the DB server listens

db_type

DB type

Target DBMS.

db2,ibase,mysql,oci,odbc,postgresql,sqlite,tds

db_user

DB user

Database user.

queries_per_transaction

Maximum queries per transaction

The maximum queries per transaction before commit.

read_timeout

Transaction commit timeout

The transaction timeout before running commit.

Centreon Engine

Object name: ENGINECFG

Show

In order to list available Centreon Engine conf, use the SHOW action:

centreon -u admin -p 'centreon' -o ENGINECFG -a show
id;name;instance;comment
1;Centreon Engine CFG 1;Central;Default CentreonEngine.cfg
[...]

Columns are the following :

OrderDescription
1Centreon Engine ID
2Centreon Engine configuration name
3Instance that is linked to centreon-engine.cfg
4Comments regarding the configuration file

Add

In order to add a Centreon Engine conf, use the ADD action:

centreon -u admin -p 'centreon' -o ENGINECFG -a add -v "Centreon Engine cfg for poller NY;Poller-NY;Just a small comment"

Required fields are:

OrderDescription
1Centreon Engine configuration name
2Instance that is linked to centreon-engine.cfg
3Comment regarding the configuration file

Del

If you want to remove a Centreon Engine conf, use the DEL action. The name is used for identifying the configuration to delete:

centreon -u admin -p 'centreon' -o ENGINECFG -a del -v "Centreon Engine cfg for poller NY"

Setparam

If you want to change a specific parameter of a Centreon Engine conf, use the SETPARAM action. The name is used for identifying the configuration to update:

centreon -u admin -p 'centreon' -o ENGINECFG -a setparam -v "Centreon Engine cfg for poller NY;cfg_dir;/usr/local/nagios/etc"

Arguments are composed of the following columns:

OrderColumn description
1Name of Centreon Engine configuration
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
nagios_nameName
instanceInstance that is linked to centreon-engine.cfg
broker_moduleexample: [...] -v "Engine CFG NY;broker_module;/usr/lib64/nagios/cbmod.so /etc/centreon-broker/central-module.json", you can use a | delimiter for defining multiple broker modules
nagios_activate1 if activated, 0 otherwise
*Centreon CLAPI handles pretty much all the options available in a centreon-engine configuration file. Because the list is quite long, it is best to refer to the official documentation of Centreon Engine

Addbrokermodule

If you want to add new broker module without removing existing modules, use the ADDBROKERMODULE:

centreon -u admin -p 'centreon' -o ENGINECFG -a addbrokermodule -v "Centreon Engine cfg for poller NY;/usr/lib64/centreon-engine/externalcmd.so"

Arguments are composed of the following columns:

OrderColumn description
1Name of Centreon Engine configuration
2Module name

To add multiple modules in one line, it will put the separator "/etc/centreon-broker/central-module.json"

Delbrokermodule

If you want to delete broker module, use the DELBROKERMODULE:

centreon -u admin -p 'centreon' -o ENGINECFG -a delbrokermodule -v "Centreon Engine cfg for poller NY;/usr/lib64/centreon-engine/externalcmd.so"

Arguments are composed of the following columns:

OrderColumn description
1Name of Centreon Engine configuration
2Module name

To delete multiple modules in one line, it will put the separator "/etc/centreon-broker/central-module.json"

Commands

Object name: CMD

Show

In order to list available commands, use SHOW action:

centreon -u admin -p 'centreon' -o CMD -a show
id;name;type;line
1;check-ping;check;$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$
2;check_dummy;check;$USER1$/check_dummy -o $ARG1$ -s $ARG2$
[...]

You can also specify the command to search:

centreon -u admin -p 'centreon' -o CMD -a show -v 'check-ping'
id;name;type;line
1;check-ping;check;$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$

Columns are the following:

ColumnDescription
Command ID
Command name
Command typecheck, notif, misc or discovery
Command lineSystem command line that will be run on execution

Add

In order to add a command use ADD action:

centreon -u admin -p 'centreon' -o CMD -a ADD -v 'check-host-alive;check;$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1'

Required columns are the following:

ColumnDescription
Command name
Command typecheck, notif, misc or discovery
Command lineSystem command line that will be run on execution

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

If you want to remove a command use DEL action:

centreon -u admin -p 'centreon' -o CMD -a del -v 'check-host-alive'

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

If you want to change a specific parameters for a command, use the SETPARAM command:

centreon -u admin -p 'centreon' -o CMD -a setparam -v 'check-host-alive;type;notif'
centreon -u admin -p 'centreon' -o CMD -a setparam -v 'check-host-alive;name;check-host-alive2'

Parameters that you can change are the following:

ParameterDescription
nameName of command
lineCommand line
typecheck, notif, misc or discovery
graphGraph template applied on command
exampleExample of arguments (i.e: !80!90)
commentComments regarding the command
activateActivate or disable the command
enable_shellEnable / Disable shell

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getparam

In order to get specific parameters on a command, use the GETPARAM action:

centreon -u admin -p 'centreon' -o CMD -a getparam -v "test;name"
alias
test
centreon -u admin -p 'centreon' -o CMD -a getparam -v "test;name|alia|comment"
Object not found:alia
centreon -u admin -p 'centreon' -o CMD -a getparam -v "test;name|line|type"
name;line;type
check-ping;check;$USER1$/check_ping;Check ping

You may edit the following parameters:

ParameterDescription
nameName of command
lineCommand line
typecheck, notif, misc or discovery
graphGraph template applied on command
exampleExample of arguments (i.e: !80!90)
commentComments regarding the command
activateActivate or disable the command
enable_shellEnable / Disable shell

Getargumentdescr

To retrieve the argument descriptions for a command, use the getargumentdescr command:

centreon -u admin -p 'centreon' -o CMD -a getargumentdesc -v 'test-cmd'
name;description
ARG0;First Argument ARG1;Second Argument

Setargumentdescr

If you want to change all arguments descriptions for a command, use the setargumentdescr command:

centreon -u admin -p 'centreon' -o CMD -a setargumentdescr -v 'check_centreon_ping;ARG1:count;ARG2:warning;ARG3:critical'

Contact Groups

Object name: CG

Show

In order to list available contact groups, use the SHOW action:

centreon -u admin -p 'centreon' -o CG -a show
id;name;alias;members
Guest;Guests Group;guest-user1,guest-user2
Supervisors;Centreon supervisors;Admin

Columns are the following:

ColumnDescription
Name
Alias
MembersList of contacts that are in the contact group

Add

In order to add a contact group, use the ADD action:

centreon -u admin -p 'centreon' -o CG -a ADD -v "Windows;Windows admins"

Required fields are the following:

ColumnDescription
NameName
AliasAlias

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to delete one contact group, use the DEL action:

centreon -u admin -p 'centreon' -o CG -a DEL -v "Windows"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

In order to change the name or the alias of a contactgroup, use the SETPARAM action:

centreon -u admin -p 'centreon' -o CG -a setparam -v "Windows;name;Windows-2K"
centreon -u admin -p 'centreon' -o CG -a setparam -v "Cisco;alias;Cisco-Routers"

Parameters that you can change are the following:

ParameterDescription
nameName
aliasAlias

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Enable

In order to enable a contact group, use the ENABLE action:

centreon -u admin -p 'centreon' -o CG -a enable -v "Guest"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Disable

In order to disable a contact group, use the DISABLE action:

centreon -u admin -p 'centreon' -o CG -a disable -v "Guest"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getcontact

In order to view the contact list of a contact group, use the GETCONTACT action:

centreon -u admin -p 'centreon' -o CG -a getcontact -v "Guest"
id;name
1;User1
2;User2

Columns are the following:

ColumnDescription
IDId of contact
NameName of contact

Addcontact and Setcontact

In order to add a contact to a contact group, use the ADDCONTACT or SETCONTACT action where 'add' will append and 'set' will overwrite previous definitions:

centreon -u admin -p 'centreon' -o CG -a addcontact -v "Guest;User1"
centreon -u admin -p 'centreon' -o CG -a setcontact -v "Guest;User1|User2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcontact

In order to remove a contact from a contact group, use the DELCONTACT action:

centreon -u admin -p 'centreon' -o CG -a delcontact -v "Guest;User1"
centreon -u admin -p 'centreon' -o CG -a delcontact -v "Guest;User2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Contacts

Object name: CONTACT

Show

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

centreon -u admin -p 'centreon' -o contact -a show
id;name;alias;email;pager;gui access;admin;activate
4;Guest;guest;guest@localhost;;0;0;0
5;Supervisor;admin;root@localhost;;1;1;1
6;User;user;user@localhost;;0;0;0

Columns are the following :

ColumnDescription
IDID of contact
NameName of contact
AliasAlias of contact (also login id)
EmailEmail of contact
PagerPhone number of contact
GUI Access1 (can access UI) or 0 (cannot access UI)
Admin1 (admin) or 0 (non admin)
activate1 (enabled) or 0 (disabled)

Add

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

centreon -u admin -p 'centreon' -o CONTACT -a ADD -v "user;user;user@mail.com;mypassword;1;1;en_US;local"

The required parameters are the following:

ParameterDescription
NameName of contact
Alias (login)Alias of contact (also login id)
EmailEmail of contact
PasswordPassword of contact (this field doesn't apply to contact templates)
Admin1 (admin) or 0 (non admin)
GUI Access1 (can access UI) or 0 (cannot access UI)
LanguageLanguage pack has to be installed on Centreon
Authentication typelocal or ldap

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to delete one contact, use the DEL action. The contact name is used for identifying the contact you would like to delete:

centreon -u admin -p 'centreon' -o contact -a del -v "user"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

If you want to change a specific parameter for a contact, use the SETPARAM action:

centreon -u admin -p 'centreon' -o contact -a setParam -v "contact alias;hostnotifcmd;command name"
centreon -u admin -p 'centreon' -o contact -a setParam -v "contact alias;svcnotifcmd;command name"
centreon -u admin -p 'centreon' -o contact -a setParam -v "contact alias;hostnotifperiod;period name"
centreon -u admin -p 'centreon' -o contact -a setparam -v "contact alias;timezone;Europe/Berlin"

The required parameters are the following:

ParameterDescription
Contact aliasAlias of contact to update
ParameterParameter to update
ValueNew value of parameter

Parameters that you can change are the following:

ParameterDescription
nameName
aliasAlias
commentComment
emailEmail Address
passwordUser Password
accessCan reach centreon, 1 if user has access, 0 otherwise
languageLocale
admin1 if user is admin, 0 otherwise
authtypeldap or local
hostnotifcmdhost notification command(s). Multiple commands can be defined with delimiter "
svcnotifcmdservice notification command(s). Multiple commands can be defined with delimiter "
hostnotifperiodhost notification period
svcnotifperiodservice notification period
hostnotifoptcan be d,u,r,f,s,n
servicenotifoptcan be w,u,c,r,f,s,n
address1Address #1
address2Address #2
address3Address #3
address4Address #4
address5Address #5
address6Address #6
ldap_dnLDAP domain name
enable_notifications1 when notification is enable, 0 otherwise
autologin_keyUsed for auto login
templateName of the template to apply to the contact
timezoneTimezone
reach_api1 if the user has access to the API configuration, 0 otherwise
reach_api_rt1 if the user has access to the API realtime, 0 otherwise

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Enable

In order to enable a contact, use the ENABLE action:

centreon -u admin -p 'centreon' -o contact -a enable -v "test"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Disable

In order to disable a contact, use the DISABLE action:

centreon -u admin -p 'centreon' -o contact -a disable -v "test"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Contact templates

Object name: CONTACTTPL

Refer to the CONTACT <contacts> object

Dependencies

Object name: DEP

Show

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

centreon -u admin -p 'centreon' -o DEP -a show
id;name;description;inherits_parent;execution_failure_criteria;notification_failure_criteria
62;my dependency;a description;1;n;n

Columns are the following:

ColumnDescription
IDUnique ID of the dependency
NameName
DescriptionShort description of the dependency
inherits_parentWhether or not dependency inherits higher level dependencies
execution_failure_criteriaDefines which parent states prevent dependent resources from being checked
notification_failure_criteriaDefines which parent states prevent notifications on dependent resources

Add

In order to add a new dependency, use the ADD action:

centreon -u admin -p 'centreon' -o DEP -a ADD -v "my new dependency;any description;HOST;dummy-host"

The required parameters are the following:

OrderDescription
1Name of the dependency
2Description of the dependency
3Dependency type: HOST, HG, SG, SERVICE, META
4Name of the parent resource(s)

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to delete a dependency, use the DEL action. The dependency name is used for identifying the dependency you would like to delete:

centreon -u admin -p 'centreon' -o DEP -a DEL -v "my dependency"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

In order to set a specific parameter for a dependency, use the SETPARAM action:

centreon -u admin -p 'centreon' -o DEP -a setparam -v "my dependency;name;my new dependency name"

You may change the following parameters:

ParameterDescription
nameName
descriptionDescription
commentComment
inherits_parent0 or 1
execution_failure_criteriao,w,u,c,p,d,n
notification_failure_criteriao,w,u,c,p,d,n

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Listdep

If you want to retrieve the dependency definition of a dependency object, use the LISTDEP action:

centreon -u admin -p 'centreon' -o DEP -a LISTDEP -v "my dependency"
parents;children
HostParent1|HostParent2;HostChild1|HostChild2,ServiceChild2

Addparent and Addchild

If you want to add a new parent or a new child in a dependency definition, use the ADDPARENT or ADDCHILD action:

centreon -u admin -p 'centreon' -o DEP -a ADDPARENT -v "my dependency;my_parent_host"
centreon -u admin -p 'centreon' -o DEP -a ADDCHILD -v "my dependency;my_child_host"
centreon -u admin -p 'centreon' -o DEP -a ADDCHILD -v "my dependency;my_child_host2,my_child_service2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delparent and Delchild

In order to delete a parent or a child in a dependency definition, use the DELPARENT or DELCHILD action:

centreon -u admin -p 'centreon' -o DEP -a DELPARENT -v "my dependency;my_parent_host"
centreon -u admin -p 'centreon' -o DEP -a DELCHILD -v "my dependency;my_child_host"
centreon -u admin -p 'centreon' -o DEP -a DELCHILD -v "my dependency;my_child_host2,my_child_service2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Downtimes

Object name: DOWNTIME

Show

In order to list available recurring downtimes, use the SHOW action:

centreon -u admin -p 'centreon' -o DOWNTIME -a show
id;name;description;activate
1;mail-backup;sunday backup;1
2;my downtime;a description;1

Columns are the following:

ColumnDescription
IDUnique ID of the recurring downtime
NameName
DescriptionShort description of the recurring downtime
ActivateWhether or not the downtime is activated

In order to show resources of a downtime, use the Show action with parameters:

centreon -u admin -p 'centreon' -o DOWNTIME -a show -v "mail-backup;host"

The parameters are the following:

OrderDescription
1Name of the downtime
2(optional) Object type (host, hg, service, sg)

Add

In order to add a new downtime, use the ADD action:

centreon -u admin -p 'centreon' -o DOWNTIME -a ADD -v "my new downtime;any description"

The required parameters are the following:

OrderDescription
1Name of the downtime
2Description of the downtime

Del

In order to delete a downtime, use the DEL action. The downtime name is used for identifying the recurring downtime you would like to delete:

centreon -u admin -p 'centreon' -o DOWNTIME -a DEL -v "my downtime"

Setparam

In order to set a specific parameter for a downtime, use the SETPARAM action:

centreon -u admin -p 'centreon' -o DOWNTIME -a setparam -v "my downtime;name;my new downtime name"

You may change the following parameters:

ParameterDescription
nameName
descriptionDescription

Listperiods

If you want to retrieve the periods set on a recurring downtime, use the LISTPERIODS action:

centreon -u admin -p 'centreon' -o DOWNTIME -a LISTPERIODS -v "my downtime"
position;start time;end time;fixed;duration;day of week;day of month;month cycle
1;1;23:00:00;24:00:00;1;;7;;all
2;1;00:00:00;02:00:00;1;;;1,2;none
3;1;13:45:00;14:40:00;1;;5;;first

Columns are the following:

ColumnDescription
PositionPosition of the period; used for deleting a period from a recurring downtime
Start timeStart time of the recurring downtime
End timeEnd time of the recurring downtime
FixedType of downtime (1 = fixed, 0 = flexible)
DurationDuration of downtime when in flexible mode (seconds)
Day of week1 - 7 (1 = monday ... 7 = sunday)
Day of month1 - 31
Month cycle"all", "none", "first" or "last". Determines when the downtime will be effective on specific weekdays (i.e: all Sundays, last Sunday of the month, first Sunday of the month...)

Addweeklyperiod

In order to add a weekly period, use the ADDWEEKLYPERIOD action:

centreon -u admin -p 'centreon' -o DOWNTIME -a ADDWEEKLYPERIOD -v "my downtime;00:00;04:00;0;7200;saturday,sunday"

The above example will set a downtime every saturday and sunday between 00:00 and 04:00.

ParameterDescription
NameName of the recurring downtime
Start timeStart time of the recurring downtime
End timeEnd time of the recurring downtime
Fixed0 for flexible downtime, 1 for fixed
DurationDuration of downtime when in flexible mode (seconds)
Day of weekCan be written with letters or numbers (1 to 7 or monday to sunday)

Addmonthlyperiod

In order to add a monthly period, use the ADDMONTHLYPERIOD action:

centreon -u admin -p 'centreon' -o DOWNTIME -a ADDMONTHLYPERIOD -v "my downtime;19:00;22:00;1;;14,21"

The above example will set a downtime on every 14th and 21st day for all months.

ParameterDescription
NameName of the recurring downtime
Start time Start time of the recurring downtime
End timeEnd time of the recurring downtime
Fixed0 for flexible downtime, 1 for fixed
DurationDuration of downtime when in flexible mode (seconds)
Day of month1 to 31

Addspecificperiod

In order to add a specific period, use the ADDSPECIFICPERIOD action:

centreon -u admin -p 'centreon' -o DOWNTIME -a ADDSPECIFICPERIOD -v "my downtime;19:00;22:00;1;;wednesday;first"

The above example will set a downtime on every first wednesday for all months.

ParameterDescription
NameName of the recurring downtime
Start time Start time of the recurring downtime
End timeEnd time of the recurring downtime
Fixed0 for flexible downtime, 1 for fixed
DurationDuration of downtime when in flexible mode (seconds)
Day of weekCan be written with letters or numbers (1 to 7 or monday to sunday)
Month cyclefirst or last

Addhost, addhostgroup, addservice, addservicegroup

If you want to associate a host, host group, service or service group to a recurring downtime, use the ADDHOST, ADDHOSTGROUP, ADDSERVICE or ADDSERVICEGROUP action:

centreon -u admin -p 'centreon' -o DOWNTIME -a ADDHOST -v "my downtime;host_1"
centreon -u admin -p 'centreon' -o DOWNTIME -a ADDSERVICE -v "my downtime;host_1,service_1"

Use the "|" delimiter in order to define multiple relationships.

Delhost, delhostgroup, delservice, delservicegroup

If you want to remove a host, host group, service or service group from a recurring downtime, use the DELHOST, DELHOSTGROUP, DELSERVICE or DELSERVICEGROUP action:

centreon -u admin -p 'centreon' -o DOWNTIME -a DELHOST -v "my downtime;host_1"
centreon -u admin -p 'centreon' -o DOWNTIME -a DELSERVICE -v "my downtime;host_1,service_1"

Sethost, sethostgroup, setservice, setservicegroup

The SETHOST, SETHOSTGROUP, SETSERVICE AND SETSERVICEGROUP actions are similar to their ADD counterparts, but they will overwrite the relationship definitions instead of appending them:

centreon -u admin -p 'centreon' -o DOWNTIME -a ADDHOST -v "my downtime;host_1|host_2"
centreon -u admin -p 'centreon' -o DOWNTIME -a ADDSERVICE -v "my downtime;host_1,service_1|host_2,service_2"

Use the "|" delimiter in order to define multiple relationships.

Host categories

Object name: HC

Show

In order to list available host categories, use the SHOW action:

centreon -u admin -p 'centreon' -o HC -a show
id;name;alias;members
1;Linux;Linux Servers;host1
2;Windows;Windows Server;host2
3;AS400;AS400 systems;host3,host4

Columns are the following:

ColumnDescription
NameName of host category
AliasAlias of host category

Add

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

centreon -u admin -p 'centreon' -o HC -a add -v "Databases;Databases servers"

Required parameters are the following:

OrderDescription
1Name of host category
2Alias of host category

Del

In order to delete a host category, use the DEL action. The name is used for identifying the host category you want to delete:

centreon -u admin -p 'centreon' -o HC -a DEL -v "Databases"

Getmember

In order to view the list hosts in a host category, use the GETMEMBER action:

centreon -u admin -p 'centreon' -o HC -a getmember -v "Linux"
id;name
14;Centreon-Server
15;srv-test

Addmember and Setmember

In order to add a host or a host template into a host category, use the ADDMEMBER or SETMEMBER action where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o HC -a addmember -v "Linux;host7"
centreon -u admin -p 'centreon' -o HC -a setmember -v "Windows;host7|host8|host9"

The needed parameters are the following:

OrderDescription
1Host category name
2Host names to add/set. For multiple definitions, use the *

Setseverity

In order to turn a host category into a severity, use the SETSEVERITY action:

centreon -u admin -p 'centreon' -o HC -a setseverity -v "Critical;3;16x16/critical.gif"

The needed parameters are the following:

OrderDescription
1Host category name
2Severity level - must be a number
3Icon that represents the severity

Unsetseverity

In order to turn a severity into a regular host category, use the UNSETSEVERITY action:

centreon -u admin -p 'centreon' -o HC -a unsetseverity -v "Critical"

The needed parameters are the following:

OrderDescription
1Host category name

Delmember

In order to remove a host or a host template from a host category, use the DELMEMBER action:

centreon -u admin -p 'centreon' -o HC -a delmember -v "Linux;host7"
centreon -u admin -p 'centreon' -o HC -a delmember -v "Windows;host8"

The needed parameters are the following:

OrderDescription
1Host category name
2Host names to remove from host category
Host group services

Object name: HGSERVICE

Refer to the SERVICE <services> object

NOTE: HGSERVICE works just like SERVICE, you only need to replace the host name with the host group name.

Host groups

Object name: HG

Show

In order to list available host groups, use the SHOW action:

centreon -u admin -p 'centreon' -o HG -a show
id;name;alias
53;Linux-Servers;All linux servers
54;Windows-Servers;All windows servers
55;Networks;All other equipments
56;Printers;All printers
58;Routers;All routers
59;Switches;All switches
60;Firewall;All firewalls
61;Unix-Servers;All Unix servers

Columns are the following:

ColumnDescription
ID ID
NameName
AliasAlias

Add

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

centreon -u admin -p 'centreon' -o HG -a add -v "SAP;SAP servers"

The required parameters are the following:

OrderDescription
1Name of host group
2Alias of host group

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to delete one hostgroup, use the DEL action. The host group name is used for identifying the host group you would like to delete:

centreon -u admin -p 'centreon' -o HG -a DEL -v "SAP"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

In order to set a specific parameter for a host group, use the SETPARAM action:

centreon -u admin -p 'centreon' -o HG -a setparam -v "SAP;name;hg1"
centreon -u admin -p 'centreon' -o HG -a setparam -v "SAP;alias;hg2"

You may change the following parameters:

ParameterDescription
nameName
aliasAlias
commentComment
activate1 when enabled, 0 otherwise
notesNotes
notes_urlNotes URL
action_urlAction URL
icon_imageIcon image
map_icon_imageMap icon image

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getparam

In order to get specific parameters on a host group, use the GETPARAM action:

centreon -u admin -p 'centreon' -o HG -a getparam -v "test;alias"
alias
test
centreon -u admin -p 'centreon' -o HG -a getparam -v "test;alias|alia|comment"
Object not found:alia
centreon -u admin -p 'centreon' -o HOST -a getparam -v "test;alias|comment|notes"
alias;comment;notes
test;my comment;my notes

You may edit the following parameters:

ParameterDescription
nameName
aliasAlias
commentComment
activate1 when enabled, 0 otherwise
notesNotes
notes_urlNotes URL
action_urlAction URL
icon_imageIcon image
map_icon_imageMap icon image

Getmember

If you want to retrieve the members of a host group, use the GETMEMBER action:

centreon -u admin -p 'centreon' -o HG -a getmember -v "Linux-Servers"
id;name
34;Centreon-Server
35;srv-web

Addmember and Setmember

If you want to add members to a specific host group, use the SETMEMBER or ADDMEMBER action:

centreon -u admin -p 'centreon' -o HG -a setmember -v "Linux-Servers;srv-test|srv-test2"
centreon -u admin -p 'centreon' -o HG -a addmember -v "Linux-Servers;srv-new"
ActionDescription
set*Overwrites previous definitions. Use the delimiter
add*Appends new members to the existing ones. Use the delimiter

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delmember

If you want to remove members from a specific host group, use the DELMEMBER action:

centreon -u admin -p 'centreon' -o HG -a delmember -v "Linux-Servers;srv-test"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Hosts

Object name: HOST

Show

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

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
85;sri-dev4;dev4;192.168.2.4;1
86;sri-dev5;dev5;192.168.2.5;1
87;sri-dev6;dev6;192.168.2.6;1
94;sri-dev7;dev7;192.168.2.7;1
95;sri-dev8;dev8;192.168.2.8;1

You can also specify the host to search:

centreon -u admin -p 'centreon' -o HOST -a show -v 'sri-dev1'
id;name;alias;address;activate
82;sri-dev1;dev1;192.168.2.1;1

Columns are the following :

ColumnDescription
IDID of host
NameHost name
AliasHost alias
IP/AddressIP of host
Activate1 when enabled, 0 when disabled

Show by address

In order to list available hosts by address, use the SHOWBYADDRESS action:

centreon -u admin -p 'centreon' -o HOST -a showbyaddress -v 'localhost'
id;name;alias;address;activate
82;sri-dev1;dev1;localhost;1

Columns are the following :

ColumnDescription
IDID of host
NameHost name
AliasHost alias
IP/AddressIP of host
Activate1 when enabled, 0 when disabled

Add

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

centreon -u admin -p 'centreon' -o HOST -a ADD -v "test;Test host;127.0.0.1;generic-host;central;Linux"

Required parameters:

OrderDescription
1Host name
2Host alias
3Host IP address
4Host templates; for multiple definitions, use delimiter **
5Instance name (poller)
6Hostgroup; for multiple definitions, use delimiter **

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to delete one host, use the DEL action. You have to list the available hosts in order to identify the one you want to delete:

centreon -u admin -p 'centreon' -o HOST -a DEL -v "test"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

In order to change parameters on a host configuration, use the SETPARAM action:

centreon -u admin -p 'centreon' -o HOST -a setparam -v "test;alias;Development test"
centreon -u admin -p 'centreon' -o HOST -a setparam -v "test;address;192.168.1.68"
centreon -u admin -p 'centreon' -o HOST -a setparam -v "test;check_period;24x7"
centreon -u admin -p 'centreon' -o HOST -a setparam -v "test;timezone;Europe/Berlin"

You may edit the following parameters:

ParameterDescription
geo_coordsGeo coordinates
2d_coords2D coordinates (used by statusmap)
3d_coords3D coordinates (used by statusmap)
action_urlAction URL
activateWhether or not host is enabled
active_checks_enabledWhether or not active checks are enabled
acknowledgement_timeoutAcknowledgement timeout (in seconds)
addressHost IP Address
aliasAlias
check_commandCheck command
check_command_argumentsCheck command arguments
check_intervalNormal check interval
check_freshnessEnables check freshness
check_periodCheck period
contact_additive_inheritanceEnables contact additive inheritance
cg_additive_inheritanceEnables contactgroup additive inheritance
event_handlerEvent handler command
event_handler_argumentsEvent handler command arguments
event_handler_enabledWhether or not event handler is enabled
first_notification_delayFirst notification delay (in seconds)
flap_detection_enabledWhether or not flap detection is enabled
flap_detection_optionsFlap detection options 'o' for Up, 'd' for Down, 'u' for Unreachable
host_high_flap_thresholdHigh flap threshold
host_low_flap_thresholdLow flap threshold
icon_imageIcon image
icon_image_altIcon image text
max_check_attemptsMaximum number of attempt before a HARD state is declared
nameHost name
notesNotes
notes_urlNotes URL
notifications_enabledWhether or not notification is enabled
notification_intervalNotification interval
notification_optionsNotification options
notification_periodNotification period
recovery_notification_delayRecovery notification delay
obsess_over_hostWhether or not obsess over host option is enabled
passive_checks_enabledWhether or not passive checks are enabled
retain_nonstatus_informationWhether or not there is non-status retention
retain_status_informationWhether or not there is status retention
retry_check_intervalRetry check interval
snmp_communitySnmp Community
snmp_versionSnmp version
stalking_optionsComma separated options: 'o' for OK, 'd' for Down, 'u' for Unreachable
statusmap_imageStatus map image (used by statusmap
host_notification_optionsNotification options (d,u,r,f,s)
timezoneTimezone
commentComment

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getparam

In order to get specific parameters on a host configuration, use the GETPARAM action:

centreon -u admin -p 'centreon' -o HOST -a getparam -v "test;alias"
alias
test
centreon -u admin -p 'centreon' -o HOST -a getparam -v "test;alias|alia|timezone"
Object not found:alia
centreon -u admin -p 'centreon' -o HOST -a getparam -v "test;alias|address|timezone"
alias;address;timezone
test;192.168.56.101;Europe/Berlin

You may edit the following parameters:

ParameterDescription
2d_coords2D coordinates (used by statusmap)
3d_coords3D coordinates (used by statusmap)
action_urlAction URL
activateWhether or not host is enabled
active_checks_enabledWhether or not active checks are enabled
acknowledgement_timeoutAcknowledgement timeout (in seconds)
addressHost IP Address
aliasAlias
check_commandCheck command
check_command_argumentsCheck command arguments
check_intervalNormal check interval
check_freshnessEnables check freshness
check_periodCheck period
contact_additive_inheritanceEnables contact additive inheritance
cg_additive_inheritanceEnables contactgroup additive inheritance
event_handlerEvent handler command
event_handler_argumentsEvent handler command arguments
event_handler_enabledWhether or not event handler is enabled
first_notification_delayFirst notification delay (in seconds)
flap_detection_enabledWhether or not flap detection is enabled
flap_detection_optionsFlap detection options 'o' for Up, 'd' for Down, 'u' for Unreachable
host_high_flap_thresholdHigh flap threshold
host_low_flap_thresholdLow flap threshold
icon_imageIcon image
icon_image_altIcon image text
max_check_attemptsMaximum number of attempt before a HARD state is declared
nameHost name
notesNotes
notes_urlNotes URL
notifications_enabledWhether or not notification is enabled
notification_intervalNotification interval
notification_optionsNotification options
notification_periodNotification period
recovery_notification_delayRecovery notification delay
obsess_over_hostWhether or not obsess over host option is enabled
passive_checks_enabledWhether or not passive checks are enabled
process_perf_dataProcess performance data command
retain_nonstatus_informationWhether or not there is non-status retention
retain_status_informationWhether or not there is status retention
retry_check_intervalRetry check interval
snmp_communitySnmp Community
snmp_versionSnmp version
stalking_optionsComma separated options: 'o' for OK, 'd' for Down, 'u' for Unreachable
statusmap_imageStatus map image (used by statusmap
host_notification_optionsNotification options (d,u,r,f,s)
timezoneTimezone
commentComment

Setinstance

In order to set the instance from which a host will be monitored, use the SETINSTANCE action:

centreon -u admin -p 'centreon' -o HOST -a setinstance -v "Centreon-Server;Poller 1"

Showinstance

To determine the instance from which a host will be monitored, use the SHOWINSTANCE action:

centreon -u admin -p 'centreon' -o HOST -a showinstance -v "Centreon-Server"
id;name
2;Poller 1

Getmacro

In order to view the custom macro list of a host, use the GETMACRO action:

centreon -u admin -p 'centreon' -o HOST -a getmacro -v "Centreon-Server"
macro name;macro value;is_password;description
$_HOSTMACADDRESS$;00:08:C7:1B:8C:02;0;description of macro

Setmacro

In order to set a custom host macro, use the SETMACRO action:

centreon -u admin -p 'centreon' -o HOST -a setmacro -v "Centreon-Server;warning;80;0;description of macro"
centreon -u admin -p 'centreon' -o HOST -a setmacro -v "Centreon-Server;critical;90;0;description of macro"

The required parameters are the following:

OrderDescription
1Host name
2Macro name
3Macro value
41 for a password macro, 0 otherwise
5Description of macro

NOTE: If the macro already exists, this action will only update the macro value. Otherwise, macro will be created.

Delmacro

In order to delete a macro host, use the DELMACRO action:

centreon -u admin -p 'centreon' -o HOST -a delmacro -v "Centreon-Server;warning"
centreon -u admin -p 'centreon' -o HOST -a delmacro -v "Centreon-Server;critical"

Gettemplate

In order to view the template list of a host, use the GETTEMPLATE action:

centreon -u admin -p 'centreon' -o HOST -a gettemplate -v "Centreon-Server"
id;name
2;generic-host
12;Linux-Servers

Addtemplate and Settemplate

In order to add a host template to an existing host, use the ADDTEMPLATE or the SETTEMPLATE action, where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o HOST -a addtemplate -v "Centreon-Server;srv-Linux"
centreon -u admin -p 'centreon' -o HOST -a settemplate -v "Centreon-Server;hardware-Dell"

NOTE: All service templates linked to the new host template will be automatically deployed on the existing host. (no longer the case with version later than 1.3.0, use the 'applytpl' action manually)

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Deltemplate

In order to remove a host template to an existing host, use the DELTEMPLATE action:

centreon -u admin -p 'centreon' -o HOST -a deltemplate -v "test;srv-Linux|hardware-Dell"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Applytpl

When a template host undergoes modified link-level service template, the change is not automatically reflected in hosts belonging to that template. For the change to take effect, it must then re-apply the template on this host. For this, use the APPLYTPL action:

centreon -u admin -p 'centreon' -o HOST -a applytpl -v "test"
All new services are now created.

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getparent

In order to view the parents of a host, use the GETPARENT action:

centreon -u admin -p 'centreon' -o HOST -a getparent -v "Centreon-Server"
id;name
43;server-parent1
44;server-parent2

Addparent and Setparent

In order to add a host parent to an host, use the ADDPARENT or SETPARENT actions where add will append and set will overwrite the previous definitions:

centreon -u admin -p 'centreon' -o HOST -a addparent -v "host;hostParent1"
centreon -u admin -p 'centreon' -o HOST -a setparent -v "host;hostParent1|hostParent2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delparent

In order to remove a parent, use the DELPARENT action:

centreon -u admin -p 'centreon' -o HOST -a delparent -v "Centreon-Server;server-parent1|server-parent2"

Getcontactgroup

In order to view the notification contact groups of a host, use the GETCONTACTGROUP action:

centreon -u admin -p 'centreon' -o HOST -a getcontactgroup -v "Centreon-Server"
id;name
17;Administrators

Addcontactgroup and Setcontactgroup

If you want to add notification contactgroups to a host, use the ADDCONTACTGROUP or SETCONTACTGROUP actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o HOST -a addcontactgroup -v "Centreon-Server;Contactgroup1"
centreon -u admin -p 'centreon' -o HOST -a setcontactgroup -v "Centreon-Server;Contactgroup1|Contactgroup2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcontactgroup

If you want to remove notification contactgroups from a host, use the DELCONTACTGROUP action:

centreon -u admin -p 'centreon' -o HOST -a delcontactgroup -v "Centreon-Server;Contactgroup2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getcontact

In order to view the notification contacts of a host, use the GETCONTACT action:

centreon -u admin -p 'centreon' -o HOST -a getcontact -v "Centreon-Server"
id;name
11;guest

Addcontact and Setcontact

If you want to add notification contacts to a host, use the ADDCONTACT or SETCONTACT actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o HOST -a addcontact -v "Centreon-Server;Contact1"
centreon -u admin -p 'centreon' -o HOST -a setcontact -v "Centreon-Server;Contact1|Contact2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcontact

If you want to remove a notification contacts from a host, use the DELCONTACT action:

centreon -u admin -p 'centreon' -o HOST -a delcontact -v "Centreon-Server;Contact2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Gethostgroup

In order to view the hostgroups that are tied to a host, use the GETHOSTGROUP action:

centreon -u admin -p 'centreon' -o HOST -a gethostgroup -v "Centreon-Server"
id;name
9;Linux-Servers

Addhostgroup and Sethostgroup

If you want to tie hostgroups to a host, use the ADDHOSTGROUP or SETHOSTGROUP actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o HOST -a addhostgroup -v "Centreon-Server;Hostgroup1"
centreon -u admin -p 'centreon' -o HOST -a sethostgroup -v "Centreon-Server;Hostgroup1|Hostgroup2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delhostgroup

If you want to remove hostgroups from a host, use the DELHOSTGROUP action:

centreon -u admin -p 'centreon' -o HOST -a delhostgroup -v "Centreon-Server;Hostgroup2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setseverity

In order to associate a severity to a host, use the SETSEVERITY action:

centreon -u admin -p 'centreon' -o HOST -a setseverity -v "Centreon-Server;Critical"

Required parameters:

OrderDescription
1Host name
2Severity name

Unsetseverity

In order to remove the severity from a host, use the UNSETSEVERITY action:

centreon -u admin -p 'centreon' -o HOST -a unsetseverity -v "Centreon-Server"

Required parameters:

OrderDescription
1Host name

Enable

In order to enable an host, use the ENABLE action:

centreon -u admin -p 'centreon' -o HOST -a enable -v "test"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Disable

In order to disable a host, use the DISABLE action:

centreon -u admin -p 'centreon' -o HOST -a disable -v "test"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Host templates

Object name: HTPL

Refer to the HOST <hosts> object

NOTE: You cannot use the APPLYTPL and SETINSTANCE actions on HTPL objects.

If you are looking for service templates association to host templates refer to ADDHOSTTEMPLATE/SETHOSTTEMPLATE command from STPL <addhosttemplate-and-sethosttemplate> object.

Instances (Pollers)

Object name: INSTANCE

Show

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

centreon -u admin -p 'centreon' -o INSTANCE -a show
id;name;localhost;ip address;activate;status;init script;monitoring engine;bin;stats bin;perfdata;ssh port
1;Central;1;127.0.0.1;1;0;/etc/init.d/nagios;NAGIOS;/usr/local/nagios/bin/nagios;/usr/local/nagios/bin/nagiostats;/usr/local/nagios/var/service-perfdata;22
[...]

Columns are the following:

ColumnDescription
IDID
NameName
Localhost1 if it is the main poller, 0 otherwise
IP AddressIP address of the poller
Activate1 if poller is enabled, 0 otherwise
Status1 if poller is running, 0 otherwise
Init scriptInit script path
BinPath of the Scheduler binary
Stats BinPath of the Nagios Stats binary
SSH PortSSH Port

Add

In order to add an instance you use the ADD action:

centreon -u admin -p 'centreon' -o INSTANCE -a add -v "Poller test;10.30.2.55;22;ZMQ;5556"

Required fields are:

ColumnDescription
Name
AddressIP address of the poller
SSH PortSSH port
Gorgone Communication TypeZMQ (1) or SSH (2)
Gorgone Communication PortPort used by Gorgone to communicate

Del

If you want to remove an instance, use the DEL action. The Name is used for identifying the instance to delete:

centreon -u admin -p 'centreon' -o INSTANCE -a del -v "Poller test"

Setparam

If you want to change a specific parameter of an instance, use the SETPARAM command. The Name is used for identifying the instance to update:

centreon -u admin -p 'centreon' -o INSTANCE -a setparam -v "Poller test;ns_ip_address;10.30.2.99"

Arguments are composed of the following columns:

OrderColumn description
1Name of instance
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
nameName of the poller
localhost1 if it is the main poller, 0 otherwise
ns_ip_addressIP address of the poller
ns_activate1 if poller is enabled, 0 otherwise
engine_start_commandCommand to start Centreon Engine process
engine_stop_commandCommand to stop Centreon Engine process
engine_restart_commandCommand to restart Centreon Engine process
engine_reload_commandCommand to reload Centreon Engine process
nagios_binPath of the Scheduler binary
nagiostats_binPath of the Nagios Stats binary
ssh_portSSH Port
broker_reload_commandCommand to reload Centreon Broker process
centreonbroker_cfg_pathCentreon Broker Configuration path
centreonbroker_module_pathCentreon Broker Module path

Gethosts

If you want to list all hosts that are monitored by a poller, use the GETHOSTS action. The Name is used for identifying the instance to query:

centreon -u admin -p 'centreon' -o INSTANCE -a GETHOSTS -v "Poller test"
14;Centreon-Server;127.0.0.1
17;srv-website;10.30.2.1

Returned info is the following:

OrderDescription
1Host ID
2Host name
3Host address

LDAP configuration

Object name: LDAP

Show

In order to list available LDAP configurations, use the SHOW action:

centreon -u admin -p 'centreon' -o LDAP -a show
id;name;description;status
3;ad;my ad conf;1
2;openldap;my openldap conf;1
[...]

Columns are the following:

OrderDescription
1ID
2Configuration name
3Configuration description
41 when enabled, 0 when disabled

Add

In order to add an LDAP configuration, use the ADD action:

centreon -u admin -p 'centreon' -o LDAP -a add -v "my new configuration;my description"

Required fields are:

OrderDescription
1Configuration name
2Configuration description

Del

If you want to remove an LDAP configuration, use the DEL action. The Configuration Name is used for identifying the LDAP configuration to delete:

centreon -u admin -p 'centreon' -o LDAP -a del -v "my new configuration"

Setparam

If you want to change a specific parameter of an LDAP configuration, use the SETPARAM action. The Configuration Name is used for identifying the LDAP configuration to update:

centreon -u admin -p 'centreon' -o LDAP -a SETPARAM -v "my new configuration;description;my new desc"

Parameters use the following order:

OrderDescription
1Configuration to update
2Parameter key
3Parameter value

Parameters that you may change are the following:

KeyDescription
nameConfiguration name
descriptionConfiguration description
enable1 when enabled, 0 when disabled
aliasAlias
bind_dnBind DN
bind_passBind password
group_base_searchGroup base search
group_filterGroup filter
group_memberGroup member
group_nameGroup name
ldap_auto_importEnable or disable auto import (0 or 1)
ldap_contact_tmplContact template to use on import
ldap_dns_use_domainUse domain or not (0 or 1)
ldap_search_limitSearch size limit
ldap_search_timeoutTimeout delay (in seconds)
ldap_srv_dnsDNS server (only used when ldap_dns_use_domain is set to 1)
ldap_store_passwordStore password in database or not (0 or 1)
ldap_templatePossible values: Posix, Active Directory
protocol_versionProtocol version (2 or 3)
user_base_searchUser base search
user_emailUser email
user_filterUser filter
user_firstnameUser firstname
user_lastnameUser lastname
user_nameUser name
user_pagerUser phone number
user_groupUser group

Showserver

In order to show the server list of an LDAP configuration, use the SHOWSERVER action. The Configuration Name is used for identifying the LDAP configuration to query:

centreon -u admin -p 'centreon' -o LDAP -a SHOWSERVER -v "openldap"
id;address;port;ssl;tls;order
2;10.30.2.3;389;0;0;1

Addserver

In order to add a server to an LDAP configuration, use the ADDSERVER action:

centreon -u admin -p 'centreon' -o LDAP -a ADDSERVER -v "openldap;10.30.2.15;389;0;1"

Required parameters are the following:

OrderDescription
1Configuration name
2Server address
3Server port
4Use SSL or not
5Use TLS or not

Delserver

In order to remove a server from an LDAP configuration, use the DELSERVER action. The server ID is used for identifying the server to delete:

centreon -u admin -p 'centreon' -o LDAP -a DELSERVER -v 2

Setparamserver

In order to update the server parameters of an LDAP configuration, use the SETPARAMSERVER action. The server ID is used for identifying the server to update:

centreon -u admin -p 'centreon' -o LDAP -a SETPARAMSERVER -v "2;use_ssl;1"

Parameters that you may update are the following:

KeyDescriptionPossible values
host_addressAddress of the server
host_portPort of the server
host_orderPriority order in case of failover
use_sslUse SSL or not0 or 1
use_tlsUse TLS or not0 or 1

Realtime acknowledgement

Object name: RTACKNOWLEDGEMENT

Show host realtime acknowledgement

In order to list available realtime acknowledgement, use the SHOW action: You can use the value "HOST" to display all the acknowledgement:

centreon -u admin -p 'centreon' -o RTACKNOWLEDGEMENT -a show -v "HOST;generic-host"
id;host_name;entry_time;author;comment_data;sticky;notify_contacts;persistent_comment
6;generic-host;2017/09/28 14:21;admin;'generic-comment';2;0;1

Columns are the following :

ColumnDescription
IdId of the acknowledgement
Host_nameName of the host
Entry_timeBeginning of acknowledgement
AuthorName of the author
Comment_dataShort description of the acknowledgement
StickyAcknowledgement will be maintained in case of a change of Not-OK status (0/2)
Notify_contactsNotification send to the contacts linked to the object (0/1)
Persistent_commentAcknowledgement will be maintained in the case of a restart of the scheduler (0/1)

Show service realtime acknowledgement

In order to list available realtime acknowledgement, use the SHOW action: You can use the value "SVC" to display all the acknowledgement:

centreon -u admin -p 'centreon' -o RTACKNOWLEDGEMENT -a show -v "SVC;generic-host,generic-service"
id;host_name;service_name;entry_time;author;comment_data;sticky;notify_contacts;persistent_comment
42;generic-host;generic-service;2017/09/28 14:21;admin;'generic-comment';2;0;1

Columns are the following :

ColumnDescription
IdId of the acknowledgement
Host_nameName of the host
Service_nameName of the service
Entry_timeBeginning of acknowledgement
AuthorName of the author
Comment_dataShort description of the acknowledgement
StickyAcknowledgement will be maintained in case of a change of Not-OK status (0/2)
Notify_contactsNotification send to the contacts linked to the object (0/1)
Persistent_commentAcknowledgement will be maintained in the case of a restart of the scheduler (0/1)

Add host realtime acknowledgement

If you want to associate a host to a realtime acknowledgement, use the ADD action:

centreon -u admin -p 'centreon' -o RTACKNOWLEDGEMENT -a add -v "HOST;central;my comments;2;0;1"

The required parameters are the following :

OrderDescription
1Value you want to associate
2Name of the host (Name of the service)
3Short description of the realtime acknowledgement
4Acknowledgement maintained in case of a change of status (Sticky use 0 or 2)
5Notification send to the contacts linked to the object (Notify use 0 or 1)
6Maintained th acknowledgement in the case of a restart of the scheduler (Persistent use 0 or 1)

Add service realtime acknowledgement

If you want to associate a service or service group to a realtime acknowledgement, use the ADD action:

centreon -u admin -p 'centreon' -o RTACKNOWLEDGEMENT -a add -v "SVC;central,ping|central,memory;my comments;2;0;1"

The required parameters are the following :

OrderDescription
1Value you want to associate
2Name of the host , name of the service
3Short description of the realtime acknowledgement
4Acknowledgement maintained in case of a change of status (Sticky use 0 or 2)
5Notification send to the contacts linked to the object (Notify use 0 or 1)
6Maintained th acknowledgement in the case of a restart of the scheduler (Persistent use 0 or 1)

Cancel a realtime acknowledgement

In order to cancel a realtime acknowledgement, use the CANCEL action:

centreon -u admin -p 'centreon' -o RTACKNOWLEDGEMENT -a cancel -v "central,ping"

The required parameters are the following :

OrderDescription
1Name of acknowledged resource(s)

Realtime downtimes

Object name: RTDOWNTIME

Show host realtime downtime

In order to list available realtime downtimes, use the SHOW action: You can use the value "HOST" to display all the downtimes:

centreon -u admin -p 'centreon' -o RTDOWNTIME -a show -v "HOST;generic-host"
id;host_name;author;actual_start_time;actual_end_time;start_time;end_time;comment_data;duration;fixed
6;generic-host;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1

Columns are the following :

ColumnDescription
idName of the downtime
Host_nameName of the host
AuthorName of the author
Actual_start_timeActual start date in case of flexible downtime
Actual_end_timeActual end date in case of flexible downtime
Start_timeBeginning of downtime
End_timeEnd of downtime
Comment_dataShort description of the realtime downtime
DurationDuration of Downtime
FixedDowntime starts and stops at the exact start and end times

Show service realtime downtime

In order to list available realtime downtimes, use the SHOW action: You can use the value "SVC" to display all the downtimes:

centreon -u admin -p 'centreon' -o RTDOWNTIME -a show -v "SVC;generic-host,generic-service"
id;host_name;service_name;author;start_time;end_time;comment_data;duration;fixed
42;generic-host;generic-service;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1

Columns are the following :

ColumnDescription
idName of the downtime
Host_nameName of the host
Service_nameName of the service
AuthorName of the author
Actual_start_timeActual start date in case of flexible downtime
Actual_end_timeActual end date in case of flexible downtime
Start_timeBeginning of downtime
End_timeEnd of downtime
Comment_dataShort description of the realtime downtime
DurationDuration of Downtime
FixedDowntime starts and stops at the exact start and end times

Add host and host group realtime downtime

If you want to associate a host, host group to a realtime downtime, use the ADD action: To set the value of the start/end, use following format : YYYY/MM/DD HH:mm:

centreon -u admin -p 'centreon' -o RTDOWNTIME -a add -v "HOST;central;2017/09/24 10:00;2017/09/24 12:00;1;3600;my comments;1"
centreon -u admin -p 'centreon' -o RTDOWNTIME -a add -v "HG;linux-servers;2017/09/24 10:00;2017/09/24 12:00;1;3600;my comments;1"

The required parameters are the following :

OrderDescription
1Value you want to associate
2Name of the host (Name of the service)
3Beginning of downtime
4End of downtime
5Type of downtime (1 = fixed, 0 = flexible)
6Duration of downtime for flexible mode (seconds)
7Short description of the realtime downtime
8Apply downtime on linked services (0/1)

Add service and service group realtime downtime

If you want to associate a service or service group to a realtime downtime, use the ADD action: To set the value of the start/end, use following format : YYYY/MM/DD HH:mm:

centreon -u admin -p 'centreon' -o RTDOWNTIME -a add -v "SVC;central,ping|central,memory;2017/09/24 10:00;2017/09/24 12:00;1;3600;my comments"
centreon -u admin -p 'centreon' -o RTDOWNTIME -a add -v "SG;servicegroup1;2017/09/24 10:00;2017/09/24 12:00;1;3600;my comments"

The required parameters are the following :

OrderDescription
1Value you want to associate
2Name of the host (Name of the service)
3Beginning of downtime
4End of downtime
5Type of downtime (1 = fixed, 0 = flexible)
6Duration of downtime for flexible mode (seconds)
7Short description of the realtime downtime

Add instance realtime downtime

In order to add a new realtime downtime for a poller, use the ADD action: To set the value of the start/end, use following format : YYYY/MM/DD HH:mm:

centreon -u admin -p 'centreon' -o RTDOWNTIME -a add -v "INSTANCE;Central;2017/09/24 10:00;2017/09/24 12:00;1;3600;my comments

The required parameters are the following :

OrderDescription
1Value you want to associate
2Name of the poller
3Beginning of downtime
4End of downtime
5Type of downtime (1 = fixed, 0 = flexible)
6Duration of downtime for flexible mode (seconds)
7Short description of the realtime downtime

Cancel a realtime downtime

In order to cancel a realtime downtime, use the CANCEL action: To get the value of the id, use the SHOW action:

centreon -u admin -p 'centreon' -o RTDOWNTIME -a cancel -v "6|42"

The required parameters are the following :

OrderDescription
1Id of downtime

Resource CFG

Object name: RESOURCECFG

Show

In order to list available Resource variables, use the SHOW action:

centreon -u admin -p 'centreon' -o RESOURCECFG -a show
id;name;value;comment;activate;instance
1;$USER1$;/usr/local/nagios/libexec;path to the plugins;1;Central
[...]

Columns are the following :

ColumnDescription
IDID
NameName
ValueValue of $USERn$ macro
CommentComment
Activate1 when activated, 0 otherwise
InstanceInstances that are tied to the $USERn$ macro

Add

In order to add a resource macro, use the ADD action:

centreon -u admin -p 'centreon' -o RESOURCECFG -a add -v "USER2;public;Poller test;my comment"

Required fields are:

ColumnDescription
NameMacro name; do not use the $ symbols
ValueMacro value
InstancesInstances that are tied to $USERn$ macro
CommentComment

Del

If you want to remove a Resource variable, use the DEL action. The ID is used for identifying the variable to delete:

centreon -u admin -p 'centreon' -o RESOURCECFG -a del -v "1"

Setparam

If you want to change a specific parameter of a Resource macro, use the SETPARAM action. The ID is used for identifying the macro to update:

centreon -u admin -p 'centreon' -o RESOURCECFG -a setparam -v "1;instance;Poller test|AnotherPoller"

Arguments are composed of the following columns:

OrderColumn description
1ID number of resource configuration
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
nameMacro name; do not use the $ symbols
valueMacro value
activate1 when activated, 0 otherwise
commentComment
instanceInstances that are tied to $USERn$ macro Use delimiter *

Service categories

Object name: SC

Show

In order to list available service categories, use the SHOW action:

centreon -u admin -p 'centreon' -o SC -a show
id;name;description
1;Ping;ping
2;Traffic;traffic
3;Disk;disk

Columns are the following:

ColumnDescription
NameName of service category
DescriptionDescription of service category

Add

In order to add a service category, use the ADD action:

centreon -u admin -p 'centreon' -o SC -a ADD -v "Alfresco;Alfresco Services"

Required parameters are:

ColumnDescription
NameName of service category
DescriptionDescription of service category

Del

In order to remove a service category, use the DEL:

centreon -u admin -p 'centreon' -o SC -a del -v "Alfresco"

Setparam

In order to change parameters for a service category, use the SETPARAM action:

centreon -u admin -p 'centreon' -o SC -a setparam -v "SG1;name;Web Service"

You can change the following parameters:

ParameterDescription
NameName of service category
DescriptionDescription of service category

Getservice and Getservicetemplate

In order to view the member list of a service category, use the GETSERVICE or GETSERVICETEMPLATE action:

centreon -u admin -p 'centreon' -o SC -a getservice -v "Ping-Category"
host id;host name;service id;service description
14;Centreon-Server;27;Ping
27;srv-web;42;Ping
centreon -u admin -p 'centreon' -o SC -a getservicetemplate -v "Ping-Category"
template id;service template description
22;Ping-LAN
23;Ping-WAN

Addservice, Setservice , Addservicetemplate and Setservicetemplate

In order to add a new element to a specific service category, you use the following action ADDSERVICETEMPLATE, where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SC -a addservicetemplate -v "Ping-Category;my template"

Delservice and Delservicetemplate

In order to remove a service from a specific service category, use the DELSERVICE OR DELSERVICETEMPLATE actions:

centreon -u admin -p 'centreon' -o SC -a delservice -v "Ping-Category;my host,my service"
centreon -u admin -p 'centreon' -o SC -a delservicetemplate -v "Ping-Category;my template"

Setseverity

In order to turn a service category into a severity, use the SETSEVERITY action:

centreon -u admin -p 'centreon' -o SC -a setseverity -v "Critical;3;16x16/critical.gif"

The needed parameters are the following:

OrderDescription
1Service category name
2Severity level - must be a number
3Icon that represents the severity

Unsetseverity

In order to turn a severity into a regular service category, use the UNSETSEVERITY action:

centreon -u admin -p 'centreon' -o SC -a unsetseverity -v "Critical"

The needed parameters are the following:

OrderDescription
1Service category name

Service groups

Object name: SG

Show

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

centreon -u admin -p 'centreon' -o SG -a show
id;name;alias
11;Alfresco;Alfresco Services

You can also specify the servicegroup to search:

centreon -u admin -p 'centreon' -o SG -a show -v 'Alfresco'
id;name;alias
11;Alfresco;Alfresco Services

Add

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

centreon -u admin -p 'centreon' -o SG -a ADD -v "Alfresco;Alfresco Services"

Required fields are:

OrderDescription
1Name of service group
2Alias of service group

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to remove a servicegroup, use the DEL action:

centreon -u admin -p 'centreon' -o SG -a del -v "Alfresco"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

In order to change parameters for a servicegroup, use the SETPARAM action:

centreon -u admin -p 'centreon' -o SG -a setparam -v "SG1;name;Web Service"

You can change the following parameters:

ParameterDescription
activate1 when service is enabled, 0 otherwise
nameName of service group
aliasAlias of service group
commentComments regarding service group

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getparam

In order to get specific parameters on a servicegroup, use the GETPARAM action:

centreon -u admin -p 'centreon' -o SG -a getparam -v "test;alias"
alias
test
centreon -u admin -p 'centreon' -o SG -a getparam -v "test;alias|alia|comment"
Object not found:alia
centreon -u admin -p 'centreon' -o SG -a getparam -v "test;alias|name|comment"
alias;name;comment
Web service;app1;my best app1

You may edit the following parameters:

ParameterDescription
activate1 when service is enabled, 0 otherwise
nameName of service group
aliasAlias of service group
commentComments regarding service group

Getservice and Gethostgroupservice

In order to view the members of a service group, use the GETSERVICE or GETHOSTGROUPSERVICE actions:

centreon -u admin -p 'centreon' -o SG -a getservice -v "Web-Access"
host id;host name;service id;service description
14;Centreon-Server;28;http
14;Centreon-Server;29;TCP-80
centreon -u admin -p 'centreon' -o SG -a gethostgroupservice -v "Web-Access"
hostgroup id;hostgroup name;service id;service description
22;Web group;31;mysql

NOTE: hostgroupservice is a service by hostgroup

Addservice, Setservice, Addhostgroupservice and Sethostgroupservice

In order to add a new element to a specific service group, you can use ADDSERVICE, SETSERVICE, ADDHOSTGROUPSERVICE, SETHOSTGROUPSERVICE where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SG -a addservice -v "Web-Access;www.centreon.com,http"
centreon -u admin -p 'centreon' -o SG -a setservice -v "Web-Access;www.centreon.com,TCP-80|www.centreon.com,http|www.centreon.com,mysql"
centreon -u admin -p 'centreon' -o SG -a sethostgroupservice -v "Web-Access;web group,TCP-80"

NOTE: hostgroupservice is a service by hostgroup

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delservice and Delhostgroupservice

In order to remove a service from a service group, use the DELSERVICE or DELHOSTGROUPSERVICE actions:

centreon -u admin -p 'centreon' -o SG -a delservice -v "Web-Access;www.centreon.com,http"
centreon -u admin -p 'centreon' -o SG -a delhostgroupservice -v "Web-Access;Web group,mysql"

NOTE: hostgroupservice is a service by hostgroup

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Services

Object name: SERVICE

Show

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

centreon -u admin -p 'centreon' -o SERVICE -a show
host id;host name;id;description;check command;check command arg;normal check interval;retry check interval;max check attempts;active checks enabled;passive checks enabled;activate
14;Centreon-Server;19;Disk-/;;;;;;2;2;1
14;Centreon-Server;20;Disk-/home;;;;;;2;2;1
14;Centreon-Server;21;Disk-/opt;;;;;;2;2;1
14;Centreon-Server;22;Disk-/usr;;;;;;2;2;1
14;Centreon-Server;23;Disk-/var;;;;;;2;2;1
14;Centreon-Server;151;Load;;;;;;2;2;1
14;Centreon-Server;25;Memory;;;;;;2;2;1
14;Centreon-Server;26;Ping;;;;;;2;2;0
14;Centreon-Server;40;dummy;check_centreon_dummy;!2!critical;;;;2;2;1

You can also specify the service to search:

centreon -u admin -p 'centreon' -o SERVICE -a show -v 'Disk-/'
host id;host name;id;description;check command;check command arg;normal check interval;retry check interval;max check attempts;active checks enabled;passive checks enabled;activate
14;Centreon-Server;19;Disk-/;;;;;;2;2;1
15;Centreon-DB;20;Disk-/;;;;;;2;2;1

Or can specify service on host to search:

centreon -u admin -p 'centreon' -o SERVICE -a show -v 'Centreon-Server;Disk-/'
host id;host name;id;description;check command;check command arg;normal check interval;retry check interval;max check attempts;active checks enabled;passive checks enabled;activate
14;Centreon-Server;19;Disk-/;;;;;;2;2;1

Columns are the following:

ColumnDescription
Host IDHost ID
Host nameHost name
Service IDService ID
Service descriptionService description
Check CommandCheck command
Command argumentsCheck command arguments
Normal check intervalNormal check interval
Retry check intervalRetry check interval
Max check attemptsMaximum check attempts
Active check enable1 when active checks are enabled, 0 otherwise
Passive check enable1 when passive checks are enabled, 0 otherwise
Activate1 when enabled, 0 when disabled

Add

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

centreon -u admin -p 'centreon' -o SERVICE -a add -v "Host-Test;ping;Ping-LAN"

The required fields are:

OrderDescription
1Host name
2Service description
3Service template - Only one service template can be defined

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to remove a service, use the DEL action:

centreon -u admin -p 'centreon' -o SERVICE -a del -v "test;ping"

The required fields are:

OrderDescription
1Host name
2Service description

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

In order to set a specific paremeter for a particular service, use the SETPARAM action:

centreon -u admin -p 'centreon' -o SERVICE -a setparam -v "test;ping;max_check_attempts;10"
centreon -u admin -p 'centreon' -o SERVICE -a setparam -v "test;ping;normal_check_interval;2"
centreon -u admin -p 'centreon' -o SERVICE -a setparam -v "test;ping;normal_check_interval;10"

The required fields are:

OrderDescription
1Host name
2Service description
3Parameter that you want to update
4New parameter value

Parameters that may be modified:

ParameterDescription
activate1 when service is enabled, 0 otherwise
descriptionDescription
templateName of the service template
is_volatile1 when service is volatile, 0 otherwise
check_periodName of the check period
check_commandName of the check command
check_command_argumentsArguments that go along with the check command, prepend each argument with the '!' character
max_check_attemptsMaximum number of attempt before a HARD state is declared
normal_check_intervalvalue in minutes
retry_check_intervalvalue in minutes
active_checks_enabled1 when active checks are enabled, 0 otherwise
passive_checks_enabled1 when passive checks are enabled, 0 otherwise
notifications_enabled1 when notification is enabled, 0 otherwise
contact_additive_inheritanceEnables contact additive inheritance
cg_additive_inheritanceEnables contactgroup additive inheritance
notification_intervalvalue in minutes
notification_periodName of the notification period
notification_optionsStatus linked to notifications
first_notification_delayFirst notification delay in seconds
recovery_notification_delayRecovery notification delay
obsess_over_service1 when obsess over service is enabled, 0 otherwise
check_freshness1 when check freshness is enabled, 0 otherwise
freshness_thresholdValue in seconds
event_handler_enabled1 when event handler is enabled, 0 otherwise
flap_detection_enabled1 when flap detection is enabled, 0 otherwise
retain_status_information1 when status information is retained, 0 otherwise
retain_nonstatus_information1 when non status information is retained, 0 otherwise
event_handlerName of the event handler command
event_handler_argumentsArguments that go along with the event handler, prepend each argument with the '!' character
notesNotes
notes_urlNotes URL
action_urlAction URL
icon_imageIcon image
icon_image_altIcon image alt text
commentComment
service_notification_optionsNotification options (w,u,c,r,f,s)

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getparam

In order to get specific parameters on a service configuration, use the GETPARAM action:

centreon -u admin -p 'centreon' -o SERVICE -a getparam -v "test;comment"
alias
test
centreon -u admin -p 'centreon' -o SERVICE -a getparam -v "test;comment|alia|description"
Object not found:alia
centreon -u admin -p 'centreon' -o HOST -a getparam -v "test;comment|template|description"
comment;template;description
Check disk /;ST_DISK;DIsk-/

You may edit the following parameters:

ParameterDescription
activate1 when service is enabled, 0 otherwise
descriptionDescription
templateName of the service template
is_volatile1 when service is volatile, 0 otherwise
check_periodName of the check period
check_commandName of the check command
check_command_argumentsArguments that go along with the check command, prepend each argument with the '!' character
max_check_attemptsMaximum number of attempt before a HARD state is declared
normal_check_intervalvalue in minutes
retry_check_intervalvalue in minutes
active_checks_enabled1 when active checks are enabled, 0 otherwise
passive_checks_enabled1 when passive checks are enabled, 0 otherwise
notifications_enabled1 when notification is enabled, 0 otherwise
contact_additive_inheritanceEnables contact additive inheritance
cg_additive_inheritanceEnables contactgroup additive inheritance
notification_intervalvalue in minutes
notification_periodName of the notification period
notification_optionsStatus linked to notifications
first_notification_delayFirst notification delay in seconds
recovery_notification_delayRecovery notification delay
obsess_over_service1 when obsess over service is enabled, 0 otherwise
check_freshness1 when check freshness is enabled, 0 otherwise
freshness_thresholdValue in seconds
event_handler_enabled1 when event handler is enabled, 0 otherwise
flap_detection_enabled1 when flap detection is enabled, 0 otherwise
retain_status_information1 when status information is retained, 0 otherwise
retain_nonstatus_information1 when non status information is retained, 0 otherwise
event_handlerName of the event handler command
event_handler_argumentsArguments that go along with the event handler, prepend each argument with the '!' character
notesNotes
notes_urlNotes URL
action_urlAction URL
icon_imageIcon image
icon_image_altIcon image alt text
commentComment
service_notification_optionsNotification options (w,u,c,r,f,s)

Addhost and Sethost

You may want to tie a service to an extra host. In order to do so, use the ADDHOST or SETHOST actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SERVICE -a sethost -v "host1;ping;host2"
centreon -u admin -p 'centreon' -o SERVICE -a addhost -v "host1;ping;host2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delhost

In order to remove the relation between a host and a service, use the DELHOST action:

centreon -u admin -p 'centreon' -o SERVICE -a delhost -v "host1;ping;host2"

The service ping which was originally linked to host1 and host2 is now only linked to host1.

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getmacro

In order to view the custom macro list of a service, use the GETMACRO action:

centreon -u admin -p 'centreon' -o SERVICE -a getmacro -v "host1;ping"
macro name;macro value;is_password;description
$_SERVICETIME$;80;0;description of macro
$_SERVICEPL$;400;0;description of macro

Setmacro

In order to set a macro for a specific service use the SETMACRO action:

centreon -u admin -p 'centreon' -o SERVICE -a setmacro -v "test;ping;time;80;0;description of macro"
centreon -u admin -p 'centreon' -o SERVICE -a setmacro -v "test;ping;pl;400;0;description of macro"

The required parameters are the following:

OrderDescription
1Host name
2Service name
3Macro name
4Macro value
51 for a password macro, 0 otherwise
6Description of macro

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delmacro

In order to remove a macro from a specific service use the DELMACRO action:

centreon -u admin -p 'centreon' -o SERVICE -a delmacro -v "test;ping;time"
centreon -u admin -p 'centreon' -o SERVICE -a delmacro -v "test;ping;pl"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setseverity

In order to associate a severity to a service, use the SETSEVERITY action:

centreon -u admin -p 'centreon' -o SERVICE -a setseverity -v "Centreon-Server;ping;Critical"

Required parameters:

OrderDescription
1Host name
2Service description
3Severity name

Unsetseverity

In order to remove the severity from a service, use the UNSETSEVERITY action:

centreon -u admin -p 'centreon' -o SERVICE -a unsetseverity -v "Centreon-Server;ping"

Required parameters:

OrderDescription
1Host name
2Service description

Getcontact

In order to view the contact list of a service, use the GETCONTACT action:

centreon -u admin -p 'centreon' -o "SERVICE" -a getcontact -v "Centreon-Server;Ping"
id;name
28;Contact_1
29;Contact_2

Addcontact and Setcontact

In order to add a new contact to notification contact list, use the ADDCONTACT or SETCONTACT actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SERVICE -a addcontact -v "test;ping;User1"
centreon -u admin -p 'centreon' -o SERVICE -a setcontact -v "test;ping;User1|User2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcontact

In order to remove a contact from the notification contact list, use the DELCONTACT action:

centreon -u admin -p 'centreon' -o SERVICE -a delcontact -v "test;ping;User1"
centreon -u admin -p 'centreon' -o SERVICE -a delcontact -v "test;ping;User2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getcontactgroup

In order to view the contact group list of a service, use the GETCONTACTGROUP action:

centreon -u admin -p 'centreon' -o "SERVICE" -a getcontactgroup -v "Centreon-Server;Ping"
id;name
28;ContactGroup_1
29;ContactGroup_2

Addcontactgroup and Setcontactgroup

In order to add a new contactgroup to notification contactgroup list, use the ADDCONTACTGROUP or SETCONTACTGROUP actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SERVICE -a addcontactgroup -v "test;ping;Group1"
centreon -u admin -p 'centreon' -o SERVICE -a setcontactgroup -v "test;ping;Group1|Group2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcontactgroup

In order to remove a contactgroup from the notification contactgroup list, use DELCONTACTGROUP action:

centreon -u admin -p 'centreon' -o SERVICE -a delcontactgroup -v "test;ping;Group1"
centreon -u admin -p 'centreon' -o SERVICE -a delcontactgroup -v "test;ping;Group2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Gettrap

In order to view the trap list of a service, use the GETTRAP action:

centreon -u admin -p 'centreon' -o "SERVICE" -a gettrap -v "Centreon-Server;Ping"
id;name
48;ciscoConfigManEvent
39;ospfVirtIfTxRetransmit

Addtrap and Settrap

In order to add a new trap, use the ADDTRAP or SETTRAP actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SERVICE -a addtrap -v "test;ping;snOspfVirtIfConfigError"
centreon -u admin -p 'centreon' -o SERVICE -a settrap -v "test;ping;snOspfVirtNbrStateChange|snTrapAccessListDeny"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Deltrap

In order to remove a trap from a service, use the DELTRAP command:

centreon -u admin -p 'centreon' -o SERVICE -a deltrap -v "test;ping;snOspfVirtIfConfigError"

Getservicegroup

In order to view the servicegroup of a service, use the GETSERVICEGROUP action:

centreon -u admin -p 'centreon' -o "SERVICE" -a getservicegroup -v "Centreon-Server;Ping"
id;name
48;SG1
39;SG2

Addservicegroup and Setservicegroup

In order to add a new servicegroup, use the ADDSERVICEGROUP or SETSERVICEGROUP actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SERVICE -a addservicegroup -v "test;ping;SG2"
centreon -u admin -p 'centreon' -o SERVICE -a setservicegroup -v "test;ping;SG1|SG2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delservicegroup

In order to remove a servicegroup from a service, use the DELSERVICEGROUP command:

centreon -u admin -p 'centreon' -o SERVICE -a delservicegroup -v "test;ping;SG1"

Getcategory

In order to view the category of a service, use the GETCATEGORY action:

centreon -u admin -p 'centreon' -o "SERVICE" -a getcategory -v "Centreon-Server;Ping"
id;name
48;CPU

Addcategory and Setcategory

In order to add a new category, use the ADDCATEGORY or SETCATEGORY actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o SERVICE -a addcategory -v "test;ping;CPU"
centreon -u admin -p 'centreon' -o SERVICE -a setcategory -v "test;ping;CPU"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcategory

In order to remove a category from a service, use the DELCATEGORY command:

centreon -u admin -p 'centreon' -o SERVICE -a delcategory -v "test;ping;CPU"

Service templates

Object name: STPL

Show

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

centreon -u admin -p 'centreon' -o STPL -a show
id;description;check command;check command arg;normal check interval;retry check interval;max check attempts;active checks enabled;passive checks enabled
1;generic-service;generic-service;;;5;1;3;1;0
3;Ping-LAN;Ping;check_centreon_ping;!3!200,20%!400,50%;;;;2;2
4;Ping-WAN;Ping;check_centreon_ping;!3!400,20%!600,50%;;;;2;2
5;SNMP-DISK-/;Disk-/;check_centreon_remote_storage;!/!80!90;;;;2;2
6;SNMP-DISK-/var;Disk-/var;check_centreon_remote_storage;!/var!80!90;;;;2;2
7;SNMP-DISK-/usr;Disk-/usr;check_centreon_remote_storage;!/usr!80!90;;;;2;2
8;SNMP-DISK-/home;Disk-/home;check_centreon_remote_storage;!/home!80!90;;;;2;2
9;SNMP-DISK-/opt;Disk-/opt;check_centreon_remote_storage;!/opt!80!90;;;;2;2

You can also specify the service template to search:

centreon -u admin -p 'centreon' -o STPL -a show -v 'Ping-LAN'
id;description;check command;check command arg;normal check interval;retry check interval;max check attempts;active checks enabled;passive checks enabled
3;Ping-LAN;Ping;check_centreon_ping;!3!200,20%!400,50%;;;;2;2

Columns are the following :

OrderDescription
1Service ID
2Service Description
3Check command
4Check command arguments
5Normal check interval
6Retry check interval
7Maximum check attempts
81 when active checks are enabled, 0 otherwise
91 when passive checks are enabled, 0 otherwise

Add

In order to add a service template, use the ADD action:

centreon -u admin -p 'centreon' -o STPL -a add -v "MyTemplate;mytemplate;Ping-LAN"

The required fields are:

OrderDescription
1Service template description
2Alias will be used when services are deployed through host templates
3Service template; Only one service template can be defined

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Del

In order to remove a service template, use the DEL action:

centreon -u admin -p 'centreon' -o STPL -a del -v "MyTemplate"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Setparam

In order to set a specific parameter for a service template, use the SETPARAM action:

centreon -u admin -p 'centreon' -o STPL -a setparam -v "MyTemplate;max_check_attempts;10"
centreon -u admin -p 'centreon' -o STPL -a setparam -v "MyTemplate;normal_check_interval;2"
centreon -u admin -p 'centreon' -o STPL -a setparam -v "MyTemplate;normal_check_interval;http://192.168.1.2/admincp"

The required fields that you have pass in options are:

OrderDescription
1Service template description
2Parameter that you want to update
3New paramater value

Parameters that may be modified:

ParameterDescription
activate1 when service is enabled, 0 otherwise
descriptionService template description
aliasService template alias
templateName of the service template
is_volatile1 when service is volatile, 0 otherwise
check_periodName of the check period
check_commandName of the check command
check_command_argumentsArguments that go along with the check command, prepend each argument with the '!' characteri
max_check_attemptsMaximum number of attempt before a HARD state is declared
normal_check_intervalvalue in minutes
retry_check_intervalvalue in minutes
active_checks_enabled1 when active checks are enabled, 0 otherwise
passive_checks_enabled1 when passive checks are enabled, 0 otherwise
contact_additive_inheritanceEnables contact additive inheritance=
cg_additive_inheritanceEnables contactgroup additive inheritance
notification_intervalvalue in minutes
notification_periodName of the notification period
notification_optionsStatus linked to notifications
first_notification_delayFirst notification delay in seconds
recovery_notification_delayRecovery notification delay
parallelize_check1 when parallelize checks are enabled, 0 otherwise
obsess_over_service1 when obsess over service is enabled, 0 otherwise
check_freshness1 when check freshness is enabled, 0 otherwise
freshness_thresholdService freshness threshold in seconds
event_handler_enabled1 when event handler is enabled, 0 otherwise
flap_detection_enabled1 when flap detection is enabled, 0 otherwise
process_perf_data1 when process performance data is enabled, 0 otherwise
retain_status_information1 when status information is retained, 0 otherwise
retain_nonstatus_information1 when non status information is retained, 0 otherwise
stalking_optionsComma separated options: 'o' for OK, 'w' for Warning, 'u' for Unknown and 'c' for Critical
event_handlerName of the event handler command
event_handler_argumentsArguments that go along with the event handler, prepend each argument with the "!" character
notesNotes
notes_urlNotes URL
action_urlAction URL
icon_imageIcon image
icon_image_altIcon image alt text
graphtemplateGraph template namei
commentComment
service_notification_optionsNotification options (w,u,c,r,f,s)

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getparam

In order to get specific parameters on a service template, use the GETPARAM action:

centreon -u admin -p 'centreon' -o STPL -a getparam -v "test;alias"
alias
test
centreon -u admin -p 'centreon' -o STPL -a getparam -v "test;alias|alia|comment"
Object not found:alia
centreon -u admin -p 'centreon' -o STPL -a getparam -v "test;alias|notes|comment"
alias;notes;comment
test;my notes;my comment

You may edit the following parameters:

ParameterDescription
activate1 when service is enabled, 0 otherwise
descriptionService template description
aliasService template alias
templateName of the service template
is_volatile1 when service is volatile, 0 otherwise
check_periodName of the check period
check_commandName of the check command
check_command_argumentsArguments that go along with the check command, prepend each argument with the '!' characteri
max_check_attemptsMaximum number of attempt before a HARD state is declared
normal_check_intervalvalue in minutes
retry_check_intervalvalue in minutes
active_checks_enabled1 when active checks are enabled, 0 otherwise
passive_checks_enabled1 when passive checks are enabled, 0 otherwise
contact_additive_inheritanceEnables contact additive inheritance=
cg_additive_inheritanceEnables contactgroup additive inheritance
notification_intervalvalue in minutes
notification_periodName of the notification period
notification_optionsStatus linked to notifications
first_notification_delayFirst notification delay in seconds
recovery_notification_delayRecovery notification delay
parallelize_check1 when parallelize checks are enabled, 0 otherwise
obsess_over_service1 when obsess over service is enabled, 0 otherwise
check_freshness1 when check freshness is enabled, 0 otherwise
freshness_thresholdService freshness threshold in seconds
event_handler_enabled1 when event handler is enabled, 0 otherwise
flap_detection_enabled1 when flap detection is enabled, 0 otherwise
process_perf_data1 when process performance data is enabled, 0 otherwise
retain_status_information1 when status information is retained, 0 otherwise
retain_nonstatus_information1 when non status information is retained, 0 otherwise
stalking_optionsComma separated options: 'o' for OK, 'w' for Warning, 'u' for Unknown and 'c' for Critical
event_handlerName of the event handler command
event_handler_argumentsArguments that go along with the event handler, prepend each argument with the "!" character
notesNotes
notes_urlNotes URL
action_urlAction URL
icon_imageIcon image
icon_image_altIcon image alt text
graphtemplateGraph template namei
commentComment
service_notification_optionsNotification options (w,u,c,r,f,s)

Addhosttemplate and Sethosttemplate

You may want to tie a service template to an extra host template. In order to do so, use the ADDHOSTTEMPLATE or SETHOSTTEMPLATE actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o STPL -a sethosttemplate -v "MyTemplate;generic-host-template"
centreon -u admin -p 'centreon' -o STPL -a addhosttemplate -v "MyTemplate;Linux-Servers"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delhosttemplate

In order to remove the relation between a host template and a service template, use the DELHOSTTEMPLATE action:

centreon -u admin -p 'centreon' -o STPL -a delhosttemplate -v "MyTemplate;Linux-Servers"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getmacro

In order to view the custom macro list of a service template, use the GETMACRO action:

centreon -u admin -p 'centreon' -o STPL -a getmacro -v "MyTemplate"
macro name;macro value;description;is_password
$_SERVICETIME$;80;description of macro1;0
$_SERVICEPL$;400;description of macro2;0

Setmacro

In order to set a macro for a specific service template use the SETMACRO action:

centreon -u admin -p 'centreon' -o STPL -a setmacro -v "MyTemplate;time;80"
centreon -u admin -p 'centreon' -o STPL -a setmacro -v "MyTemplate;pl;400;description"
centreon -u admin -p 'centreon' -o STPL -a setmacro -v "MyTemplate;password;mypassword;;1"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delmacro

In order to remove a macro from a specific service template, use the DELMACRO action:

centreon -u admin -p 'centreon' -o STPL -a delmacro -v "MyTemplate;time"
centreon -u admin -p 'centreon' -o STPL -a delmacro -v "MyTemplate;pl"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getcontact

In order to view the contact list of a service template, use the GETCONTACT action:

centreon -u admin -p 'centreon' -o STPL -a getcontact -v "MyTemplate"
id;name
28;Contact_1
29;Contact_2

Addcontact and Setcontact

In order to add a new contact to notification contact list, use ADDCONTACT or SETCONTACT actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o STPL -a addcontact -v "MyTemplate;User1"
centreon -u admin -p 'centreon' -o STPL -a setcontact -v "MyTemplate;User1|User2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcontact

In order to remove a contact from the notification contact list, use the DELCONTACT action:

centreon -u admin -p 'centreon' -o STPL -a delcontact -v "MyTemplate;User1"
centreon -u admin -p 'centreon' -o STPL -a delcontact -v "MyTemplate;User2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Getcontactgroup

In order to view the contactgroup list of a service template, use the GETCONTACTGROUP action:

centreon -u admin -p 'centreon' -o STPL -a getcontactgroup -v "MyTemplate"
id;name
28;ContactGroup_1
29;ContactGroup_2

Setcontactgroup

In order to add a new contactgroup to notification contactgroup list, use the ADDCONTACTGROUP or SETCONTACTGROUP actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o STPL -a addcontactgroup -v "MyTemplate;Group1"
centreon -u admin -p 'centreon' -o STPL -a setcontactgroup -v "MyTemplate;Group1|Group2"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcontactgroup

In order to remove a contactgroup from the notification contactgroup list, use the DELCONTACTGROUP action:

centreon -u admin -p 'centreon' -o STPL -a delcontactgroup -v "MyTemplate"
centreon -u admin -p 'centreon' -o STPL -a delcontactgroup -v "MyTemplate;Group1"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Gettrap

In order to view the trap list of a service template, use the GETTRAP action:

centreon -u admin -p 'centreon' -o "STPL" -a gettrap -v "Ping-LAN"
id;name
48;ciscoConfigManEvent
39;ospfVirtIfTxRetransmit

Settrap

In order to add a trap to a service template, use the ADDTRAP or SETTRAP actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o STPL -a addtrap -v "Ping-LAN;snOspfVirtIfConfigError"
centreon -u admin -p 'centreon' -o STPL -a settrap -v "Ping-LAN;snOspfVirtNbrStateChange|snTrapAccessListDeny"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Deltrap

In order to remove a trap from a service template, use the DELTRAP action:

centreon -u admin -p 'centreon' -o STPL -a deltrap -v "Ping-LAN;snOspfVirtIfConfigError"

Getcategory

In order to view the category of a service template, use the GETCATEGORY action:

centreon -u admin -p 'centreon' -o STPL -a getcategory -v "ping"
id;name
48;CPU

Addcategory and Setcategory

In order to add a new category, use the ADDCATEGORY or SETCATEGORY actions where add will append and set will overwrite previous definitions:

centreon -u admin -p 'centreon' -o STPL -a addcategory -v "ping;CPU"
centreon -u admin -p 'centreon' -o STPL -a setcategory -v "ping;CPU"

NOTE: You need to generate your configuration file and restart monitoring engine in order to apply changes.

Delcategory

In order to remove a category from a service template, use the DELCATEGORY command:

centreon -u admin -p 'centreon' -o SERVICE -a delcategory -v "ping;CPU"

Settings

Object name: Settings

Show

In order to list editable settings, use the SHOW action:

centreon -u admin -p 'centreon' -o SETTINGS -a show
parameter;value
centstorage;1
debug_auth;0
debug_ldap_import;0
debug_nagios_import;0
debug_path;/var/log/centreon/
debug_rrdtool;0
enable_autologin;1
enable_gmt;0
enable_logs_sync;1
enable_perfdata_sync;1
gmt;1
interval_length;60
mailer_path_bin;/bin/mail
nagios_path_img;/usr/share/nagios/html/images/logos/
perl_library_path;/usr/local/lib
rrdtool_path_bin;/usr/bin/rrdtool
snmpttconvertmib_path_bin;/usr/share/centreon/bin/snmpttconvertmib
snmptt_unknowntrap_log_file;snmptrapd.log

Setparam

If you want to change a specific parameter of a Vendor, use the SETPARAM action:

centreon -u admin -p 'centreon' -o SETTINGS -a setparam -v ";"

Arguments are composed of the following columns:

OrderColumn description
1Parameter name
2Parameter value

Parameters that you may change are:

ColumnDescriptionPossible values and examples
centstorageEnable/disable CentStorageEnable: '1', Disable: '0'
debug_authEnable/disable authentication debugEnable: '1', Disable: '0'
debug_ldap_importEnable/disable LDAP debugEnable: '1', Disable: '0'
debug_nagios_importEnable/disable Nagios configuration importEnable: '1', Disable: '0'
debug_pathDebug log files directory/var/log/centreon/
debug_rrdtoolEnable/disable RRDTool debugEnable: '1', Disable: '0'
enable_autologinEnable/disable autologinEnable: '1', Disable: '0'
enable_gmtEnable/disable GMT managementEnable: '1', Disable: '0'
enable_logs_syncEnable/disable CentCore log synchronization (not necessary when using Centreon Broker)Enable: '1', Disable: '0'
enable_perfdata_syncEnable/disable Centcore PerfData synchronization (not necessary when using Centreon Broker)Enable: '1', Disable: '0'
gmtGMT timezone of monitoring system2 (for GMT+2)
interval_lengthMonitoring interval length in seconds (default: 60)120
mailer_path_binMail client bin path/bin/mail
nagios_path_imgNagios image path/usr/share/nagios/html/images/logos/
perl_library_pathPerl library path/usr/local/lib
rrdtool_path_binRRDTool bin path/usr/bin/rrdtool
snmpttconvertmib_path_binSNMPTT mib converter bin path/usr/share/centreon/bin/snmpttconvertmib
snmptt_unknowntrap_log_fileSNMPTT unknown trap log filesnmptrapd.log

Time periods

Object name: TP

Show

In order to list available time periods, use the SHOW action:

centreon -u admin -p 'centreon' -o TP -a show
id;name;alias;sunday;monday;tuesday;wednesday;thursday;friday,saturday
1;24x7;24_Hours_A_Day,_7_Days_A_Week;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00;00:00-24:00
2;none;No Time Is A Good Time;;;;;;;
3;nonworkhours;Non-Work Hours;00:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-09:00,17:00-24:00;00:00-24:00
4;workhours;Work hours;;09:00-17:00;09:00-17:00;09:00-17:00;09:00-17:00;09:00-17:00;

Add

In order to add a Time Period, use the ADD action:

centreon -u admin -p 'centreon' -o TP -a add -v "Timeperiod_Test;Timeperiod_Test"

Required fields are:

OrderDescription
1Name
2Alias

Del

If you want to remove a Time Period, use the DEL action. The Name is used for identifying the Time Period to delete:

centreon -u admin -p 'centreon' -o TP -a del -v "Timeperiod_Test"

Setparam

If you want to change a specific parameter of a time period, use the SETPARAM action. The Name is used for identifying the Time Period to update:

centreon -u admin -p 'centreon' -o TP -a setparam -v "Timeperiod_Test;monday;00:00-24:00"

Arguments are composed of the following columns:

OrderColumn description
1Name of time period
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
nameName
aliasAlias
sundayTime Period definition for Sunday
mondayTime Period definition for Monday
tuesdayTime Period definition for Tuesday
wednesdayTime Period definition for Wednesday
thursdayTime Period definition for Thursday
fridayTime Period definition for Friday
saturdayTime Period definition for Saturday
includeexample: [...] -v "Timeperiod_Test;include;workhours"; Use delimiter | for multiple inclusion definitions

Getexception

In order to view the exception list of a time period, use the GETEXCEPTION action:

centreon -u admin -p 'centreon' -o TP -a getexception -v "mytimeperiod"
days;timerange
january 1;00:00-00:00
december 25;00:00-00:00

Setexception

In order to set an exception on a timeperiod, use the SETEXCEPTION action:

centreon -u admin -p 'centreon' -o TP -a setexception -v "mytimeperiod;january 1;00:00-24:00"

NOTE: If exception does not exist, it will be created, otherwise it will be overwritten.

Delexception

In order to delete an exception, use the DELEXCEPTION action:

centreon -u admin -p 'centreon' -o TP -a delexception -v "mytimeperiod;january 1"

Arguments are composed of the following columns:

OrderColumn description
1Name of timeperiod
2Exception to remove from timeperiod

Traps

Object name: TRAP

Show

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

centreon -u admin -p 'centreon' -o TRAP -a show
id;name;oid;manufacturer
576;alertSystemUp;.1.3.6.1.4.1.674.10892.1.0.1001;Dell
577;alertThermalShutdown;.1.3.6.1.4.1.674.10892.1.0.1004;Dell
578;alertTemperatureProbeNormal;.1.3.6.1.4.1.674.10892.1.0.1052;Dell
599;alertFanEnclosureInsertion;.1.3.6.1.4.1.674.10892.1.0.1452;Dell
600;alertFanEnclosureRemoval;.1.3.6.1.4.1.674.10892.1.0.1453;Dell
601;alertFanEnclosureExtendedRemoval;.1.3.6.1.4.1.674.10892.1.0.1454;Dell
602;alertLogNormal;.1.3.6.1.4.1.674.10892.1.0.1552;Dell
605;ccmCLIRunningConfigChanged;.1.3.6.1.4.1.9.9.43.2.0.2;Cisco
[...]

Add

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

centreon -u admin -p 'centreon' -o TRAP -a add -v "aNewTrap;.1.3.6.1.4.1.11.2.3.9.7.1.0.30"

Required fields are:

OrderDescription
1Trap name
2OID of the SNMP Trap

Del

If you want to remove a Trap, use the DEL action. The Name is used for identifying the Trap to delete:

centreon -u admin -p 'centreon' -o TRAP -a del -v "aNewTrap"

Setparam

If you want to change a specific parameter of a Trap, use the SETPARAM command. The Name is used for identifying the Trap to update:

centreon -u admin -p 'centreon' -o TRAP -a setparam -v "aNewTrap;vendor;3com"

Arguments are composed of the following columns:

OrderColumn description
1Name of Trap
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescriptionPossible values
nameName
commentsComments
outputOutput
oidOID
statusStatusok, warning, critical, unknown or 0, 1, 2, 3
vendorVendor nameA valid vendor name
matching_modeAdvanced regexp matching mode1 to enable, 0 to disable
reschedule_svc_enableWhether or not will reschedule service check when trap is received1 to enable, 0 to disable
execution_commandCommand to be executed when trap is receivedA valid Unix command line
execution_command_enableWhether or not will execute the 'execution_command'1 to enable, 0 to disable
submit_result_enableWhether or not will submit result to Service1 to enable, 0 to disable

Getmatching

In order to display the list of matching rules defined for a specific trap, use the GETMATCHING command:

centreon -u admin -p 'centreon' -o TRAP -a getmatching -v "aNewTrap"
id;string;regexp;status;order
8;@OUTPUT@;/test/;UNKNOWN;1
ColumnDescription
IDID of the matching rule
StringString to match
RegexpMatching Regular Expression
StatusStatus to submit
OrderPriority order of the matching rule

Addmatching

In order to add a matching rule, use the ADDMATCHING command:

centreon -u admin -p 'centreon' -o TRAP -a addmatching -v "aNewTrap;@OUTPUT@;/test2/;critical"

Required fields are:

OrderDescriptionPossible values
1Trap name
2String to match
3Matching Regular Expression
4Status to submitok, warning, critical, unknown or 0, 1, 2, 3

Delmatching

In order to delete a matching rule, use the DELMATCHING command:

centreon -u admin -p 'centreon' -o TRAP -a delmatching -v "8"

Required fields are:

ColumnDescription
IDID of the matching rule

Updatematching

In order to delete a matching rule, use the UPDATEMATCHING command:

centreon -u admin -p 'centreon' -o TRAP -a updatematching -v "8;status;critical"

Arguments are composed of the following columns:

OrderColumn description
1ID of the matching rule
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescriptionPossible values
stringString to match
orderPriority order
statusStatus to submitok, warning, critical, unknown or 0, 1, 2, 3
regexpMatching Regular Expression

Vendors

Object name: VENDOR

Show

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

centreon -u admin -p 'centreon' -o VENDOR -a show
id;name;alias
1;Cisco;Cisco Networks
2;HP;HP Networks
3;3com;3Com
4;Linksys;Linksys
6;Dell;Dell
7;Generic;Generic
9;Zebra;Zebra
11;HP-Compaq;HP and Compaq Systems

Add

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

centreon -u admin -p 'centreon' -o VENDOR -a add -v "DLink;DLink routers"

Required fields are:

OrderDescription
1Name
2Alias

Del

If you want to remove a Vendor, use the DEL action. The Name is used for identifying the Vendor to delete:

centreon -u admin -p 'centreon' -o VENDOR -a del -v "DLink"

Setparam

If you want to change a specific parameter of a Vendor, use the SETPARAM command. The Name is used for identifying the Vendor to update:

centreon -u admin -p 'centreon' -o VENDOR -a setparam -v "3com;name;HP"

Arguments are composed of the following columns:

OrderColumn description
1Name of vendor
2Parameter name
3Parameter value

Parameters that you may change are:

ColumnDescription
nameName
aliasAlias
descriptionDescription

Generatetraps

It is possible to generate new SNMP traps from a given MIB file. In order to do so, use the GENERATETRAPS command:

centreon -u admin -p 'centreon' -o VENDOR -a generatetraps -v "3com;/usr/share/mymibs/3com/A3COM-SWITCHING-SYSTEMS-MIB.mib"
[...]
Done

Total translations: 10
Successful translations: 10
Failed translations: 0

NOTE: Make sure to put all the mib file dependencies in the /usr/share/snmp/mibs/ directory before starting the generation. Then, remove them when it is done.

Required fields are:

ColumnDescription
NameName of Vendor
Mib fileFile path of .mib

Service Mapping

The service mapping capabilities in Centreon relies on the Centreon Business Activity Monitoring (BAM) extension.

Centreon BAM is a Centreon extension that requires a valid license key. To purchase one and retrieve the necessary repositories, contact Centreon.

Business View

Object name: BV

SHOW

To list available BVs, use the SHOW action:

./centreon -u admin -p 'centreon' -o BV -a SHOW
id;name;description
4;BV1;BV1
5;BV2;BV2
6;BV4;BV3
[...]

The following columns are required:

ColumnDescription
BV IDBusiness View id
BV nameBusiness View name
BV descriptionBusiness View description

ADD

To add a BV, use the ADD action:

./centreon -u admin -p 'centreon' -o BV -a ADD -v 'BV1;BV1'

The following columns are required:

ColumnDescription
NameBusiness View name
DescriptionBusiness View description

DEL

To remove a BV, use the DEL action:

./centreon -u admin -p 'centreon' -o BV -a DEL -v 'BV1'

SETPARAM

To change specific parameters for a BV, use the SETPARAM action:

./centreon -u admin -p 'centreon' -o BV -a SETPARAM -v 'BV1;description;BV description'

You can change the following parameters:

ParameterDescription
nameBusiness Activity name
descriptionBusiness Activity description
overviewVisible in overview (0 or 1)

SETBA

To set the Business Activity (BA) to a BV, use the SETBA action:

./centreon -u admin -p 'centreon' -o BV -a SETBA -v 'bv1;ba1'

The following columns are required:

ColumnDescription
Bv nameBusiness View name
Ba nameBusiness Activity name (multiple with "pipe" separator)

ADDBA

To add BA to a BV, use the ADDBA action:

./centreon -u admin -p 'centreon' -o BV -a ADDBA -v 'bv1;ba1'

The following columns are required:

ColumnDescription
Bv nameBusiness View name
Ba nameBusiness Activity name (multiple with a "pipe" separator)

DELBA

To delete a BA from a BV, use the DELBA action:

./centreon -u admin -p 'centreon' -o BV -a DELBA -v 'bv1;ba1'

The following columns are required:

ColumnDescription
Bv nameBusiness View name
Ba nameBusiness Activity name (multiple with a "pipe" separator)

SETACLGROUP

To set an ACL group to a BV, use the SETACLGROUP action:

./centreon -u admin -p 'centreon' -o BV -a SETACLGROUP -v 'bv1;ALL'

The following columns are required:

ColumnDescription
Bv nameBusiness View name
Acl group nameAcl group name (multiple with a pipe separator)

ADDACLGROUP

To add an ACL group to a BV, use the ADDACLGROUP action:

./centreon -u admin -p 'centreon' -o BV -a ADDACLGROUP -v 'bv1;ALL'

The following columns are required:

ColumnDescription
Bv nameBusiness View name
Acl group nameAcl group name (multiple with a "pipe" separator)

DELACLGROUP

To delete an ACL group from a BV, use the DELACLGROUP action:

./centreon -u admin -p 'centreon' -o BV -a DELACLGROUP -v 'bv1;ALL'

The following columns are required:

ColumnDescription
Bv nameBusiness View name
Acl group nameAcl group name (multiple with a "pipe" separator)

Business Activity (BA)

Object name: BA

SHOW

To list available business activities, use the SHOW action:

./centreon -u admin -p 'centreon' -o BA -a SHOW
id;name;description;state_source;level_w;level_c;notification_interval
1;ba1;ba1;1;80;70;3
2;ba2;ba2;2;;;2
3;ba3;ba3;3;;;
[...]

The following columns are displayed:

  • BA ID: Business Activity id
  • BA name: Business Activity name
  • Ba description: Business Activity description
  • Ba state_source: Business Activity Calculation Method
  • level_w: Warning threshold (only applicable for Impact and Ratio modes)
  • level_c: Critical threshold (only applicable for Impact and Ratio modes)

Business Activity Calculation Methods (state_source):

  • 0 - Impact Mode (requires level_w to be > level_c)
  • 1 - Best Status
  • 2 - Worst Status
  • 3 - Ratio Percentage (requires level_c to be > level_w)
  • 4 - Ratio Number (requires level_c to be > level_w)

ADD

To add a BA, use the ADD action:

./centreon -u admin -p 'centreon' -o BA -a ADD -v 'ba1;ba1;0;90;80;5'

The following columns are required:

ColumnDescription
NameBusiness Activity name
DescriptionBusiness Activity description
State SourceBA Calcuation Method
Warning thresholdWarning threshold (if needed)
Critical thresholdCritical threshold (if needed)
Notification intervalNotification interval (minutes)

DEL

To remove a BA, use the DEL action:

./centreon -u admin -p 'centreon' -o BA -a DEL -v 'ba1'

SETPARAM

To change a specific parameters for a BV, use the SETPARAM action:

./centreon -u admin -p 'centreon' -o BA -a SETPARAM -v 'ba1;enable;1'
./centreon -u admin -p 'centreon' -o BA -a SETPARAM -v 'ba1;comment;new comments'
./centreon -u admin -p 'centreon' -o BA -a SETPARAM -v 'ba1;notification_options;r,w,c'

Parameters that you can change are the following:

ParameterDescriptionPossible values
nameBusiness Activity name
descriptionBusiness Activity description
level_wWarning threshold
level_cCritical threshold
reporting_periodreporting period
commentComments
notifications_enabledEnable notifications (0 or 1)
notification_optionsNotification options (r, w, c, f)
notification_periodNotification period
notification_intervalNotification interval
first_notification_delayDelay before sending first notification when entering non-OK status
recovery_notification_delayDelay before sending first notification when entering OK status
iconBusiness Activity icon
inherit_kpi_downtimesInherit planned downtimes from KPIs0 to ignore the planned downtime, 1 to inherit the planned downtime on the business activity, 2 to ignore the indicator in the calculation
geo_coordsGeo-coordinate to position the BA
enableEnable (0 or 1)
state_source0 - Impact, 1 - Best, 2 - Worst, 3 - Ratio Nr., 4 - Ratio Percent

Note: Changing State Source will require updating your Level W and Level C to match the appropriate Calculation Method!

SETBV

To set a BV to a BA, use the SETBV action:

./centreon -u admin -p 'centreon' -o BA -a SETBV -v 'ba1;bv1'
./centreon -u admin -p 'centreon' -o BA -a SETBV -v 'ba1;bv1|bv2'

The following columns are required:

Column Description


Ba name Business Activity name Bv name Business View name (multiple with | seperator)

ADDBV

To add a BV to a BA, use the ADDBV action:

./centreon -u admin -p 'centreon' -o BA -a ADDBV -v 'ba1;bv1'
./centreon -u admin -p 'centreon' -o BA -a ADDBV -v 'ba1;bv2|bv3'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Bv nameBusiness View name (multiple with a "pipe" separator)

DELBV

To delete a BV from a BA, use the DELBV action:

./centreon -u admin -p 'centreon' -o BA -a DELBV -v 'ba1;bv1'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Bv nameBusiness View name (multiple with a "pipe" separator)

SETCONTACTGROUP

To set contact group to a BA, use the SETCONTACTGROUP action:

./centreon -u admin -p 'centreon' -o BA -a SETCONTACTGROUP -v 'ba1;Guest'
./centreon -u admin -p 'centreon' -o BA -a SETCONTACTGROUP -v 'ba1;Guest|Supervisors'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Contact group nameContact group name (multiple with a "pipe" separator)

ADDCONTACTGROUP

To add contact group to a BA, use the ADDCONTACTGROUP action:

./centreon -u admin -p 'centreon' -o BA -a ADDCONTACTGROUP -v 'ba1;Guest'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Contact group nameContact group name (multiple with a "pipe" separator)

DELCONTACTGROUP

To delete a contact group from a BA, use the DELCONTACTGROUP action:

./centreon -u admin -p 'centreon' -o BA -a DELCONTACTGROUP -v 'ba1;Guest'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Contact group nameContact group name (multiple with a "pipe" separator)

SETEXTRAREPORTINGPERIOD

To set extra reporting periods for Centreon MBI, use the SETEXTRAREPORTINGPERIOD action:

./centreon -u admin -p 'centreon' -o BA -a SETEXTRAREPORTINGPERIOD -v 'ba1;workhours'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Extra reporting periodExtra reporting period (multiple with a "pipe" separator)

ADDEXTRAREPORTINGPERIOD

To add extra reporting periods for Centreon MBI, use the ADDEXTRAREPORTINGPERIOD action:

./centreon -u admin -p 'centreon' -o BA -a ADDEXTRAREPORTINGPERIOD -v 'ba1;workhours'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Extra reporting periodExtra reporting period (multiple with a "pipe" separator)

DELEXTRAREPORTINGPERIOD

To delete extra reporting periods from a BA, use the DELEXTRAREPORTINGPERIOD action:

./centreon -u admin -p 'centreon' -o BA -a DELEXTRAREPORTINGPERIOD -v 'ba1;workhours'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Extra reporting periodExtra reporting period (multiple with a "pipe" separator)

SETPOLLER

To set the poller where the BA is calculated (in addition to central), use the SETPOLLER action:

./centreon -u admin -p 'centreon' -o BA -a SETPOLLER -v 'ba1;poller1'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Poller namePoller name where Business Activity can be calculated

DELPOLLER

To delete poller where the BA is calculated, use the DELPOLLER action:

./centreon -u admin -p 'centreon' -o BA -a DELPOLLER -v 'ba1;poller1'

The following columns are required:

ColumnDescription
Ba nameBusiness Aiew name
Poller namePoller name where Business Activity is calculated

Indicators (KPI)

Object name: KPI

SHOW

To list available KPI, use the SHOW action:

./centreon -u admin -p 'centreon' -o KPI -a SHOW
id;type;name;impacted_ba;warning_impact;critical_impact;unknown_impact
1;service;Centreon-Server Load;ba1;25;50;20
2;metaservice;meta1;toto;50;100;75
[...]

Columns are the following:

ColumnDescription
KPI IDKPI id
KPI typeservice, metaservice, ba or boolean
KPI nameKPI name
Impacted BAImpacted business activity
Warning impactWarning impact
Critical impactCritical impact
Unknown impactUnknown impact

ADD

To add a KPI, use the ADD action:

./centreon -u admin -p 'centreon' -o KPI -a ADD -v 'service;host1|service1;ba1;10;20;5'
./centreon -u admin -p 'centreon' -o KPI -a ADD -v 'metaservice;meta11;ba2;minor;major;null'
./centreon -u admin -p 'centreon' -o KPI -a ADD -v 'ba;ba1;ba3;10;20;5'
./centreon -u admin -p 'centreon' -o KPI -a ADD -v 'boolean;rule1;ba4;10;20;5'

Required columns are the following:

ColumnDescription
KPI typeservice, metaservice, ba or boolean
ObjectObject used in KPI
Impacted BAImpacted business activity
Warning impactWarning impact
Critical impactCritical impact
Unknown impactUnknown impact

DEL

If you want to remove a KPI, use the DEL action:

./centreon -u admin -p 'centreon' -o KPI -a DEL -v 'ba;ba1;ba3'

SETPARAM

If you want to change a specific parameters for a KPI, use the SETPARAM action:

./centreon -u admin -p 'centreon' -o KPI -a SETPARAM -v 'service;host1|service1;ba1;enable;0'
./centreon -u admin -p 'centreon' -o KPI -a SETPARAM -v 'metaservice;meta1;ba1;warning_impact;50'

Parameters that you can change are the following:

ColumnDescription
Warning impactWarning impact
Critical impactCritical impact
Unknown impactUnknown impact
impacted_baImpacted business activity
enableEnable (0 or 1)

SETIMPACTMODE

If you want to change configuration mode, use the SETIMPACTMODE action:

./centreon -u admin -p 'centreon' -o KPI -a SETIMPACTMODE -v 'ba;ba1;ba3;advanced'

Parameters that you can change are the following:

ParameterDescription
KPI typeservice, metaservice, ba or boolean
ObjectObject used in KPI
Impacted BAImpacted business activity
Impact moderegular or advanced

Boolean Rule

Object name: BOOLEANRULE

SHOW

To list available boolean rules, use the SHOW action:

./centreon -u admin -p 'centreon' -o BOOLEANRULE -a SHOW
id;name;expression;bool_state
8;rule1;expression1;1
9;rule2;expression2;1
[...]

The following columns are required:

ColumnDescription
Rule IDBoolean rule id
Rule nameBoolean rule name
Rule expressionBoolean rule expression
Bool stateImpact is applied when expression returns this state

ADD

To add a boolean rule, use the ADD action:

./centreon -u admin -p 'centreon' -o BOOLEANRULE -a ADD -v 'rule1;expression1;1'

The following columns are required:

ColumnDescription
Rule nameBoolean rule name
Rule expressionBoolean rule expression
Bool stateImpact is applied when expression returns this state

DEL

To remove a boolean rule, use the DEL action:

./centreon -u admin -p 'centreon' -o BOOLEANRULE -a DEL -v 'rule1'

SETPARAM

To change a specific parameter for a boolean rule, use the SETPARAM command:

./centreon -u admin -p 'centreon' -o BOOLEANRULE -a setparam -v 'rule1;expression;new expression'

Parameters that you can change are the following:

ColumnDescription
Rule nameBoolean rule name
Rule expressionBoolean rule expression
Bool stateImpact is applied when expression returns this state

Poller management

List available pollers

In order to list available pollers, use the POLLERLIST command:

centreon -u admin -p 'centreon' -a POLLERLIST
poller_id;name
1;Local Poller
2;Remote Poller

Generate local configuration files for a poller

In order to generate configuration files for poller "Local Poller" of id 1, use the POLLERGENERATE command:

centreon -u admin -p 'centreon' -a POLLERGENERATE -v 1
Configuration files generated for poller 1

You can generate the configuration using the poller name:

centreon -u admin -p 'centreon' -a POLLERGENERATE -v "Local Poller"
Configuration files generated for poller 'Local Poller'

Test monitoring engine configuration of a poller

In order to test configuration files for poller "Remote Poller" of id 2, use the POLLERTEST command:

centreon -u admin -p 'centreon' -a POLLERTEST -v 1
OK: Nagios Poller 2 can restart without problem...

You can test the configuration using the poller name:

centreon -u admin -p 'centreon' -a POLLERTEST -v "Local Poller"
Warning: Nagios Poller poller can restart but configuration is not optimal. Please see debug bellow :
---------------------------------------------------------------------------------------------------
[1440681047] [15559] Reading main configuration file '/usr/share/centreon//filesGeneration/nagiosCFG/5/nagiosCFG.DEBUG'.
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/hosts.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/hostTemplates.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/serviceTemplates.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/services.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/misccommands.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/checkcommands.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/contactgroups.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/contactTemplates.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/contacts.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/hostgroups.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/servicegroups.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/timeperiods.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/escalations.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/dependencies.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/connectors.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-command.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-contact.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-contactgroup.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-dependencies.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-escalations.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-host.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-services.cfg'
[1440681047] [15559] Processing object config file '/usr/share/centreon/filesGeneration/nagiosCFG/5/centreon-bam-timeperiod.cfg'
[1440681047] [15559] Reading resource file '/usr/share/centreon/filesGeneration/nagiosCFG/5/resource.cfg'
[1440681047] [15559] Checking global event handlers...
[1440681047] [15559] Checking obsessive compulsive processor commands...
[1440681047] [15559]
[1440681047] [15559] Checked 55 commands.
[1440681047] [15559] Checked 0 connectors.
[1440681047] [15559] Checked 7 contacts.
[1440681047] [15559] Checked 0 host dependencies.
[1440681047] [15559] Checked 0 host escalations.
[1440681047] [15559] Checked 0 host groups.
[1440681047] [15559] Checked 1 hosts.
[1440681047] [15559] Checked 0 service dependencies.
[1440681047] [15559] Checked 0 service escalations.
[1440681047] [15559] Checked 0 service groups.
[1440681047] [15559] Checked 1 services.
[1440681047] [15559] Checked 5 time periods.
[1440681047] [15559]
[1440681047] [15559] Total Warnings: 1
[1440681047] [15559] Total Errors: 0

---------------------------------------------------------------------------------------------------
Return code end : 0

Move monitoring engine configuration files

In order to move configuration files for poller "Local Poller" of id 1 to the final engine directory, use the CFGMOVE command:

centreon -u admin -p 'centreon' -a CFGMOVE -v 2
OK: All configuration will be send to 'Remote Poller' by centcore in several minutes.
Return code end : 1

You can move the configuration files using the poller name:

centreon -u admin -p 'centreon' -a CFGMOVE -v "Remote Poller"
OK: All configuration will be send to 'Remote Poller' by centcore in several minutes.
Return code end : 1

Restart monitoring engine of a poller

In order to restart the monitoring process on poller "Local Poller" of id 1, use the the POLLERRESTART command:

centreon -u admin -p 'centreon' -a POLLERRESTART -v 2
OK: A restart signal has been sent to 'Remote Poller'
Return code end : 1

You can restart the poller using its name:

centreon -u Remote Poller -p 'centreon' -a POLLERRESTART -v "Remote Poller"
OK: A restart signal has been sent to 'Remote Poller'
Return code end : 1

All in one command

Use the APPLYCFG command in order to execute all of the above with one single command:

centreon -u admin -p 'centreon' -a APPLYCFG -v 1

You can execute using the poller name:

centreon -u admin -p 'centreon' -a APPLYCFG -v "Remote Poller"

This will execute POLLERGENERATE, POLLERTEST, CFGMOVE and POLLERRELOAD.

Reload monitoring engine of a poller

In order to reload the monitoring process on poller "Remote Poller" of id 2, use the POLLERRELOAD command:

centreon -u admin -p 'centreon' -a POLLERRELOAD -v 2
OK: A reload signal has been sent to Remote Pollerpoller'
Return code end : 1

You can reload poller using its name:

centreon -u admin -p 'centreon' -a POLLERRELOAD -v "Remote Poller"
OK: A reload signal has been sent to 'Remote Poller'
Return code end : 1

Execute post generation commands of a poller

In order to execute post generation commands of a poller, use the POLLEREXECCMD command:

centreon -u admin -p 'centreon' -a POLLEREXECCMD -v 2
Running configuration check...done.
Reloading nagios configuration...done

You can execute post generation commands of a poller using its name:

centreon -u admin -p 'centreon' -a POLLEREXECCMD -v "Remote Poller"
Running configuration check...done.
Reloading nagios configuration...done

Import/Export

Export

At some point, you might need to export all of the object configuration parameters into a plain text file, either for synchronizing or backuping purpose.

The following items will not be exported:

  • Escalation
  • ACL (ACL Groups, ACL Resources, ACL actions)
  • LDAP settings
  • Global Centreon settings

This export feature is ran like this:

centreon -u admin -p 'centreon' -e > /tmp/clapi-export.txt

This will generate CLAPI commands and redirect them to the /tmp/clapi-export.txt file.

This file can now be read by the import command.

With this, you can also build your own CLAPI command file if you know the straight forward syntax.

For instance:

HOST;ADD;Host-Test1;Test host;127.0.0.1;generic-host;Local Poller;Linux
HOST;ADD;Host-Test2;Test host;127.0.0.1;generic-host;Local Poller;Linux
HOST;ADD;Host-Test3;Test host;127.0.0.1;generic-host;Local Poller;Linux
HOST;ADD;Host-Test4;Test host;127.0.0.1;generic-host;Local Poller;Linux
HOST;ADD;Host-Test5;Test host;127.0.0.1;generic-host;Local Poller;Linux

Export of a subset of objects

You can choose to export only predefined hosts or services.

For example, to export all services linked to "srv-mssql-01" host you have to execute following command:

centreon -u admin -p 'centreon' -e --select='HOST;srv-mssql-01' --filter-type='^(HOST|SERVICE)$'

To export "memory" and "mssql-listener" services execute following command:

centreon -e --select='SERVICE;memory' --select='SERVICE;mssql-listener' --filter-type='^SERVICE$'

To export all commands run:

centreon -u admin -p 'centreon' -o CMD -a show | awk -F\; 'NR > 2 { print "--select=\"CMD;" $2 "\"" }' | xargs --verbose php ./centreon -u admin -p 'centreon' -e

Import

You can import configuration from the exported file /tmp/clapi-export:

centreon -u admin -p 'centreon' -i /tmp/clapi-export.txt

In case you have a very large export file, it is advised to redirect the output of the above command to a file. Indeed, when errors occur during the import process, CLAPI will print out an error message along with the line number of the file, you might need to store those output message for troubleshooting later on.

You can build your own CLAPI command file if you know the straight forward syntax. You can use parameter described in Object Management with the syntax you can see in export files :

OBJECT;AACTION;Parameter1;Parameter2;Parameter3;...