check_mk 之 Check Parameters

本文介绍check_mk监控系统中配置检测参数的方法,包括手动检查、使用配置变量、设置全局默认值等,并详细解释了如何通过规则定义检查参数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

配置检测参数有几下方法

1. Creating manual checks instead of inventorized checks (using the variable checks).
2. Using the config variable check_parameters.
3. Setting check specific global default values.
4. using a check specific special configuration such as filesystem_levels.

manual check

在main.mk文件中配置条目.条目中的变量是list 或者tuple类型. 条目包括:Host specification,check type,check item,check parameter.
1. Host specification
checks = [
 ( "abc123", "df", "/var", (80.0, 90.0) ),
 ( "abc123", "df", "/tmp", (90.0, 95.0) ),
]

# host list 
checks = [
 ( ["abc123", "def456"], "df", "/var", (80.0, 90.0) ),
]

# list of tags
all_hosts = [
 "abc123|lnx",
 "def456|lnx",
 "xyz987|win",
]

checks = [
 ( ["lnx"], ALL_HOSTS, "df", "/var", (80.0, 90.0) ),
]

# all hosts
checks = [
 ( ALL_HOSTS, "df", "/var", (80.0, 90.0) ),
]

2. Check type
cmk -L

3. Check item
有些类型没有item,如mem,必须指定None
checks = [
 ( "abc123", "mem", None, (80.0, 120.0) ),
]

#Table of check types 
https://mathias-kettner.de/checkmk_checks.html

4. check parameter
有执行次序,后面的覆写前面的,如
checks = [
 # All hosts with Tag 'lnx' get levels 10 and 20...
 ( ["lnx"], ALL_HOSTS, "cpu.loads", None, (10, 20) ),

 # ...but sv01 and sv02 get levels 5 and 10
 ( ["sv01", "sv01"], "cpu.loads", None, ( 5, 10) ),
]

处理方式

1. 假如定义了manual check,则不管其他方式定义的参数。
2. 假如inventory建立完check,使用rules方式定义参数有效。
3. 假如使用rules方式定义参数没有生效,下次的inventory可以设置参数。
4. 假如没有参数确定,将使用main.mk里的system wide default levels
5. 最后使用代码里的global default parameters

Rule based check parameters

Each entry in check_parameters is a tuple with up to four columns:
1. The check parameters to be set for the rule (e.g. warning and critical levels)
2. Optional: list of tags the hosts must have
3. List of hosts matched by the entry, or ALL_HOSTS
4. List of service patterns (regular expressions) that must match the beginning of the service name in question.

check_parameters = [
 # (1) Filesystem C: on winsrv02 gets levels (92, 96)
 ( (92, 96), [ "winsrv02" ], [ "fs_C:" ]),

 # (2) Filesystems on hosts with tag 'sap' and 'test' are always OK
 ( (101, 101), [ 'sap', 'test' ], ALL_HOSTS, [ "fs_"]),

 # (3) Levels for filesystems below /sap (also /saptrans, /saptest)
 ( (80, 95), ALL_HOSTS, [ "fs_/sap" ]),

 # (4) Levels for filesystems /var and /tmp on all hosts
 ( (90, 95), ALL_HOSTS, [ "fs_/var$", "fs_/tmp$" ] ),

 # (5) Set levels for all remaining file systems to 80% / 90%
 ( (80, 90), ALL_HOSTS, [ "fs_" ] ),
]

# $表示未尾
posted on 2015-05-08 14:01 北京涛子 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/liujitao79/p/4487539.html

/****************************************************************************** ** Include Files ******************************************************************************/ #include "system_init.h" #include "Board_GpioCfg.h" /****************************************************************************** ** Private variables ******************************************************************************/ static volatile uint32_t TimingDelay; /******************************************************************************* ** Global Functions *******************************************************************************/ /** * @brief :Initialize the different GPIO ports * @param[in] None * @param[out] None * @retval :None */ // 配置 PORTB 为输出模式 GPIOB->DDR |= 0xFF; // 设置前8位为输出 GPIOB->DR &= ~0xFF; // 设置输出低电平 // 使能 GPIOA 和 GPIOB 的时钟 RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN | RCC_AHB1ENR_GPIOBEN; void BoardGpioInit(void) { GPIO_Write_Mode_Bits(GPIOA_SFR, GPIO_PIN_MASK_0, GPIO_MODE_OUT); //LED1 GPIO_Write_Mode_Bits(GPIO_SFR, GPIO_PIN_MASK_11, GPIO_MODE_OUT); //LED2 } /** * @brief: Delay time * @param[in] nms * @param[out] None * @retval : None */ void delay_ms(volatile uint32_t nms) { volatile uint32_t i, j; for (i = 0; i < nms; i++) { j = 5000; while (j--) ; } } /******************************************************************************* ** Main Functions *******************************************************************************/ int main() { /* Initialize the system clock is 72MHz*/ SystemInit(72U); /* Setup SysTick Timer as delay function, and input frequency is 72MHz */ systick_delay_init(72U); /* Initialize the user IOs */ BoardGpioInit(); while (1) { //GPIO_Write_Mode_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, GPIO_MODE_OUT); //LED1 //GPIO_Write_Mode_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, GPIO_MODE_OUT); //LED2 //GPIO_Write_Mode_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, Bit_SET);//LED1 H //GPIO_Write_Mode_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, Bit_SET);//LED1 H systick_delay_ms(200); //GPIO_Write_Mode_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, Bit_RESET);//LED1 L //GPIO_Write_Mode_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, Bit_SET);//LED2 H systick_delay_ms(200); //GPIO_Write_Mode_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, Bit_SET);//LED1 H //GPIO_Write_Mode_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, Bit_RESET);//LED2 L systick_delay_ms(200); //GPIO_Write_Mode_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOA_SFR, GPIO_PIN_MASK_3, Bit_RESET);//LED1 L //GPIO_Write_Mode_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, GPIO_MODE_OUT); GPIO_Set_Output_Data_Bits(GPIOF_SFR, GPIO_PIN_MASK_11, Bit_RESET);//LED2 L systick_delay_ms(200); } } /** * @brief : Reports the name of the source file and the source line number * where the assert_param error has occurred. * @param[in] file pointer to the source file name * @param[in] line assert_param error line source number * @param[out] None * @retval :None */ void check_failed(uint8_t *File, uint32_t Line) { /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* Infinite loop */ while (1) { ; } }; 这段代码编译显示10:14:13 **** Incremental Build of configuration Debug for project GPIO_InputOutput **** gmake -j16 all Building file: ../main.c ../main.c:22:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token ../main.c:23:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token ../main.c:26:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token ../main.c: In function 'BoardGpioInit': ../main.c:31:28: error: 'GPIO_SFR' undeclared (first use in this function) ../main.c:31:28: note: each undeclared identifier is reported only once for each function it appears in gmake: *** [subdir.mk:26: main.o] Error 1 "gmake -j16 all" terminated with exit code 2. Build might be incomplete. 10:14:14 Build Failed. 5 errors, 0 warnings. (took 642ms) 修改正确发给我
最新发布
08-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值