如何查看zabbix-server日志
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何查看zabbix-server日志相关的知识,希望对你有一定的参考价值。
参考技术A 首先要了解key,log[ file ,<regexp>,<encoding>,<maxlines>,<mode>,<output>]
file:文件名,写绝对路径
regexp:要匹配内容的正则表达式,或者直接写你要检索的内容也可以,例如我想检索带ERROR关键词的记录
encoding:编码相关,留空即可
maxlines:一次性最多提交多少行,这个参数覆盖配置文件zabbxi_agentd.conf中的’MaxLinesPerSecond’,我们也可以留空
mode:默认是all,也可以是skip,skip会跳过老数据
output:输出给zabbix server的数据。可以是\1、\2一直\9,\1表示第一个正则表达式匹配出得内容,\2表示第二个正则表达式匹配错的内容。
备注:我极力推荐大家使用第二个参数,看到网上一些zabbix监控日志的教程,几乎只有第一个参数,这样将会导致日志文件里的内容统统丢给zabbix_server记录! 参考技术B 查看服务器RAID信息,硬盘是否正常。
[root@monitor~]# hpacucli ctrl all show config
Smart Array P410i in Slot 0 (Embedded) (sn: 5001438018042FF0)
array A (SAS, Unused Space: 0 MB)
logicaldrive 1 (279.4 GB, RAID 1, OK)
physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 300 GB, OK)
physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 300 GB, OK)
3)通过hpacucli ctrl all show config detail命令可以详细地查看RAID和硬盘的信息。
[root@monitor ~]# hpacucli ctrl all show config detail
Smart Array P410i in Slot 0 (Embedded)
Bus Interface: PCI
Slot: 0
Serial Number: 5001438018042FF0
Cache Serial Number: PBCDH0CRH1FH62
RAID 6 (ADG) Status: Disabled
Controller Status: OK
Chassis Slot:
Hardware Revision: Rev C
Firmware Version: 5.14
Rebuild Priority: Medium
Expand Priority: Medium
Surface Scan Delay: 15 secs
Monitor and Performance Delay: 60 min
Elevator Sort: Enabled
Degraded Performance Optimization: Disabled
Inconsistency Repair Policy: Disabled
Post Prompt Timeout: 0 secs
Cache Board Present: True
Cache Status: OK
Accelerator Ratio: 25% Read / 75% Write
Drive Write Cache: Disabled
Total Cache Size: 512 MB
No-Battery Write Cache: Disabled
Cache Backup Power Source: Capacitors
Battery/Capacitor Count: 1
Battery/Capacitor Status: OK
SATA NCQ Supported: True
Array: A
Interface Type: SAS
Unused Space: 0 MB
Status: OK
Logical Drive: 1
Size: 279.4 GB
Fault Tolerance: RAID 1
Heads: 255
Sectors Per Track: 32
Cylinders: 65535
Stripe Size: 128 KB
Status: OK
Array Accelerator: Enabled
Unique Identifier: 600508B1001034373220202020200002
Disk Name: /dev/cciss/c0d0
Mount Points: /boot 99 MB
Logical Drive Label: A00ADBD9PR7AMU1472 898D
Mirror Group 0:
physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 300 GB, OK)
Mirror Group 1:
physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 300 GB, OK)
physicaldrive 1I:1:1
Port: 1I
Box: 1
Bay: 1
Status: OK
Drive Type: Data Drive
Interface Type: SAS
Size: 300 GB
Rotational Speed: 10000
Firmware Revision: HPD4
Serial Number: ECA1PC80GTS31234
Model: HP EG0300FBDSP
PHY Count: 2
PHY Transfer Rate: 6.0GBPS, Unknown
physicaldrive 1I:1:2
Port: 1I
Box: 1
Bay: 2
Status: OK
Drive Type: Data Drive
Interface Type: SAS
Size: 300 GB
Rotational Speed: 10000
Firmware Revision: HPD7
Serial Number: PMX6902D
Model: HP EG0300FBDBR
PHY Count: 2
PHY Transfer Rate: 6.0GBPS, Unknown 参考技术C /var/log/zabbix
Zabbix服务端启动失败,故障处理
搭建zabbix时,在启动zabbix-server过程中,提示启动失败,于是进入zabbix-server.log查看日志,看到如下一段:
[Z3001] connection to database 'zabbix' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
122145:20210916:182907.339 Cannot connect to the database. Exiting...
原因:
身份验证插件找不到。原来,MySql 8.0.23 换了新的身份验证插件(
caching_sha2_password
),
原来的身份验证插件为(mysql_native_password
)。zabbix找不到新的身份验证插件(caching_sha2_password
),
我们将mysql用户使用的登录密码加密规则 还原成 mysql_native_password,即可登陆成功。
mysql> use mysql;
mysql> select user,host,plugin,authentication_string from user; # 查看身份验证插件是否为mysql_native_password
mysql> alter user 'zabbix'@'%' identified with mysql_native_password by 'Na123***';
mysql> select user,host,plugin,authentication_string from user; # 再次查看验证方式,已经改了
重启zabbix即可
以上是关于如何查看zabbix-server日志的主要内容,如果未能解决你的问题,请参考以下文章