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

Compilation and installation of zabbix and Wechat alarm

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Recently changed jobs, there are still a lot of things to do at the beginning, now make a summary and share with you.

On the first day after joining the new company, the department leader assigned the task, arranged a set of zabbix monitoring system, monitored the company's firewall, switch and all online servers, and then called the official Wechat account to send an alarm message. Zabbix I think you are no stranger, powerful enterprise-level open source distributed monitoring software, a variety of alarm methods and a large number of community monitoring templates make it very popular, no matter yum installation or compilation installation is not difficult, because there is no Wechat alarm before, but also can be solved after consulting relevant materials on the Internet, there are a lot of these contents on the Internet. Here, I will summarize in detail the construction of my entire monitoring system and the steps of setting up Wechat alarms.

1. Compile and install zabbix 2.4

Zabbix version 2.4 is not a new version, you can try the 3.x version, I use version 2.4.

1. Install the development package

Yum-y groupinstall "Development Tools"

2. Install the required dependency packages

Yum-y install httpd mysql mysql-server mysql-devel php php-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-devel net-snmp net-snmp-devel perl-DBI php-xml ntpdate php-bcmath

(you can also install Zabbix in a compiled LAMP environment. )

3. Download the Zabbix source code package (it is better to download it directly from the official website)

4. Modify the Mysql default code (if there is already a library running, it is recommended to specify the code separately when creating the library)

[root@localhost ~] # vim / etc/my.cnf

[mysqld]

Character_set_server = utf8 # join in this area

[root@localhost ~] # service mysqld start

Starting MySQL.... SUCCESS!

[root@localhost] # chkconfig-- add mysqld

[root@localhost] # chkconfig-- level 35 mysqld on

5. Update system time

[root@localhost] # ntpdate us.pool.ntp.org & & hwclock-w # it's best to plan tasks

[root@localhost ~] # crontab-l

10 * / usr/sbin/ntpdate us.pool.ntp.org & & hwclock-w > / dev/null 2 > & 1

[root@localhost ~] # service crond restart

[root@localhost] # chkconfig-- add crond

[root@localhost] # chkconfig-- level 35 crond on

6. Install Zabbix

[root@localhost ~] # groupadd zabbix

[root@localhost] # useradd-r-s / sbin/nologin-g zabbix zabbix

[root@localhost ~] # cd / usr/local/src/

[root@localhost src] # tar zxf zabbix-2.4.0.tar.gz

[root@localhost src] # cd zabbix-2.4.0

[root@localhost zabbix-2.4.0] # / configure-- prefix=/usr/local/zabbix-- enable-server-- enable-agent-- enable-proxy-- with-mysql-- with-net-snmp-- with-libcurl-- enable-java-- with-libxml2

# # description of compilation parameters

-- enable-server installs zabbix server

-- enable-proxy installs zabbix proxy (used to set up distributed deployment)

-- enable-agent installs zabbix agent (if you don't monitor this machine, you don't have to install it)

-- enable-java installs java suite, which is required for monitoring tomcat.

-- with-mysql uses mysql database

-- with-net-snmp supports snmp protocol (used to monitor various network devices)

-- with-libcurl supports curl (user web service monitoring)

[root@localhost zabbix-2.4.0] # make & make install

7. Create and import the database

[root@localhost] # mysql-uroot-p123456

Mysql > create database zabbix; (create database zabbix character set utf8;)

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

Mysql > flush privileges

Mysql > use zabbix

Mysql > source / usr/local/src/zabbix-2.4.0/database/mysql/schema.sql

Mysql > source / usr/local/src/zabbix-2.4.0/database/mysql/p_w_picpaths.sql

Mysql > source / usr/local/src/zabbix-2.4.0/database/mysql/data.sql

Mysql > show tables

Mysql > quit

8. Configure the service [root@localhost ~] # cd / usr/local/src/zabbix-2.4.0

[root@localhost zabbix-2.4.0] # cp misc/init.d/fedora/core/zabbix_server / etc/init.d/

[root@localhost zabbix-2.4.0] # cp misc/init.d/fedora/core/zabbix_agentd / etc/init.d/

[root@localhost zabbix-2.4.0] # cp-r frontends/php/ / var/www/html/zabbix

[root@localhost ~] # vim / usr/local/zabbix/etc/zabbix_server.conf

LogFile=/tmp/zabbix_server.log # definition log files are available by default

DBName=zabbix # defines the database name by default

DBUser=zabbix # defines database users by default (add this library user separately for security)

DBPassword=zabbix # defines the database password (you know the production environment)

9. Modify the installation directory of zabbix in the startup script

[root@localhost ~] # vim / etc/init.d/zabbix_server

BASEDIR=/usr/local/zabbix

[root@localhost ~] # vim / etc/init.d/zabbix_agentd

BASEDIR=/usr/local/zabbix

10. Start the service and join the boot auto

[root@localhost ~] # / etc/init.d/httpd start

[root@localhost] # chkconfig-- add zabbix_server

[root@localhost] # chkconfig-- add zabbix_agentd

[root@localhost] # chkconfig-- level 35 zabbix_server on

[root@localhost] # chkconfig-- level 35 zabbix_agentd on

[root@localhost ~] # service zabbix_server start

[root@localhost ~] # service zabbix_agentd start

Second, initialize using a browser

Visit: http://ip/zabbix

The file of php.ini needs to be changed during installation. If fail occurs in databases support and bcmath,gettext,

This means that there is no corresponding php extension. If php is installed by yum, only yum-y install php-mysqli php-bcmath php-gettext is required.

If it is compiled and installed, do the following:

1. Find the source package of php

[root@localhost src] # cd php-5.4.13/

2. Enter the corresponding extension directory

[root@localhost php-5.4.13] # cd ext/mysqli and / bcmath/ and / gettext/

3. Execute the phpize command

[root@localhost mysqli] # / usr/local/php/bin/phpize

4. After generating configure

[root@localhost mysqli] #. / configure-- with-php-config=/usr/local/php/bin/php-config-- with-mysqli=/usr/local/mysql/bin/mysql_config # this-- with-mysqli is only used by adding mysqli extensions, and the other two items only write the first with

[root@localhost mysqli] # make; make install

5. Create a reference directory

[root@localhost ~] # mkdir / usr/lib64/extensions

6. Cp it to the directory

[root@localhost ~] # cp / usr/local/php/lib/php/extensions/no-debug-zts-20140525/mysqli.so and bcmath.so and gettext.so / usr/lib64/extensions/

7. Modify php.ini

[root@localhost ~] # vim / usr/local/php/php.ini

Extension_dir = / usr/lib64/extensions/

Extension = mysqli.so

Extension = bcmath.so

Extension = gettext.so

Restart apache

Due to the problem with the version, the 2.2.x series does not show the Chinese option to modify a file.

[root@localhost ~] # vim / var/www/html/zabbix/include/locales.inc.php

54 'zh_CN' = > array (' name' = > _ ('Chinese (zh_CN)'), 'display' = > false)

# We need to change the above false to the following true and refresh the page.

54 'zh_CN' = > array (' name' = > _ ('Chinese (zh_CN)'), 'display' = > true)

Because the space is too long, the setting of zabbix Wechat alarm is written in a separate chapter.

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

Wechat

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

12
Report