5.UseCentreonOrder ofCommands
For detailed use, please refer to:
http://documentation.centreon.com/docs/centreon-clapi/en/latest/user/objects/commands.html#
using Centreon's commands parameter, you can add, delete, and change Nagios's inspection commands.
①.Lists the availableNagioscommand, usingSHOWAction:
1), command:
centreon-u User name - P Password - o host-o cmd-a show |
[Email protected] ~]# Centreon-uadmin-p123456-o cmd-a Show Id;name;type;line 1;check_host_alive;check; $USER 1$/check_ping-h $HOSTADDRESS $ w 3000.0,80%-C 5000.0,100%-P 1 2;check_disk_smb;check; $USER 1$/check_disk_smb-h $HOSTADDRESS $-S $ARG 1$-u $ARG 2$-P $ARG 3$-W $ARG 4$-C $ARG 5$ 3;check_distant_disk_space;check; $USER 1$/check_distant_disk_space-h $HOSTADDRESS $-C $ARG 1$-P $ARG 2$-W $ARG 3$-C $ARG 4$ 4;check_centreon_dummy;check, $USER 1$/check_centreon_dummy-s $ARG 1$-o $ARG 2$ ...... |
Column parameter Description:
Column |
Description |
Command ID |
|
Command name |
Custom |
Command Type |
Values :Check , notif or misc |
Command Line |
System command line that'll be run on execution |
②.Increase inNagioscommand, using
ADDAction:
Format:
Centreon-u User name -P password -o cmd-a add-v ' command name ; type ; Command ' |
Note: When you define a command directly, you need to use the single quote " ' ", a variable should be included in the command" $... ".
1), execute the command:
[Email protected] ~]# centreon-uadmin-p123456-o cmd-a add-v ' Centreon-check-mysql;check; $USER 1$/check_mysql-h $ hostaddress$-P $ARG 1$-u $ARG 2$-P $ARG 3$ ' [Email protected] ~]# |
2),WebShow Results:
650) this.width=650; "src=" Http://static.oschina.net/uploads/space/2014/0924/143323_l76C_727880.png "alt=" 143323_ L76c_727880.png "/>
3),Nagiosconfiguration file Results:
[Email protected] ~]# cd/usr/local/nagios/etc/ [[email protected] etc]# grep centreon-check-mysql-r./* |
4), activate the configuration, restart the service:
650) this.width=650; "src=" Http://static.oschina.net/uploads/space/2014/0924/143334_62sS_727880.png "alt=" 143334_ 62ss_727880.png "/>
5),Nagiosconfiguration file Results:
[[email protected] etc]# grep centreon-check-mysql-r./* [Email protected] etc]# [[email protected] etc]# grep centreon-check-mysql-r./* ./checkcommands.cfg: Command_name centreon-check-mysql [Email protected] etc]# |
6), column parameter description:
Column |
Description |
Command ID |
|
Command Name |
Custom |
Command type |
Values :Check , notif or misc |
Command Line |
System command line that'll be run on execution |
Note: You will need to regenerate the configuration file and then reboot to apply the change monitoring engine.
The type of command, which is very important, can be executed directly, and can obtain the information of the monitored machine command, using the check type, and the notification command, then use notify.
③.Delete theNagioscommand, using
DELAction:
Format:
Centreon-u User name -P password -o cmd-a del-v ' command name ' |
Note: When you define a command directly, you need to use the single quote " ' ", a variable should be included in the command" $... ".
1), execute the command:
[Email protected] ~]# centreon-uadmin-p123456-o cmd-a del-v ' Centreon-check-mysql ' [Email protected] ~]# |
Note: You will need to regenerate the configuration file and then reboot to apply the change monitoring engine.
④.Modified byNagioscommand, using
SetParamAction:
Format:
Centreon-u User name -P password -o cmd-a setparam-v ' command name ; parameters ; value ' |
Note: When you define a command directly, you need to use the single quote " ' ", a variable should be included in the command" $... ".
1), execute the command:
[Email protected] etc]# centreon-uadmin-p123456-o cmd-a show|grep centreon-check-mysql 119;centreon-check-mysql; check; $USER 1$/check_mysql-h $HOSTADDRESS $-P $ARG 1$-u $ARG 2$-P $ARG 3$ [Email protected] etc]# centreon-uadmin-p123456-o cmd-a setparam-v ' centreon-check-mysql;type;notif ' [Email protected] etc]# centreon-uadmin-p123456-o cmd-a show|grep centreon-check-mysql 119; Centreon-check-mysql; Notif; $USER 1$/check_mysql-h $HOSTADDRESS $-P $ARG 1$-u $ARG 2$-P $ARG 3$ [Email protected] etc]# centreon-uadmin-p123456-o cmd-a setparam-v 'centreon-check-mysql; NAME;FUFANGC Hun-check-mysql ' [Email protected] etc]# centreon-uadmin-p123456-o cmd-a show|grep fufangchun-check-mysql 119; Fufangchun-check-mysql, Notif, $USER 1$/check_mysql-h $HOSTADDRESS $-P $ARG 1$-u $ARG 2$-P $ARG 3$ [Email protected] etc]# |
2), column parameter description:
Parameter |
Description |
Name |
Name of command |
Line |
Command Line |
Type |
Check , notif, misc |
Graph |
Graph template applied on command |
Example |
Example of arguments (i.e:!80!90) |
Comment |
Comments regarding the command |
Note: You will need to regenerate the configuration file and then reboot to apply the change monitoring engine.
At this point, we can use the Centreon command to automatically add the Nagios Check command, very convenient.
This article is from the "Guilt Free" blog, so be sure to keep this source http://perofu.blog.51cto.com/6061242/1557709
Nagios+centreon Summary of the eighth Chapter--centreon add nagios Check command