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

Installation and deployment process monitored by Zabbix

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

Share

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

This article introduces the relevant knowledge of "the installation and deployment process of Zabbix monitoring". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

First, install the dependency packages required for Zabbix deployment

# yum-y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre* make#yum-y install gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel#yum-y install freetype-devel net-snmp-devel#yum-y install cmake gcc* ncurses-devel

Second, install nginx

# useradd nginx#tar zxvf nginx-1.9.15.tar.gz & & cd nginx-1.9.15#./configure-- prefix=/usr/local/nginx-- user=nginx-- group=nginx-- with-http_ssl_module-- with-http_v2_module-- with-http_stub_status_module-- with-pcre#make & & make install

Third, install PHP

1. Compile and install PHP

# tar zxvf php-5.5.35.tar.gz & & cd php-5.5.35#./configure-- prefix=/usr/local/php-- with-config-file-path=/usr/local/php/etc-- with-bz2-- with-curl-- enable-ftp-- enable-sockets-- disable-ipv6-- with-gd-- with-jpeg-dir=/usr/local-with-png-dir=/usr/local-- with-freetype-dir=/usr/local-- enable -gd-native-ttf-- with-iconv-dir=/usr/local-- enable-mbstring-- enable-calendar-- with-gettext-- with-libxml-dir=/usr/local-- with-pdo-mysql=mysqlnd-- with-mysqli=mysqlnd-- with-mysql=mysqlnd-- enable-dom-- enable-xml-- enable-fpm-- with-libdir=lib64-- enable-bcmath#make & & make install#cp php.ini-production / usr/local/php/etc/php.ini#cd / usr/ Local/php/etc/#cp php-fpm.conf.default php-fpm.conf

two。 Edit / usr/local/php/etc/php.ini (parameters that need to be modified in zabbix environment)

Max_execution_time = 300m memory_limit = 128m post_max_size = 16m upload_max_filesize = 2m max_input_time = 300m date.timezone = "Asia/Shanghai"

Fourth, install Mysql

1. Compile and install mysql

# groupadd mysql#mkdir-p / usr/share/mysql/data#useradd-r-g mysql- d / usr/share/mysql/data-s / sbin/nologin mysql#chown-R mysql.mysql / usr/share/mysql/data#tar zxvf mysql-5.5.49.tar.gz & & cd mysql-5.5.49#cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DDEFAULT_CHARSET=utf8-DENABLED_LOCAL_INFILE=1-DMYSQL_DATADIR=/usr/share/mysql/data-DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1-DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_TCP_PORT=3306-DDEFAULT_COLLATION=utf8_general_ci#make & & make install#chown-R mysql.mysql / usr/local/mysql#cd / usr/local/mysql/support-files/#cp my-medium.cnf / usr/share/mysql/data/my.cnf#cp mysql.server / etc/init.d/mysqld#chmod + x / etc/init.d/mysqld#cd / usr/local/mysql/scripts#./mysql_install_db- -user=mysql-basedir=/usr/local/mysql/-datadir=/usr/share/mysql/data

two。 Edit / usr/share/mysql/data/my.cnf

Datadir = / usr/share/mysql/data

3. Start the mysql service

# / etc/init.d/mysqld

4. Log in to the database and create a zabbix database with a user name and password:

Mysql > create database zabbix default charset utf8;Query OK, 1 row affected (0. 00 sec) mysql > grant all privileges on zabbix.* to zabbix@'localhost' identified by '12345 6 questions: query OK, 0 rows affected (0. 03 sec) mysql > flush privileges;Query OK, 0 rows affected (0. 00 sec) mysql > show databases

5. Create the database root user password:

# mysqladmin-uroot password "123456"

5. Install zabbix server

1. Compile and install zabbix server

# tar zxvf zabbix-3.0.0.tar.gz & & cd zabbix-3.0.0#./configure-- prefix=/usr/local/zabbix-- enable-server-- enable-agent-- with-mysql-- with-net-snmp-- with-libcurl-- with-libxml2#make & & make install#groupadd zabbix#useradd-r-g zabbix- s / sbin/nologin zabbix#mysql-uroot-p123456 zabbix

< database/mysql/schema.sql#mysql -uroot -p123456 zabbix < database/mysql/images.sql#mysql -uroot -p123456 zabbix < database/mysql/data.sql#mkdir /usr/share/data/web/zabbix -p#mkdir /usr/share/data/logs/zabbix -p#cp -rp frontends/php/* /usr/share/data/web/zabbix/#mkdir /usr/local/nginx/conf/extra 2.编辑/usr/local/nginx/conf/extra/zabbix.conf 3.编辑/usr/local/nginx/conf/nginx.conf

4. Edit / usr/local/zabbix/etc/zabbix_server.conf

LogFile=/tmp/zabbix_server.log PidFile=/tmp/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=123456

5. Create a soft link

# ln-s / usr/local/mysql/lib/libmysqlclient.so.18 / usr/lib64/

6. Download zabbix.conf.php and upload it to / usr/share/data/web/zabbix/conf

7. Modify file owners and groups

# chown zabbix.zabbix zabbix.conf.php

VI. Start related services

1. Start the nginx service

# / usr/local/nginx/sbin/nginx

two。 Start the php service

# / usr/local/php/sbin/php-fpm

3. Start the zabbix_server service

/ usr/local/zabbix/sbin/zabbix_server

7. Configure zabbix on the Web side

Change the admin login password (if you forget the admin password, the initial password is zabbix)

1.echo-n 123456 | openssl md5

2.mysql-uroot-p123456

IX. Sinicization of zabbix

1. Edit / usr/share/data/web/zabbix/include/locales.inc.php

'zh_CN' = > [' name' = > _ ('Chinese (zh_CN)'), 'display' = > true]

two。 Edit / usr/share/data/web/zabbix/include/defines.inc.php

Replace DejaVuSans with simkai and remove / usr/share/data/web/zabbix/fonts/DejaVuSans.ttf.

10. Zabbix agent deployment

1. Install zabbix agent

# tar zxvf zabbix-3.0.0.tar.gz#cd zabbix-3.0.0#./configure-prefix=/usr/local/zabbix-enable-agent#make & & make install#groupadd zabbix#useradd-g zabbix zabbix#chown-R zabbix.zabbix / usr/local/zabbix

two。 Edit / usr/local/zabbix/etc/zabbix_agentd.conf

PidFile=/tmp/zabbix_agentd.pidLogFile=/tmp/zabbix_agentd.logServer=192.168.11.11ServerActive=192.168.11.11Hostname=gzyk_ZabbixAgent_192.168.11.66User=zabbix

3. Start the zabbix agent service

# / usr/local/zabbix/sbin/zabbix_agentd

Enable JMX to monitor weblogic or tomcat

1. Monitoring weblogic

1) if it is the adminserver that monitors the weblogic, edit the setDomainEnv.sh and add the following at the end of the file:

JAVA_OPTIONS= "${JAVA_OPTIONS}-Dcom.sun.management.jmxremote=true-Dcom.sun.management.jmxremote.authenticate=false-Dcom.sun.management.jmxremote.ssl=false-Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder-Dcom.sun.management.jmxremote.port=12345-Dcom.sun.management.jmxremote.rmi.port=12345-Djava.rmi.server.hostname=192.168.11.66"

Then restart weblogic

2) if you are monitoring a managed server: go to the weblogic console-> Environment-> Server-> "your new server"-> configure-> start the server. Enter in the input box of parameters:

-Dcom.sun.management.jmxremote.port=12345-Djava.rmi.server.hostname=192.168.11.66-Dcom.sun.management.jmxremote.authenticate=false-Dcom.sun.management.jmxremote.ssl=false-Djavax.management.builder.initial=weblogic.management.jmx.mbeanserver.WLSMBeanServerBuilder

As shown in the following figure:

Finally, go to the weblogic console-> Domain-> configuration-> General Information-> Advanced, and enable "enable platform MBean Server" and "platform MBean Server used".

Then restart AdminServer and the managed server.

two。 Monitoring Tomcat

1) download catalina-jmx-remote.jar

# wget-O / opt/apache-tomcat-6.0.44_9000/lib/catalina-jmx-remote.jar http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.44/bin/extras/catalina-jmx-remote.jar

2) modify the catalina.sh of tomcat

Add under "#-Execute The Requested Command -" in the catalina.sh of the client tomcat

Export CATALINA_OPTS= "- Dcom.sun.management.jmxremote=true-Dcom.sun.management.jmxremote.authenticate=false-Dcom.sun.management.jmxremote.ssl=false-Djavax.management.builder.initial=-Dcom.sun.management.jmxremote.port=12345-Dcom.sun.management.jmxremote.rmi.port=12345-Djava.rmi.server.hostname=192.168.11.66"

Port: the monitoring port set on the zabbix page is maintained all the time. The default is 12345.

Hostname: the IP or hostname of the server where the tomcat is currently located.

Tomcat under Windows

Set CATALINA_OPTS=%CATALINA_OPTS%-Dcom.sun.management.jmxremote=trueset CATALINA_OPTS=%CATALINA_OPTS%-Dcom.sun.management.jmxremote.authenticate=falseset CATALINA_OPTS=%CATALINA_OPTS%-Dcom.sun.management.jmxremote.ssl=falseset CATALINA_OPTS=%CATALINA_OPTS%-Djavax.management.builder.initial=set CATALINA_OPTS=%CATALINA_OPTS%-Dcom.sun.management.jmxremote.port=12345set CATALINA_OPTS=%CATALINA_OPTS%-Dcom.sun.management.jmxremote.rmi.port=12345set CATALINA_OPTS=%CATALINA_OPTS %-Djava.rmi.server.hostname=192.168.11.66

3. Test with tools

Download http://nchc.dl.sourceforge.net/project/jmxcmd/jmxcmd.jar and test it on the zabbix-server server:

# java-jar jmxcmd.jar-82.12.72.82range 12345 java.lang:type=Memory NonHeapMemoryUsage

If you do not report an error, add monitoring to the zabbix WEB page

Monitoring oracle

Orabbix is a small plug-in for monitoring oracle, which can be used without installation and decompression. Orabbix simulates the java program, visits an oracle user, creates a connection, and queries the usage of the current database in the form of sql.

1. To create a new user, zabbix/zabbix, you need to give query permission as follows (no DBA permission):

CREATE USER ZABBIX IDENTIFIED BY zabbix DEFAULT TABLESPACE TS_DAT_AYGL TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK; GRANT CONNECT TO ZABBIX; GRANT RESOURCE TO ZABBIX; ALTER USER ZABBIX DEFAULT ROLE ALL; GRANT SELECT ANY TABLE TO ZABBIX; GRANT CREATE SESSION TO ZABBIX; GRANT SELECT ANY DICTIONARY TO ZABBIX; GRANT UNLIMITED TABLESPACE TO ZABBIX; GRANT SELECT ANY DICTIONARY TO ZABBIX

In addition to creating users, if the monitoring target is oracle11g, you need to execute two more sql (this sql can be executed not under the zabbix user, but under other users with permission to execute):

Exec dbms_network_acl_admin.create_acl (acl= > 'resolve.xml',description = >' resolve acl', principal = > 'ZABBIX', is_grant = > true, privilege = >' resolve'); exec dbms_network_acl_admin.assign_acl (acl= > 'resolve.xml', host = >' *'); commit

two。 After all the execution is completed, you need to test to see if the data can be queried, and execute the following statement:

Select utl_inaddr.get_host_name ('127.0.0.1') from dual

The ability to perform no error reporting means that there is no problem with the creation of zabbix users

3. Upload the installation package. Here, we put the extracted files under / usr/local/orabbix, first empower (two files), and then modify the configuration files. Here, you need to modify four configuration files, as shown below:

# cd / usr/local/orabbix#chmod 750 run.sh init.d/orabbix

4. Edit init.d/orabbix and copy init.d/orabbix to the / etc/init.d directory

Orabbix=/usr/local/orabbix (modified to the path of orabbix decompression)

5. Edit run.sh

/ usr/local/java/sunjava6_64/bin/java-Duser.language=en-Duser.country=US-Dlog4j.configuration=./conf/log4j.properties-cp $(for i in lib/*.jar; do echo-n $I:; done). / orabbix-1.2.3.jar com.smartmarmot.orabbix.bootstrap start. / conf/config.props &

6. Make a copy of config.props

# cp conf/config.props.sample conf/config.props

7. Edit the conf/config.props file

ZabbixServerList=ZabbixServer1ZabbixServer1.Address=192.168.11.11ZabbixServer1.Port=10051OrabbixDaemon.PidFile=./logs/orabbix.pidOrabbixDaemon.Sleep=300OrabbixDaemon.MaxThreadNumber=100DatabaseList=gzyk_ZabbixAgent_192.168.11.3DatabaseList.MaxActive=10DatabaseList.MaxWait=100DatabaseList.MaxIdle=1gzyk_ZabbixAgent_192.168.11.3.Url=jdbc:oracle:thin:@192.168.11.3:1521:jxgzyuykgzyk_ZabbixAgent_192.168.11.3.User=zabbixgzyk_ZabbixAgent_192.168.11.3.Password=zabbixgzyk_ZabbixAgent_192.168.11.3.MaxActive=10gzyk_ZabbixAgent_192.168.11.3.MaxWait=100gzyk_ZabbixAgent_ 192.168.11.3.MaxIdle=1gzyk_ZabbixAgent_192.168.11.3.QueryListFile=./conf/query.props

8. Start the service

# service orabbix start

XIII. Zabbix upgrade

1. Download the zabbix-3.2.6 source package and extract the installation

# tar zxvf zabbix-3.2.6.tar.gz#cd zabbix-3.2.6#./configure-prefix=/usr/local/zabbix-enable-server-enable-agent-enable-java-with-mysql-with-net-snmp-with-libcurl-with-libxml2#make & & make install

two。 Replace the original PHP page file (find your own directory for php pages)

# cp-rp / root/zabbix_packages/zabbix-3.2.6/frontends/php/* / usr/share/data/web/zabbix/

3. Copy a copy of the backed up zabbix.conf.php to the / usr/share/data/web/zabbix/conf directory

# cp-p zabbix.conf.php / usr/share/data/web/zabbix/conf/

4. Overwrite all files in the backup / usr/local/zabbix/etc directory over all files in the current / usr/local/zabbix/etc directory

# cp-fr / usr/local/zabbix3.0/etc/* / usr/local/zabbix/etc/

5. Start the relevant service and check the log to see if there are any errors

# / usr/local/zabbix/sbin/zabbix_server#/usr/local/zabbix/sbin/zabbix_agentd#/usr/local/zabbix/sbin/zabbix_java/startup.sh

6. Modify / usr/share/data/web/zabbix/include/defines.inc.php (re-Sinicization)

This is the end of the "installation and deployment process monitored by Zabbix". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Network Security

Wechat

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

12
Report