1. 在客户端主机添加配置文件
需求:自定义监控设备登录人数,超过2人同时登录就发出告警
1.zabbix监控原理 使用键值获取对象设备的数据,可在监控项中查看自带key 例如:vfs.fs.size[/home,total] ; 查看文件夹占用 可在服务器用zabbix_get 进行主动获取测试: zabbix_get -s '192.168.164.128' -p 10050 -k 'vfs.fs.size[/,total]' #根目录占用 2.明确需要执行的Linux命令 who | wc -l #统计登录用户数 3.在客户端zabbix的配置文件,查看自定义key方式 vim /etc/zabbix/zabbix_agent2.conf ``` # UnsafeUserParameters=0 ### Option: UserParameter # User-defined parameter to monitor. There can be several user-defined parameters. # Format: UserParameter=<key>,<shell command> # See 'zabbix_agentd' directory for examples. # # Mandatory: no # Default: # UserParameter= ``` 这段配置说明我们需要定义 ' UserParameter= ' 形式的配置,作为自定义key语句 ``` ### Option: Include # You may include individual files or all files in a direc