📜 ⬆️ ⬇️

Installing DBforBix for Zabbix under Debian

Greetings
Recently I became interested in monitoring Oracle in Zabbix. A little googling I found several options to accomplish the task and, after reading a little, I decided to stop at DBforBix. But with this demon there were some minor difficulties, because In the official wiki , instructions are available for RHEL, and even the attached init file is sharpened for RHEL. For me it became a small problem, because my Zabbix is ​​spinning on Debian. In this connection, I had to alter the code a little. Maybe it will be useful to someone.

1. Initial installation

1. First you need to download the package itself from the official website or sourceforge .
2. After unpacking and transferring the contents of the archive to the /opt/dbforbix/ folder.
3. Next, copy the file /opt/dbforbix/init.d/dbforbix to /etc/init.d/dbforbix.
4. We /opt/dbforbix/run.sh execution rights for /etc/init.d/dbforbix and /opt/dbforbix/run.sh .
5. Rename the /opt/dbforbix/conf/config.props.sample file to /opt/dbforbix/conf/config.props and /opt/dbforbix/conf/oraclequery.props.sample to /opt/dbforbix/conf/oraclequery.props
6. We throw the necessary libraries into the /opt/dbforbix/lib/ folder. In our case, we are interested in the library ojdbc6.jar . (Download all libraries here )

This is where the instruction ends and now you need to tweak a couple of files for the normal operation of the daemon in Debian.

2. Edit /etc/init.d/dbforbix

1. Insert something like this into the beginning of the file:
 ### BEGIN INIT INFO # Provides: dbforbix # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: dbforbix ### END INIT INFO 

2. Commenting on the line /etc/rc.d/init.d/functions and writing down below:
 /lib/lsb/init-functions 

3. Check the interface activity in RHEL:
 # Get config. . /etc/sysconfig/network # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 

Change the data lines to:
 state=`/sbin/ip link | awk '/eth0/{print $9}'` [ "${STATE}" = "DOWN" ] && exit 0 

')
3. Edit /opt/dbforbix/conf/config.props

Everything is simple here, we change all the parameters according to the instructions and comments (in my case, the settings concern only the Oracle database):
ZabbixServerList=ZabbixServer1 - description of Zabbix servers
ZabbixServer1.Address=10.10.10.10 - Zabbix server
ZabbixServer1.Port=10051 - Zabbix server port
DatabaseList=ORACLEDB1 - description of connected databases
ORACLEDB1.Url=jdbc:oracle:thin:@10.10.10.11:1521:name_of_sid - setting the connection to the database
ORACLEDB1.User=ZABBIX - user (which we indicate below)
ORACLEDB1.Password=ZABBIX - password (which we indicate below)
ORACLEDB1.DatabaseType=oracle - database type

In general, everything is clear. The only thing that interested me is the string
 #pidFile DBforBIX.PidFile=./logs/orabbix.pid 

Why orabbix I did not understand, but rewrote to
 #pidFile DBforBIX.PidFile=./logs/dbforbix.pid 

because In init.d, everything refers to this file, and accordingly created the dbforbix.pid file in the /opt/dbforbix/logs/ directory.

4. Script for Oracle

In the official wiki is a script that works fine in Oracle 10 version, for 11 - according to the wiki, minor changes are required.
  CREATE USER ZABBIX IDENTIFIED BY <REPLACE WITH PASSWORD> DEFAULT TABLESPACE SYSTEM TEMPORARY TABLESPACE TEMP PROFILE DEFAULT ACCOUNT UNLOCK; -– 2 Roles for ZABBIX GRANT CONNECT TO ZABBIX; GRANT RESOURCE TO ZABBIX; ALTER USER ZABBIX DEFAULT ROLE ALL; –- 5 System Privileges for ZABBIX 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; 


Running DBforBix

Before starting, you must perform the following steps:
1. Import a template for Oracle in Zabbix, located here: /opt/dbforbix/template/template_oracle.xml
2. In Zabbix, create a host whose name should match the name specified in the DatabaseList line in the config.props file. In my case, the host name will be ORACLEDB1.
3. Activate the init.d script with the command:
 insserv dbforbix 

4. Run DBforBix
 /etc/init.d/dbforbix start 


That's probably all. The only thing the daemon requires is sun-java6-jre for its work, to install it on Debian 7, we had to register old repositories and install the package from there.

Source: https://habr.com/ru/post/197746/


All Articles