Zabbix是使用非常广泛的开源监控管理工具。基于Zabbix可以很方便的建立面向操作系统,应用,中间件,数据库等领域的监控、性能数据可视化、报警、维护窗口管理等监控管理工作。 不多说了,分享直接上实战,zabbix 版本稍微旧了点, 比较是实用, 后期在更新。。
安装EPEL源
[[email protected] ~]# yum install epel-release
安装LAMP 环境通过yum方式
[[email protected] ~]# yum install zabbix20 zabbix20-agent zabbix20-server zabbix20-server-mysql zabbix20-web zabbix20-web-mysql net-snmp-devel
启动zabbix 服务,且开机启动
[[email protected] ~]# /etc/init.d/zabbix-server start; /etc/init.d/zabbix-agent start Starting Zabbix server: [ OK ] Starting Zabbix agent: [ OK ] [[email protected] ~]# /etc/init.d/mysqld start; /etc/init.d/httpd start Starting mysqld: [ OK ]
导入表库信息
[[email protected] ~]# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/schema.sql [[email protected] ~]# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/images.sql [[email protected] ~]# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/data.sql
访问http://ip/zabbix ,通过web方式进行安装
出现了时区的问题, 这里修改/etc/php.ini 文件
开发其date.timezone = date.timezone = Asia/Chongqing (大概在946行)
重启服务
[[email protected] ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
刷新页面,问题解决
点击next 按钮, 出现了以下页面,页面参数有三个失败, 这里需要再次修改/etc/php.ini
将页面上提示的红色参数值进行调整
[[email protected] ~]# grep max_size /etc/php.ini post_max_size = 16M [[email protected] ~]# grep max_exec /etc/php.ini max_execution_time = 300 [[email protected] ~]# grep max_input_time /etc/php.ini ; max_input_time max_input_time = 300
修改完后, 重新加载及刷新页面
问题解决都是OK 状态了
[[email protected] ~]# mysql -uroot -p openstack -e grant all on zabbix.* to ‘zabbix‘@localhost identified by ‘zabbixpasswd‘ (数据默认无登陆密码可以通过此命令执行) [[email protected] ~]# mysql -u root -p openstack Enter password: ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES) [[email protected] ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 Server version: 5.1.73-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> use zabbix; Database changed mysql> grant all on zabbix.* to ‘zabbix‘@localhost identified by ‘zabbixpasswd‘ -> ; Query OK, 0 rows affected (0.07 sec) mysql> quit Bye [[email protected] ~]# mysql -uzabbix -pzabbixpasswd Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 19 Server version: 5.1.73-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> quit Bye [[email protected] ~]#
点击下一步
[[email protected] ~]# /etc/init.d/zabbix-server start Starting Zabbix server: [ OK ] [[email protected] ~]# ps aux |grep zabbix zabbix 3541 0.0 0.1 74672 1100 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3543 0.0 0.1 74672 1100 ? S 05:38 0:01 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3544 0.0 0.1 74672 888 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3545 0.0 0.1 74672 888 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3546 0.0 0.1 74672 888 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3547 0.0 0.1 74684 1076 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf 494 4347 0.0 0.2 116000 2428 ? S 06:05 0:00 /usr/sbin/zabbix_server -c /etc/zabbix_server.conf root 4353 0.0 0.0 103248 848 pts/1 S+ 06:05 0:00 grep zabbix [[email protected] ~]#
点击Finish 即可出现zabbix 的登陆界面
在以上配置的时候注意zabbix数据库密码设置,若配置文件没有定义zabbix 数据库密码, 这里修改
[[email protected] ~]# vim /etc/zabbix/zabbix_server.conf 111 DBPassword=zabbixpasswd [[email protected] ~]# /etc/init.d/zabbix-server restart Shutting down Zabbix server: [ OK ] Starting Zabbix server: [ OK ] [[email protected] ~]# netstat -tulnp |grep zabbix tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 3541/zabbix_agentd tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 4520/zabbix_server tcp 0 0 :::10050 :::* LISTEN 3541/zabbix_agentd tcp 0 0 :::10051 :::* LISTEN 4520/zabbix_server
客户端安装:
[[email protected] yum.repos.d]# yum install zabbix20-agent [[email protected] yum.repos.d]# vim /etc/zabbix_agentd.conf [[email protected] yum.repos.d]# /etc/init.d/zabbix-agent start Starting Zabbix agent: [ OK ] [[email protected] yum.repos.d]# netstat -tnlp|grep zabbix tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2760/zabbix_agentd tcp 0 0 :::10050 :::* LISTEN 2760/zabbix_agentd [[email protected] yum.repos.d]#
在Server 端进行测试
[[email protected] yum.repos.d]# zabbix_get -s 192.168.229.146 -k "system.hostname" linux-node2.openstack.com [[email protected] yum.repos.d]#
接下来在web页面进行配置了,并且可以修改语言在profile 里设置
时间: 2024-12-24 11:35:10