Zabbix Server 配置文件解析

AlertScriptsPath

默认值:/usr/local/share/zabbix/alertscripts

说明:告警脚本目录

AllowRoot

默认值:0 说明:是否允许使用root启动,0:不允许,1:允许,默认情况下她会使用zabbix用户来启动

zabbix进程,不推荐使用root

CacheSize

取值范围: 128K-8G

默认值:8M

说明:配置缓存,用于存储host,item,trigger数据,2.2.3版本之前最大支持2G,目前最大支持

8G,zabbix5.0最大支持64G

CacheUpdateFrequency

取值范围:1-3600

默认值:60

说明:多少秒更新一次配置缓存

DBHost

默认值:localhost

说明:数据库主机地址

DBName

默认值:无

必填:是

DBPassword:

默认值:无

说明:数据库密码

DBPort

取值范围:1024-65535

默认值:3306

说明:SQLite作为DB,这个选项请忽略,如果使用socket链接,也请忽略。

DBSchema

说明:Schema名称. 用于 IBM DB2 、 PostgreSQL.

DBSocket

默认值:/tmp/mysql.sock

说明:mysql sock文件路径

DebugLevel

取值范围:0-5

默认值:3

说明: 指定debug级别

0 - 基本信息

1 - critical信息

2 - error信息

3 - warnings信息

4 - 调试日志,日志内容很多,慎重使用

5 - 用于调试web和vmware监控

ExternalScripts

默认值: /usr/local/share/zabbix/externalscripts

说明: 外部脚本目录

Fping6Location

默认值:/usr/sbin/fping6

说明:fping6路径,如果zabbix非root启动,请给fping6 SUID

FpingLocation

默认值:/usr/sbin/fping

说明:和上面的一样

HistoryCacheSize

取值范围:128K-2G

默认值:8M

说明:

历史记录缓存大小,用于存储历史记录

HistoryTextCacheSize

取值范围:128K-2G

默认值:16M

说明:文本类型历史记录的缓存大小,存储character, text 、log历史记录.

HousekeepingFrequency

取值范围:0-24

默认值:1

说明:housekeep执行频率,默认每小时回去删除一些过期数据。如果server重启,那么30分钟之后才执行一次,接下来,每隔一小时在执行一次。

Include

说明:include配置文件,可以使用正则表达式,例如:/usr/local/zabbix-

2.4.4/conf/ttlsa.com/*.conf

JavaGateway

说明:Zabbix Java gateway的主机名,需要启动Java pollers

JavaGatewayPort

取值范围:1024-32767

默认值:10052

Zabbix Java gateway监听端口

ListenIP

默认值:0.0.0.0

说明:监听地址,留空则会在所有的地址上监听,可以监听多个IP地址,ip之间使用逗号分隔,例如:

127.0.0.1,10.10.0.2

ListenPort

取值范围:1024-32767

默认值:10051

说明:监听端口

LoadModule

说明:加载模块,格式: LoadModule=,文件必须在指定的LoadModulePath目录下,如果需要加载多个模块,那么写多个即可。

LoadModulePath

模块目录,参考上面

LogFile

日志文件,例如:/data/logs/zabbix/zabbix-server.log

LogFileSize

取值范围:0-1024

默认值:1

0表示禁用日志自动rotation,如果日志达到了限制,并且rotation失败,老日志文件将会被清空掉,重新

生成一个新日志。

LogSlowQueries

取值范围:0-3600000

默认值:0

多慢的数据库查询将会被记录,单位:毫秒,0表示不记录慢查询。只有在DebugLevel=3时,这个配置才有

效。

MaxHousekeeperDelete

取值范围: 0-1000000

默认值:5000

housekeeping一次删除的数据不能大于MaxHousekeeperDelete

PidFile

默认值:/tmp/zabbix_server.pid

PID文件

ProxyConfigFrequency

取值范围:1-604800

默认值:3600

proxy被动模式下,server多少秒同步配置文件至proxy。

ProxyDataFrequency

取值范围:1-3600

默认值:1

被动模式下,zabbix server间隔多少秒向proxy请求历史数据

SenderFrequency

取值范围:5-3600

默认值:30

间隔多少秒,再尝试发送为发送的报警

SNMPTrapperFile

默认值:/tmp/zabbix_traps.tmp

SNMP trap发送到server的数据临时存放文件。

SourceIP

出口IP地址

SSHKeyLocation

SSH公钥私钥路径

SSLCertLocation

SSL证书目录,用于web监控

SSLKeyLocation

SSL认证私钥路径、用于web监控

SSLCALocation

SSL认证,CA路径,如果为空,将会使用系统默认的CA

StartDBSyncers

取值范围:1-100

默认值:4

预先foke DB Syncers的数量,1.8.5以前最大值为64

StartDiscoverers

取值范围:0-250

默认值:1

pre-forked discoverers的数量,1.8.5版本以前最大可为255

StartPollers

# Mandatory: no

取值范围:0-1000

默认值:5

Number of pre-forked instances of pollers.

StartHTTPPollers

取值范围:0-1000

默认值:1

pre-forked HTTP pollers的数量,1.8.5以前最大255

StartIPMIPollers

取值范围:0-1000

默认值:0

pre-forked IPMI pollers的数量,1.8.5之前,最大为255

StartPollersUnreachable

取值范围:0-1000

默认值:1

pre-forked instances of pollers for unreachable hosts (including IPMI and Java)

Timeout

取值范围:1-30

默认值:3

agent,snmp,external check的超时时间,单位为秒

TmpDir

默认值:/tmp

TrapperTimeout

取值范围:1-300

默认值:300

处理trapper数据的超时时间

TrendCacheSize

取值范围:128K-2G

默认值:4M

历史数据缓存大小

UnavailableDelay

取值范围:1-3600

默认值:60

间隔多少秒再次检测主机是否可用

UnreachableDelay

取值范围:1-3600

默认值:15

间隔多少秒再次检测主机是否可达。

UnreachablePeriod

取值范围:1-3600

默认值:45

检测到主机不可用,多久将它置为不可达

User

默认值:zabbix

启动zabbix server的用户,在配置禁止root启动,并且当前shell用户是root得情况下有效。如果当前用户是ttlsa,那么zabbix server的运行用户是ttlsa

ValueCacheSize

取值范围:0,128K-64G

默认值:8M

0表示禁用,history value缓存大小,当缓存超标了,将会每隔5分钟往server日志里面记录。养成看日志的好习惯。

案例:利用API添加几百台监控的主机,因为默认值8M太小 ,会造成Zabbix Server 不断的重启,可以看到如下日志信息

root@zabbix-server ~]#tail -f /var/log/zabbix/zabbix_server.log

......

8588:20220617:213218.764 syncing trend data done

8588:20220617:213218.764 Zabbix Server stopped. Zabbix 5.0.24 (revision

313ff6504e3).

8611:20220617:213228.800 Starting Zabbix Server. Zabbix 5.0.24 (revision

313ff6504e3).

8611:20220617:213228.800 ****** Enabled features ******

8611:20220617:213228.800 SNMP monitoring: YES

8611:20220617:213228.800 IPMI monitoring: YES

8611:20220617:213228.800 Web monitoring: YES

8611:20220617:213228.800 VMware monitoring: YES

8611:20220617:213228.800 SMTP authentication: YES

8611:20220617:213228.800 ODBC: YES

8611:20220617:213228.800 SSH support: YES

8611:20220617:213228.800 IPv6 support: YES

8611:20220617:213228.800 TLS support: YES

8636:20220617:213239.302 ******************************

8636:20220617:213239.302 using configuration file:

/etc/zabbix/zabbix_server.conf

8636:20220617:213239.306 current database version (mandatory/optional):

05000000/05000005

8636:20220617:213239.306 required mandatory version: 05000000

8636:20220617:213239.315 server #0 started [main process]

8637:20220617:213239.316 server #1 started [configuration syncer #1]

8637:20220617:213239.535 __mem_malloc: skipped 0 asked 72 skip_min

18446744073709551615 skip_max 0

8637:20220617:213239.535 [file:dbconfig.c,line:96] __zbx_mem_malloc(): out of

memory (requested 72 bytes)

8637:20220617:213239.535 [file:dbconfig.c,line:96] __zbx_mem_malloc(): please

increase CacheSize configuration parameter

8637:20220617:213239.535 === memory statistics for configuration cache ===

8637:20220617:213239.535 free chunks of size 24 bytes: 55

8637:20220617:213239.535 free chunks of size 32 bytes: 11

8637:20220617:213239.535 free chunks of size 40 bytes: 6

8637:20220617:213239.535 free chunks of size 48 bytes: 5

8637:20220617:213239.535 free chunks of size 56 bytes: 3

8637:20220617:213239.535 min chunk size: 24 bytes

8637:20220617:213239.535 max chunk size: 56 bytes

8637:20220617:213239.535 memory of total size 7264040 bytes fragmented into

70263 chunks

8637:20220617:213239.535 of those, 2320 bytes are in 80 free

chunks

8637:20220617:213239.535 of those, 7261720 bytes are in 70183 used

chunks

8637:20220617:213239.535 of those, 1124192 bytes are used by allocation

overhead

8637:20220617:213239.535 ================================

[root@zabbix-server ~]#cat /var/log/syslog

Jun 17 21:37:18 zabbix-server systemd[1]: zabbix-server.service: Scheduled

restart job, restart counter is at 31.

Jun 17 21:37:18 zabbix-server systemd[1]: Stopped Zabbix Server.

Jun 17 21:37:18 zabbix-server systemd[1]: Starting Zabbix Server...

Jun 17 21:37:18 zabbix-server systemd[1]: Started Zabbix Server.

Jun 17 21:37:18 zabbix-server kill[9306]: 用法:

Jun 17 21:37:18 zabbix-server kill[9306]: kill [options] <pid> [...]

Jun 17 21:37:18 zabbix-server kill[9306]: 选项:

Jun 17 21:37:18 zabbix-server kill[9306]: <pid> [...] send signal to

every <pid> listed

Jun 17 21:37:18 zabbix-server kill[9306]: -<signal>, -s, --signal <signal>

Jun 17 21:37:18 zabbix-server kill[9306]: specify the

<signal> to be sent

Jun 17 21:37:18 zabbix-server kill[9306]: -l, --list=[<signal>] list all

signal names, or convert one to a name

Jun 17 21:37:18 zabbix-server kill[9306]: -L, --table list all

signal names in a nice table

Jun 17 21:37:18 zabbix-server kill[9306]: -h, --help 显示此帮助然后离开

Jun 17 21:37:18 zabbix-server kill[9306]: -V, --version 显示程序版本然后离开

Jun 17 21:37:18 zabbix-server kill[9306]: 欲了解更多详细信息,请参见 kill(1)。

Jun 17 21:37:18 zabbix-server systemd[1]: zabbix-server.service: Control process

exited, code=exited, status=1/FAILURE

Jun 17 21:37:18 zabbix-server systemd[1]: zabbix-server.service: Failed with

result 'exit-code'.

[root@zabbix-server ~]#systemctl status zabbix-server.service

● zabbix-server.service - Zabbix Server

Loaded: loaded (/lib/systemd/system/zabbix-server.service; enabled; vendor

preset: enabled)

Active: activating (auto-restart) (Result: exit-code) since Fri 2021-06-17

21:38:51 CST; 8s ago

Process: 9509 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited,

status=0/SUCCESS)

Process: 9528 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited,

status=1/FAILURE)

Main PID: 9526 (code=exited, status=0/SUCCESS)

6月 17 21:38:51 zabbix-server.wang.org systemd[1]: zabbix-server.service: Control

process exited, code=exited, status=1/FAILURE

6月 17 21:38:51 zabbix-server.wang.org systemd[1]: zabbix-server.service: Failed

with result 'exit-code'.

#加大缓存

[root@zabbix-server ~]#vim /etc/zabbix/zabbix_server.conf

# CacheSize=8M

CacheSize=256M

#观察结果,发现Zabbix Server 服务启动成功

[root@zabbix-server ~]#systemctl is-active zabbix-server.service

active

-------------------------

占用的数据库磁盘空间可能会很大,如何估算空间占用?官方给出相关的公式

官方公式:

https://www.zabbix.com/documentation/6.0/zh/manual/installation/requirements

https://www.zabbix.com/documentation/5.0/zh/manual/installation/requirements

根据使用 MySQL 后端数据库的实际统计数据中收集到的平均值,例如监控项为数值类型的值约 90 个字节,事件约 170 个字节。

因此,所需要的磁盘总空间按下列方法计算:

配置文件数据+ 历史数据+ 趋势数据+ 事件数据

案例:假设 100台主机,每个主机约有100个监控项,每个监控项每间隔60s获取一次数值

#历史数据:

days*(items/refresh rate)*24*3600*bytes

90*(10000/60)*24*3600*90=116173440000 字节 约共116GB

#趋势:

days*(items/3600)*24*3600*bytes

365*(10000/3600)*24*3600*90=5676480000 字节 约共5G

#事件:

days*events*24*3600*bytes

365*1*24*3600*170=5361120000 约5G

#合计:126GB

*根据占用磁盘空间大小选择合适的策略进行数据库性能调优

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凤舞飘伶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值