master 192.168.88.99
slave 192.168.88.17
Last_SQL_Error: Error 'Table 'zabbix.history_uint' doesn't exist' on query. Default dat abase: 'zabbix'. Query: 'insert into history_uint (itemid,clock,ns,value) values (30558,1586348082,368 403134,26022),(30552,1586348082,369439672,1),(30553,1586348082,374153330,1600),(30566,1586348082,37807 4108,2600),(30562,1586348082,387439827,16935),(30567,1586348082,388074908,3),(30560,1586348082,3954718 54,1138),(30559,1586348082,404479188,313),(30555,1586348082,411423967,2),(30561,1586348082,419364113,1 3279),(30565,1586348082,419952885,1),(30556,1586348082,426486631,1098441083),(30557,1586348082,4342327 65,22857777),(30554,1586348082,439578638,2),(30563,1586348082,441860389,0)'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
需要把server 的zabbix数据库放到slave上来就可以了
[root@localhost ~]# zabbix_get -s 192.168.88.17 -k mysql_status[slave_status]
ERROR 1227 (42000) at line 1: Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation
0
给个授权
MariaDB [(none)]> grant all on *.* to 'check'@'localhost' identified by '123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[root@localhost scripts]# cat /etc/zabbix/scripts/check_mysql.sh
#!/bin/bash
case $1 in
slave_status)
mysql -ucheck -p123 "show slave status \G;" | grep "Running" | grep "Yes" | awk '{print $2}' | wc -l
;;
esac
[root@localhost scripts]# systemctl restart zabbix-agent
[root@localhost ~]# visudo #把zabbix加进去
110 # %wheel ALL=(ALL) NOPASSWD: ALL
111 zabbix ALL=(ALL) NOPASSWD: ALL
[root@localhost zabbix_agentd.d]# pwd
/etc/zabbix/zabbix_agentd.d
[root@localhost zabbix_agentd.d]# cat mysql.conf
UserParameter=mysql.status[*],sudo /etc/zabbix/scripts/check_mysql.sh $1 #加上sudo
[root@localhost zabbix_agentd.d]# systemctl restart zabbix-agent
[root@localhost yum.repos.d]# zabbix_get -s 192.168.88.8 -k mysql.status[table_size]
420
上传安装包 tar zxf filebeat-6.8.8-linux-x86_64.tar.gz
https://www.elastic.co/cn/downloads/past-releases#filebeat
vim tar zxf filebeat-6.8.8-linux-x86_64/filebeat.yml
./filebeat -c filebeat.yml -e
NFS 启动不成功
[root@localhost ~]# showmount -e 192.168.88.8
clnt_create: RPC: Program not registered
解决
[root@localhost ~]# systemctl stop nfs
[root@localhost ~]# systemctl stop rpcbind
Warning: Stopping rpcbind.service, but it can still be activated by:
rpcbind.socket
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
[root@localhost ~]# ss -ntlp | grep rpcbind
LISTEN 0 128 *:111 *:* users:(("rpcbind",pid=40188,fd=4),("systemd",pid=1,fd=45))
LISTEN 0 128 [::]:111 [::]:* users:(("rpcbind",pid=40188,fd=6),("systemd",pid=1,fd=47))
[root@localhost ~]# showmount -e 192.168.88.8
Export list for 192.168.88.8:
/backup 192.168.88.0/24