In internal network environment, the time between the collection server and proxy server are not synchronized, it will lead to the following two questions:
(not yet found other problems caused due to the time of sync)
1) proxy case of the recent negative time, as shown below :
Once a negative number appears, even though the latter time synchronization, and also still hold a negative, but not to monitor the situation.
2) When the snmp monitor network devices, buttons snmp agreement does not shine, but the latest data, as shown below:
Solution: Configure the NTP service on the collection server, so that the proxy server as an NTP client to the time on the collection server as standard .
Environment:
CentOS Linux Release 7.3.1611 (Core)
of ZABBIX Agent and Version: 3.4.13
Configuration process:
Install ntp server service on 1.zabbix
1) Mount a local image file
detailed steps will be omitted.
2) source local mirror disposed
detailed steps will be omitted.
3) Use the command yum install ntp service:
yum -y install ntp
Ntp server configured as a server on 2.zabbix
1)修改配置文件
vi /etc/ntp.conf
//将这行给注释
#restrict default nomodify notrap nopeer noquery
//然后添加这两行 ,意思是 允许IPV4 IPV6 查询 拒绝修改
restrict -4 default kod notrap nomodify
restrict -6 default kod notrap nomodify
//添加修改上层时间服务器,如果能联通外网,则不需要修改,
server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst
//如果联不通外网,则把上面几行注释,然后添加下面两行,意思是设置时间服务器为自己
server 127.127.1.0
fudge 127.127.1.0 stratum8
修改完成后如下图所示:
(grep -Ev "^#|^$" /etc/ntp.conf 命令的用途是排除#开头的注释,显示文件的内容)
2)开启服务
systemctl start ntpd
3)查看ntpd服务的运行状态
systemctl status ntpd
4)配置ntpd服务开机自启
systemctl enable ntpd
或:
chkconfig ntpd on
5)查看ntp服务器同步状态
[root@localhost ~]# ntpstat # 确认本地NTP与上层NTP服务器是否联通
synchronised to local net at stratum nine
time correct to within 12 ms # 时间校正到相差12ms之内
polling server every 64 s # 每64秒会向上级NTP轮询更新一次时间
[root@localhost ~]# ntpq -p # 查看本地NTP需进行同步的公网NTP服务器状态
remote refid st t when poll reach delay offset jitter
LOCAL(0) .LOCL. 8 l 60 64 377 0.000 0.000 0.000
[root@localhost ~]#
参数详解:
remote :本地主机所连接的上层NTP服务器,最左边的符号如下:
如果有[] 代表目前正在使用当中的上层NTP服务器。
如果有[+] 代表也有连上上层NTP服务器,可以作为提高时间更新的候选NTP服务器
如果有[-] 代表同步的该NTP服务器被认为是不合格的NTP Server
如果有[x] 代表同步的外网NTP服务器不可用
refid :指的是给上层NTP服务器提供时间校对的服务器。
St:上层NTP服务器的级别。
When: 上一次与上层NTP服务器进行时间校对的时间(单位:s)
Poll :本地主机与上层NTP服务器进行时间校对的周期(单位:s)
reach:已经向上层 NTP 服务器要求更新的次数
delay:网络传输过程当中延迟的时间,单位为 10^(-6) 秒
offset:时间补偿的结果,单位为10^(-6) 秒
jitter:Linux 系统时间与 BIOS 硬件时间的差异时间, 单位为 10^(-6) 秒。
3.代理服务器上配置为ntp客户端
1)安装ntp服务
过程同1. zabbix服务器上安装ntp服务
2)修改ntp配置文件
//将这行给注释
#restrict default nomodify notrap nopeer noquery
//设置时间服务器为内网NTP服务器
server 10.160.255.142 iburst
修改完成后如下图所示:
(grep -Ev "^#|^$" /etc/ntp.conf 命令的用途是排除#开头的注释,显示文件的内容)
3)开启服务
systemctl start ntpd
4)查看ntpd服务的运行状态
systemctl status ntpd
或
chkconfig ntpd on
5)使用ntpstat 和ntpq -p命令,查看ntp服务器同步状态
4.一段时间后再观察snmp监控网络设备的情况
一段时间后,snmp协议的按钮颜色恢复正常
过程中可能出现的问题:
1.按教程配置了ntp客户端口,ntpstat 和ntpq -p命令看到的状态异常。
分析:这可能是ntp客户端的本地时间与ntp服务器的时间相差太大导致的。
解决办法:
1)手动执行ntpdate 10.160.255.142 命令,进行时间同步。
2)时间同步后,使用systemctl restart ntpd 命令重启ntp服务即可
After 2.ntp service synchronizes the system time, time synchronization hardware also want the
methods of operation:
1) Modify / etc / sysconfig / ntpd file, write the following two lines:
the OPTIONS = "- U NTP: NTP -p / var / RUN / ntpd.pid -g "
SYNC_HWCLOCK = Yes
results as shown below:
2) after completion of the modification, to restart the ntpd service.
Reference Links:
https://blog.csdn.net/qq_36119192/article/details/82813477
Detailed parameters:
remote: upper NTP server locally connected host, the leftmost symbols are as follows:
如果有[*] 代表目前正在使用当中的上层NTP服务器。
如果有[+] 代表也有连上上层NTP服务器,可以作为提高时间更新的候选NTP服务器
如果有[-] 代表同步的该NTP服务器被认为是不合格的NTP Server
如果有[x] 代表同步的外网NTP服务器不可用
refid: refers to the time server to provide proof to the upper NTP server.
St: upper level NTP server.
When: once a time proofreading time and NTP server on top (unit: s)
Poll: localhost time period proofreading NTP server upper layer (unit: s)
reach: the number of updates have been requested to the upper NTP server
delay: among the network transfer delay time, in units of 10 ^ (- 6) seconds
offset: time compensation result, in units of 10 ^ (- 6) seconds
jitter: Linux hardware BIOS system time and the time difference time, in 10 ^ (- 6) seconds.