Summary of Icinga usage, icinga Summary
1. When defining commands, you often need to modify the commands. cfg configuration file. If you use the NPRE plug-in to monitor remote servers, the definition commands are not that complex.
The command for check_nrpe in commands. cfg is defined as follows:
define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
When defining the service file, you can write
define service{ use generic-service host_name 146 service_description check_users check_command check_nrpe!check_users -a 10 20 }
Check_users-a 10 20 is accepted by the $ ARG1 $ parameter in the check_nrpe command.
2. How to Use hostgroup to simplify Service Management
First define the hostgroup
Definition:
define hostgroup{ hostgroup_name hostgroup1 alias hg1 members 146,144}
144,146 is host_name, so the premise is that 146,144 has been defined in the host list.
Next, define the service
define service{ hostgroup_name hostgroup1 use generic-service service_description hg1_service check_command check_nrpe!check_users -a 10 20}
Whether the commands defined in check_command are the same as those in the service file of a single user does not matter.
The check_uers and hgw.service are just different service names, but the defined commands are the same.
3. About servicegroup
I personally feel that servicegroup is not very useful and cannot simplify management like hostgroup, but it is displayed in "Service Group Overview" on the Icinga WEB interface.
Servicegroup is defined as follows:
define servicegroup{ servicegroup_name servicegroup1 alias sg1 members 146,check_users,146,check_load}
The format of members is
Specifically, the host must be defined in the host list, and the service must be defined in the service file (Defined by service_description). For example, the 146 host defines the following services:
define service{ use generic-service host_name 146 service_description check_users check_command check_nrpe!check_users -a 10 20 } define service{ use generic-service host_name 146 service_description check_load check_command check_nrpe!check_load -a 10 20 }
4. performance data output length limit
By default, icinga reads the first 8 KB of data from the database returned by the plug-in. This aims to prevent the out-of-control plug-in from sending a large amount of data to Nagios.
If it does not meet your needs, you can modify it based on the actual situation.
Modify the MAX_PLUGIN_OUTPUT_LENGTH parameter in include/icinga. h and re-compile it.
#define MAX_PLUGIN_OUTPUT_LENGTH 8192 /* max length of plugin output (including perf data) */
In fact, you need to modify the source code file of the nrpe plug-in.
Include/common. h has two parameters to be modified
#define MAX_INPUT_BUFFER 4096 /* max size of most buffers we use */#define MAX_PACKETBUFFER_LENGTH 4096 /* max amount of data we'll send in one query/response */
If MAX_PACKETBUFFER_LENGTH is modified, you must modify the value in the nrpe plug-in on the server (Note: The value of MAX_INPUT_BUFFER must not be the same). Otherwise, the following error is reported.
Jan 26 15:45:02 mysql-server2 nrpe[14201]: Error: Request packet had invalid CRC32.Jan 26 15:45:02 mysql-server2 nrpe[14201]: Client request was invalid, bailing out...
In the source code, MAX_PACKETBUFFER_LENGTH is 1024 by default, and MAX_INPUT_BUFFER is 2048 by default. After I change the former to 4096, I find that although the length of the client performance data obtained from the server is provided, but still less than 4096, only 2048, and finally modified the value of MAX_INPUT_BUFFER to 4096, to achieve the desired result.