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

LAMP builds zabbix to monitor Oracle database for Linux

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

Share

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

Prepare the introduction of the environment

The function that the document wants to achieve is to add an orabbix plug-in on the zabbix server to access the oracle database for monitoring operations.

The environment introduces CentOS 7 zabbix 2.4.2.

Yum introduced that the local yum source was configured because the company's computer could not access the external network.

You can download the corresponding rpm package according to php-common or go to my network disk to see if there is any address you need as follows

Link http://pan.baidu.com/s/1skGbrat password n9p3

Introduction to the implementation process

1. First of all, the construction of LAMP, in which the construction of Linux environment is not introduced here. For more information on the construction of MySQL database, please refer to the previous document.

Building Apache and PHP also mentioned earlier that because there is no external network, we can only use the package provided by CentOS 7 and then mount to my local.

Configuration of yum sourc

Vi / etc/yum.repo.d/CentOS-Local.repo

Name=This is a local repo source for lamp

Baseurl= file:///mnt/Package

Gpgcheck=0

Enabled=1

X-- Save exit

Ps invalidates repo files that cannot be used under yum.repo.d by commenting them

Vim / etc/fstab

/ dev/sr0 / mnt/Package iso9660 default 0 0

X-- Save exit

Mount-a remount

= = at this point the local yum source configuration is complete =

Modify the hostname configuration hostnamectl set-hostname confirm the modified name

Modify firewall configuration vi / etc/selinux/config to disabled

# systemctl disable firewalld.service

# systemctl stop firewalld.service

Modify time zone configuration timedatectl set-timezone Asia/Shanghai

Timedatectl set-local-rtc 1-time will be synchronized with local computer time

Timedatectl set-time YYYY-MM-DD-set date

Timedatectl set-time HH:MM:SS-set time

Modify the name of the network card of CentOS 7

The first step is to modify the eth0 file information

Mv ifcfg-eno16777736 ifcfg-eth0

Vi / etc/udev/rules.d/70-persistent-ipoib.rules

Add a line of information about eth0 to register.

ACTION== "add", SUBSYSTEM== "net", DRIVERS== "? *", ATTR {type} = = "1", ATTR {address} = = "00:0C:29:97:E4:F2", NAME= "eth0"

Step 2 modify grub configuration information

Enter the following command to enter the corresponding directory to edit the file

Vim / etc/sysconfig/grub

Then add "net.ifnames=0 biosdevname=0" to the file as shown in the following figure

Grub2-mkconfig-o / boot/grub2/grub.cfg

The effect is as follows

Then check the name of the network card after rebooting the system

= = so far the basic environment prepared for LAMP has been completed. It is recommended that the server be restarted.

Apache configuration

Yum-y install httpd / / installation

Systemctl start httpd.service / / enable apache service

Systemctl enable httpd.service / / set boot up

Enter the ip address ifconfig in the browser if you can see test 123. The words indicate success.

PHP configuration

Yum-y install php / / installation

Systemctl restart httpd.service / / restart the Apache service

Vi / var/www/html/info.php / / Edit a file to test and take a look at your own version of PHP installed

After saving and exiting, log in to the browser and type ip/info.php again. If you can see the PHP version information, it will be successful.

Link PHP and MySQL or it will show in the installation interface that the link database type is SQLit3 because you have made an error to record yum-y install php-mysql.

Yum-y groupinstall "Development Tools"Development Libraries"

Install commonly used PHP associated modules

Yum-y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel

Restarting the Apache service and PHP service LAMP environment is complete

Zabbix building

The zabbix server is carried out on the MySQL server

Tar-zxvf zabbix-2.4.2.tar.gz

Cd zabbix-2.4.2

/ configure-- with-mysql=/home/mysql/mysql/bin/mysql_config-- with-net-snmp-- with-libcurl-- enable-server-- enable-agent-- enable-proxy-- prefix=/usr/local/zabbix

Errors encountered in the process

The configure: error: MySQL library not found error in the first process is due to the lack of mariadb-devel. The package is installed using yum install mariadb-devel and then re-executed.

If configure: error: Invalid Net-SNMP directory-unable to find net-snmp-config appears in the second process, use yum-y install net-snmp-devel and then rerun

The third kind of error while loading shared libraries:libmysqlclient.so.20 error. You can use the find command to find the location of the libmysqlclient.so.20.

Ln-s / home/mysql/mysql/lib/libmysqlclient.so.20 / usr/lib64

Re-execute

/ configure-- with-mysql=/home/mysql/mysql/bin/mysql_config-- with-net-snmp-- with-libcurl-- enable-server-- enable-agent-- enable-proxy-- prefix=/usr/local/zabbix

Execute the next order without warning

# make

# make install

Copy the relevant configuration files to / etc and make relevant configuration modifications

# mkdir-p / etc/zabbix

# cp-r / soft/zabbix-2.4.2/conf/* / etc/zabbix/

# chown-R zabbix:zabbix / etc/zabbix

# ln-s / usr/local/zabbix/etc / etc/zabbix/

# ln-s / usr/local/zabbix/bin/* / usr/bin/

# ln-s / usr/local/zabbix/sbin/* / usr/sbin/

Modify zabbix_server.conf server

Vi / etc/zabbix/zabbix_server.conf

LogFile=/tmp/zabbix_server.log / / Log File address

DBHost=localhost / / database host

DBName=zabbix / / Database name

DBUser=zabbix / / database user name

DBPassword=zabbix / / database password

ListenIP=xxx / / Database IP address

AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts / / zabbix run script storage directory

Modify zabbix_agentd.conf client

Vi / etc/zabbix/zabbix_agentd.conf

PidFile=/tmp/zabbix_agentd.pid / / process PID

LogFile=/tmp/zabbix_agentd.log / / Log location

EnableRemoteCommands=1 / / allows remote commands to be executed

Ip native ip on Server=xxx / / agent

ServerActive=xxx

Hostname=Zabbix server / / must be the same as the hostname created by zabbix

Include=/usr/local/etc/zabbix_agentd.conf.d/

UnsafeUserParameters=1 / / launch a custom key

Modify PHP related parameters

Vi / etc/php.ini

Max_execution_time = 300

Max_input_time = 300

Memory_limit = 128m

Upload_max_filesize = 2m

Date.timezone = Asia/Shanghai

Post_max_size = 28m

Configure the web site

# cd zabbix-2.4.2/

# cp-r frontends/php / var/www/html/zabbix

Modify the parameters of httpd.conf

Vi / etc/httpd/conf/httpd.conf

DirectoryIndex index.html index.php

Create zabbix-related groups and libraries and users

Groupadd zabbix / / create a group

Useradd-r-g zabbix zabbix / / create a user

Mysql-uroot-p

Mysql > create database zabbix character set utf8

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

Mysql > flush privileges

Mysql > use zabbix; / / Import database resources

Mysql > source / soft/zabbix-2.4.2/database/mysql/schema.sql

Mysql > source / soft/zabbix-2.4.2/database/mysql/data.sql

Mysql > source / soft/zabbix-2.4.2/database/mysql/p_w_picpaths.sql

Mysql > quit

Install the web interface

# systemctl restart httpd.service

Enter the http://ip address / zabbix in the browser to enter the web configuration page of zabbix all the way next may encounter the lack of PHP dependent package to find the rpm package to download and install.

The default account of Zabbix is Admin and the password is zabbix.

For problems encountered, please check the zabbix server log.

Orabbix building

The orabbix plug-in is carried out on zabbix server

Download the orabbix plug-in version is orabbix-1.2.3.zip

Install the Java environment

After creating a new orabbix folder in the opt directory, mv the unzipped files or unextracted zip files to / opt/orabbix

Chmod + x orabbix/-R

Chmod + x run.sh

Copy the execution file in orabbix to the system service directory

Cp / opt/orabbix/init.d/orabbix/etc/init.d/orabbix

Cp/opt/orabbix/conf/config.props.sample / opt/orabbix/conf/config.props

Edit the config.props file you just generated

Vi config.props

ZabbixServerList=ZabbixServer1

ZabbixServer1.Address=zabbix server-side ip address

The ZabbixServer1.Port=10051 / / port number is with ZabbixServer connection Port.

# ZabbixServer2.Address=IP_ADDRESS_OF_ZABBIX_SERVER

# ZabbixServer2.Port=PORT_OF_ZABBIX_SERVER

Log out lines that do not need to exist with #.

# pidFile

OrabbixDaemon.PidFile=./logs/orabbix.pid

# frequency of item's refresh

OrabbixDaemon.Sleep=300

# MaxThreadNumber should be > = than the number of your databases

OrabbixDaemon.MaxThreadNumber=100

# put here your databases in a comma separated list

DatabaseList=Monitor

# Configuration of Connection pool

# if not specified Orabbis is going to use default values (hardcoded)

# Maximum number of active connection inside pool

DatabaseList.MaxActive=10

# The maximum number of milliseconds that the pool will wait

# (when there are no available connections) for a connection to be returned

# before throwing an exception, or 'resolve.xml',description = >' resolve acl', principal = > 'ZABBIX', is_grant = > true, privilege = >' resolve')

Exec dbms_network_acl_admin.assign_acl (acl= > 'resolve.xml', host = >' *')

Commit

Add the Orabbix service to boot with the system

Chkconfig-add orabbix

Chkconfig-level 345orabbix on

There is also a headache to report a mistake.

[root@zabbix orabbix] # / etc/init.d/orabbix start

Cat: / opt/orabbix/conf/config.props: No such file ordirectory

Starting Orabbix service:

[root@zabbix orabbix] # Stopping

Java.lang.Exception: ERROR on main-Connections is empty

Atcom.smartmarmot.orabbix.Orabbixmon.run (Orabbixmon.java:101)

Atcom.smartmarmot.orabbix.bootstrap.main (bootstrap.java:50)

[root@zabbix orabbix] #. / run.sh

[root@zabbix orabbix] # Stopping

Java.lang.Exception: ERROR on main-Connections is empty

Atcom.smartmarmot.orabbix.Orabbixmon.run (Orabbixmon.java:101)

At com.smartmarmot.orabbix.bootstrap.main (bootstrap.java:50).

Configuration of orabbix in web interface

The monitoring template imported into ORACLE can be placed locally by using the upload / download tool in the template of the orabbix directory and then select Import. Then the rest of the interface, such as texting or Wechat or email warning, wrote that the governor's second pulse would be blocked for a long time. Take a break.

=

Extended LAMP=Linux+Apache+MysQL+PHP

Every time you build it, you will encounter the problem of is not running.

When adding an Oracle host to Zabbix, you must use the name set here, Monitor, or it cannot be monitored. Both xxx and pink overlay in the document refer to instance commands

The red mark is the part that needs to be implemented.

Building zabbix 2.4will more or less encounter some problems. Mining the new version of CentOS 6.7 + zabbix 3.0 has been successfully implemented. There is time to update the blog later.

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