ubuntu16.04+zabbix安装与部署

1.安装
wget –no-check-certificate https://repo.zabbix.com/zabbix/4.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_4.0-3+xenial_all.deb
dpkg -i zabbix-release_4.0-3+xenial_all.deb
apt update

2.安装Zabbix server,Web前端,agent
apt install zabbix-server-mysql zabbix-frontend-php zabbix-agent

3.创建初始数据库
mysql -uroot -p123456

create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by '123456';
grant all privileges on zabbix.* to zabbix@localhost;
quit;

4.导入初始架构和数据,系统将提示您输入新创建的密码。
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

5.为Zabbix server配置数据库
sudo vim /etc/zabbix/zabbix_server.conf
DBPassword=123456

6.为Zabbix前端配置PHP
sudo vim /etc/zabbix/apache.conf
php_value date.timezone Asia/Shanghai

7.启动Zabbix server和agent进程
systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2

服务关闭
systemctl stop zabbix-server zabbix-agent
systemctl disable zabbix-server zabbix-agent

8.其他需监控服务器安装客户端

sudo scp admin@10.10.6.146:/tmp/zabbix-agent_2.4.7+dfsg-2ubuntu2_amd64.deb ./

sudo dpkg -i zabbix-agent_2.4.7+dfsg-2ubuntu2_amd64.deb && sudo sed -i.ori 's#Server=127.0.0.1#Server=10.10.6.145#' /etc/zabbix/zabbix_agentd.conf && sudo systemctl enable zabbix-agent.service && sudo systemctl restart zabbix-agent.service && sudo netstat -anpt | grep zabbix

其他命令:

查看版本
zabbix_get -s 10.10.6.145 -p 10050 -k agent.version

读取文件内容
zabbix_get -s 10.10.6.145 -p 10050 -k vfs.file.contents[D:/test.conf,'UTF-8']

文件大小
zabbix_get -s 10.10.6.145 -p 10050 -k vfs.dir.size[D:/platform,conf]

磁盘空间(空闲)
zabbix_get -s 10.10.6.145 -p 10050 -k vfs.fs.size[D:/,free]

内存大小(已用)
zabbix_get -s 10.10.6.145 -p 10050 -k vm.memory.size[used]

原文链接:https://blog.csdn.net/mgledu/article/details/120491915

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享