Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix configuration deployment

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Zabbix

Experimental environment:

Server: 192.168.36.131

Client: 192.168.36.129

Iptables and selinux disabled

one。 Server configuration

1. Installation

# rpm-ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/

Zabbix-release-2.2-1.el6.noarch.rpm

# yum install zabbix-server-mysql zabbix-web-mysql

Configuration related to 2.mysql database

Problem: root reports an error when entering mysql

Solution: enter safe mode and change the root password of mysql

# mysqld_safe-user=mysql-skip-grant-tables-skip-networking &

# mysql-u root mysql

Mysql > UPDATE user SET Password=PASSWORD ('westos') where USER='root'

Mysql > FLUSH PRIVILEGES

Mysql > quit

Re-enter successfully and create a zabbix database

# / etc/init.d/mysqld restart

# mysql-u root-p

Enter a new password

Mysql > create database zabbix character set utf8 collate utf8_bin

Mysql > grant all privileges on zabbix.* to zabbix@localhost identified by 'westos'

Mysql > flush privileges

Mysql > quit

3.zabbix user login authentication

# mysql-u zabbix-pwestos zabbix

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | zabbix |

+-+

2 rows in set (0.00 sec)

Mysl > quit

3. Import database sql script

# find /-name schema.sql

/ usr/share/doc/zabbix-server-mysql-2.4.5/create/schema.sql

/ usr/share/doc/zabbix-proxy-mysql-2.4.5/create/schema.sql

# find /-name data.sql

/ usr/share/doc/zabbix-server-mysql-2.4.5/create/data.sql

# find /-name p_w_picpaths.sql

/ usr/share/doc/zabbix-server-mysql-2.4.5/create/p_w_picpaths.sql

Import script # import in this order, otherwise an error will be reported

# mysql-u zabbix-pwestos zabbix

< schema.sql # mysql -u zabbix -pwestos zabbix < p_w_picpaths.sql # mysql -u zabbix -pwestos zabbix < data.sql 4.更改时区 # vim /etc/php.ini 946 ;date.timezone = Asia/Shanghai 5.启动服务 # /etc/init.d/zabbix-server start # /etc/init.d/zabbix-agent start # /etc/init.d/httpd start 5.访问http://ip/zabbix 本次试验访问:http://192.168.36.131/zabbix 进入欢迎界面点击计入下一页 测试数据库连接->

Database name and user name zabbix,passwd is the password previously set

Zabbix server configuration

Information inspection

Prompt information

Username:Admin;Password:zabbix

two。 Client configuration

1. Installation

# yum install-y zabbix-agent-2.4.5-1.el6.x86_64.rpm

# vim / etc/zabbix/zabbix_agentd.conf

Server=192.168.36.131

ServerActive=192.168.36.131

Name=test2.example.com

# / etc/init.d/zabbix-agent start

# netstat-antlp

Tcp 00 0.0.0.0 10050 0.0.0.015 * LISTEN 4367/zabbix_agentd

Tcp 00: 10050: * LISTEN 4367/zabbix_agentd

three。 Wechat called the police.

# git clone https://github.com/lealife/WeiXin-Private-API

Wechat script

/ usr/lib/zabbix/alertscripts/weixin.sh

Administration- > Media types- > create media type, add Wechat alarm

Administration- > Users- > right drop-down list, select Users- > Admin- > Media to add add

The Configuration- > Actions- > Create action,Action options are added as follows

The Operations option is added as follows

IV. Zabbix email alarm

Administration- > Media types- > create media type, add email alarm

Administration- > Users- > right drop-down list, select Users- > Admin- > Media to add add

The Configuration- > Actions- > Create action,Action options are added as follows

The Operations option is added as follows

5. Trigger trigger

Cpu usage monitoring

System.cpu.util [,]

System.cpu.util [0,user,avg5]

The specific number of cpu is the specific core of CPU.

Type is the different state value of CPU.

Idle, nice, user (default), system (default for Windows), iowait, interrupt, softirq, steal

Where idle means idle, and user means that the user uses

The final avg5 represents an average value of every 5 minutes. A null value indicates the current value. To change it to an average of 15 minutes, you only need to write it as avg15.

The current CPU usage is written as system.cpu.util [, user], which is the same as system.cpu.util [, idle]

Memory monitoring

Vm.memory.size []

Total (default), active,anon, buffers, cached, exec, file, free

Inactive pinned, shared, wired, used, pused, available, pavailable

Trigger severity is used to display the level of Trigger, and zabbix supports several alert levels.

Level meaning color

Not classified unknown Grey

Information system Information Light green

Warning warns yellow

Average General question orange

High seriously warns red

Disaster data loss Bright red

The purpose of classification: 1 different alarms represent different colors and 2 sound alarms, and different levels can be alerted with different sounds. 3 different levels use different methods of alarm notification, such as sms email. ..

Units supported by trigger

S seconds h hours

M minutes d days

W week K Kilo

M mega G giga

T tera P peta

E exa Z zetta

Y yotta

Instance: Configure- > Hosts- > triggers

Example 1: monitoring of disk partitions

Vfs.fs.size [fs,]

Mode, the default is total, and the rest is the percentage of free,used,pfree,pused,p, here in%

The corresponding units are B (which means Byte here) and%, if the monitoring size: Numeric (unsigned) Decimal

Capture the partition situation of the client on the zabbix server

# zabbix_get-s 192.168.36.167-p 10050-k "vfs.fs.size [/ dev/sda2,used]"

241664

Create a new item to monitor partition / dev/sda2 usage

Create a trigger and alarm when the host / dev/sda2 usage space is more than 20%.

For example, 2:/etc/passwd changes the diff function.

First add an item:Configure- > Hosts- > Items, which is used by the project to detect the file MD5 value.

Call the diff function

Example 3: if the network card traffic continues to exceed 100k in 5 minutes, the alarm will be given.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report