In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to carry out zabbix monitoring deployment, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following for you. I hope you can get something from this article.
Zabbix monitoring
Environment centos6.7 lamp zabbix2
1 install zabbix
Yum install-y epel-release
Lamp environment where the rpm package is installed
Yum install-y httpd mysql mysql-libs php php-mysql mysql-server php-bcmath php-gd php-mbstring
Install the zabbix server
Yum install zabbix20 zabbix20-agent zabbix20-server zabbix20-server-mysql zabbix20-web zabbix20-web-mysql net-snmp-devel
/ etc/init.d/zabbix-server start # start the server
/ etc/init.d/zabbix-agent start # start the agent side
/ etc/init.d/httpd start # launch apache
Modify mysql configuration file modification
Vim / etc/my.cnf
[mysql]
Default-character-set = utf8
[mysqld]
Character_set_server = utf8
Start the mysql service
/ etc/init.d/mysqld start
Build a library and import data
Mysql-uroot-p-e "create database zabbix"
Mysql-uroot-p-default-character-set=utf8 zabbix
< /usr/share/zabbix-mysql/schema.sql mysql -uroot -p --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/p_w_picpaths.sql mysql -uroot -p --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/data.sql 创建zabbix用户并授权 grant all privileges on *.* to zabbix@'127.0.0.1' identified by 'zabbix'; grant all privileges on *.* to zabbix@'localhost' identified by 'zabbix'; grant all privileges on *.* to zabbix@'%' identified by 'zabbix'; 修改zabbix server配置文件 配置文件:/etc/zabbix/zabbix-server.conf 指令有四类: ############ GENERAL PARAMETERS ################# ############ ADVANCED PARAMETERS ################ #############LOADABLE MODULES ################## #############TLS-RELATED PARAMETERS ############# 只修改############ GENERAL PARAMETERS ################# 其他使用默认配置即可 通用参数,不需要修改 # ListenPort=10051 # SourceIP= 默认所有IP # LogType=file 日志主动保存到文件 LogFile=/var/log/zabbix/zabbix_server.log 日志位置 LogFileSize=0 日志多大后进行滚动 PidFile=/var/run/zabbix/zabbix_server.pid 服务端PID文件的路径 需要修改项: DBHost=localhost # 取消注释 DBName=zabbix # 填写库名称,默认为zabbix DBUser=zabbix # 数据库用户名 DBPassword=zabbix # 数据库密码 DBSocket=/var/lib/mysql/mysql.sock # 如果数据库在本机,和数据库进行本机通信,要跟/etc/my.conf里的配置socket=/var/lib/mysql/mysql.sock一致 修改后重启zabbix /etc/init.d/zabbix-server restart 修改php.ini文件 vim /etc/php.ini date.timezone="Asia/Shanghai" max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 2.网页安装zabbix 关闭selinux 关闭防火墙 浏览器访问 http://192.168.1.5/zabbix, 如果有"It is not safe to rely on the system's timezone settings "这样的警告信息,需要vim /etc/php.ini 设置 date.timezone="Asia/Shanghai"点next 其他的参数报错信息,按照上面修改 (vim /etc/php.ini)的参数 输入mysql相关信息, 首先要测试一下,如果不通过,则需要调试,测试通过后,点next Name 写127.0.0.1,(可以自定义)点next,再点next,最后点finish 默认管理员账号为 admin:zabbix 如果遇到"zabbix server is not running"这样的错误,需要编辑配置/etc/zabbix/zabbix_server.conf 配置DBUser, DBPassword 3. 接入要监控的主机 在客户端上yum install zabbix20-agent vim /etc/zabbix_agentd.conf //更改Server=服务端ip; ServerActive=0.0.0.0:10050; Hostname=test(自定义,但要唯一) 启动客户端 /etc/init.d/zabbix-agent start 服务端上命令行测试:zabbix_get -s 客户端ip -p10050 -k "system.hostname" 在web界面下,点"configuration" -->"host"-- > "Create Host" in the upper right corner, where host name and visible name are customized. You can select groups. By default, ip address is written to the client ip.
Configure the monitoring project template: click "templates", click add, select Template OS Linux in the pop-up window, then click select, and finally click save
4. Custom templates
Zabbix comes with many templates, in which there are many monitoring projects, such as CPU, network cards, memory, processes, and so on. There are a bit too many templates that come with the system, so we can customize the templates. Click configuration to select templates, and click create template in the upper right corner
Template name and Visible name customization. Select templates for Groups and click save.
Then we pick some items and copy them to the template: for example, we find Template OS Linux, click items, select the project we want, and then select copy selected to below. Then click go.
Group choose templates, find the templates we customized just now, and click copy.
Click configuration to select templates to see that the new templates already has the items of our copy.
We can customize the copy Triggers using the same method as above, which is used to set the alarm threshold. Of course, we can also customize and edit it.
5. Configure to send email
Yum install-y sendmail
Mkdir-p / home/zabbix/bin
Vim / home/zabbix/bin/baojing.sh / / content:
#! / bin/bash
Echo "$3" | / bin/mail-s "$2" $1
Chmod + x / home/zabbix/bin/baojing.sh
In the zabbix_server.conf configuration file, there are parameters AlertScriptsPath and ExternalScripts
AlertScriptsPath=/home/zabbix/bin/-user-defined media types script
ExternalScripts=/home/zabbix/bin/-user-defined check script (item)
This is the only way to find your script, because you just enter the name of the script in frontend, and there is no path.
Create mediea types: "Administration"-> "Media types", click "Create Media Type" in the upper right corner, where Description fill in "baojing" or other custom name, Type select "Script", Script fill in "baojing.sh" and then click "Save".
Create user: "Adimistration"-- > "Users" in the upper right corner, select "Users", click "Create User", alias: test1, Custom name and lastname password:123456;group Select guest, go back to the above, click media,type, select baojing,send to to write to the mailbox to send email, click add, and finally click save.
Create action: "configuration"-> actions, "Create Actions" in the upper right corner, Name customization, I'll write "baojing" here, other defaults, then click the "New" button under "Operations" on the right, "Operation Type" select "Send message", "Send Message to" select one or more user groups to send messages, Send to Users select our new test1, "Send only to" select baojing, click add
Last point: save
After reading the above, do you have any further understanding of how to deploy zabbix monitoring? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.