Back to Home

Installing DBforBix for Zabbix under Debian

Zabbix · DBforBix

Installing DBforBix for Zabbix under Debian

Greetings!
Recently interested in monitoring Oracle at Zabbix. A little google found several options to complete the task and, after a bit of reading, decided to stop at DBforBix. But there were some minor difficulties with this demon. In the official wiki , instructions for RHEL are available, and the init package attached is filed under RHEL. For me, this became a small problem, because my Zabbix is ​​spinning on Debian. In this connection, I had to redo the code a bit. Maybe this is useful to someone.

1. Initial installation

1. First you need to download the package itself from the official website or from sourceforge .
2. After unpack and transfer the contents of the archive to a folder /opt/dbforbix/.
3. Next, copy the file /opt/dbforbix/init.d/dbforbixto /etc/init.d/dbforbix.
4. We give execute rights to /etc/init.d/dbforbixand /opt/dbforbix/run.sh.
5. Rename the file /opt/dbforbix/conf/config.props.sampleto /opt/dbforbix/conf/config.propsand /opt/dbforbix/conf/oraclequery.props.sampleto /opt/dbforbix/conf/oraclequery.props
6. We throw the necessary libraries into the folder /opt/dbforbix/lib/. In our case, we are interested in the ojdbc6.jar library . (You can download all the libraries here )

This ends the instruction and now you need to fix a couple of files for the daemon to work properly in Debian.

2. Editing /etc/init.d/dbforbix

1. At the beginning of the file, insert something like this:
### 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. Comment on the line /etc/rc.d/init.d/functionsand write below:
/lib/lsb/init-functions

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

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


3. Editing /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 apply only to the Oracle database):
ZabbixServerList=ZabbixServer1- description of Zabbix servers
ZabbixServer1.Address=10.10.10.10- Zabbix server
ZabbixServer1.Port=10051- port of the Zabbix server
DatabaseList=ORACLEDB1- description of the connected databases
ORACLEDB1.Url=jdbc:oracle:thin:@10.10.10.11:1521:name_of_sid- setting up the connection to the database
ORACLEDB1.User=ZABBIX- user (which we will specify later)
ORACLEDB1.Password=ZABBIX- password (which we will indicate later)
ORACLEDB1.DatabaseType=oracle- database type

In general, everything is clear. The only thing that interested me was the line
#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 file dbforbix.pidin the directory /opt/dbforbix/logs/.

4. Script for Oracle

The official wiki contains a script that works fine in Oracle version 10, for 11 - small changes are required according to the wiki.
 CREATE USER ZABBIX
  IDENTIFIED BY 
  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 must match the name specified in the line DatabaseListin 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. Launch DBforBix
/etc/init.d/dbforbix start


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

Read Next