sergiotocalini / zabora

Zabbix Agent - Oracle
GNU General Public License v3.0
38 stars 37 forks source link

Problem to use Zabora Plugin - ZBX_NOTSUPPORTED #8

Closed igorxingu closed 3 years ago

igorxingu commented 3 years ago

Hello Sergio, I installed Zabora plugin but I have problem. Version: Zabbix 4.0.4 Linux Version: CentOS Linux release 7.6.

Deploy: ./deploy_zabbix.sh -u "${xxxxxx}" -p "${xxxxxxx}" -o "${xxxxx}" ls -l /etc/zabbix/scripts/agentd/zabora/ sql
zabora.conf
zabora.oraenv
zabora.sh

sql: db_active.sql db_fra.sql db_metric.sql db_uptime.sql template db_block.sql db_invalid.sql db_redo.sql db_version.sql db_connection.sql db_jobs.sql db_rman.sql tb_list.sql db_filesize.sql db_lock.sql db_size.sql tb_size.sql

zabora.conf : ORACLE_USER="xxxxxx" ORACLE_PASS="xxxxxxx" ORACLE_SID="xxxxxx"

zabora.oraenv : ORACLE_SID=xxxxx ORACLE_VER=xxxxx ORACLE_HOME=/xxx/xxx/xxxx/xxxx/xxxx/client_1 ORACLE_BASE=/xxxxx/xxx/xxxx/xxxxx ORACLE_TERM=xterm PATH=/usr/bin:/usr/sbin/:$ORACLE_HOME/bin

NLS_LANG=AMERICAN_AMERICA.UTF8

export ORACLE_SID ORACLE_HOME ORACLE_BASE ORACLE_TERM PATH

/etc/zabbix/zabbix_agentd.d/ userparameter_mysql.conf
zabora.conf

zabora.conf: UserParameter=zabora[],/etc/zabbix/scripts/agentd/zabora/zabora.sh -o $1 -s $2 -a $3 UserParameter=zabora.discovery[],/etc/zabbix/scripts/agentd/zabora/zabora.sh -o $1 -s $2 -a $3 -j $4 UserParameter=zabora.version,/etc/zabbix/scripts/agentd/zabora/zabora.sh -v short

sh /etc/zabbix/scripts/agentd/zabora/zabora.sh -o $1 -s $2 -a $3 ZBX_NOTSUPPORTED

sh /etc/zabbix/scripts/agentd/zabora/zabora.sh -o $1 -s $2 -a $3 -j $4 ZBX_NOTSUPPORTED

sh /etc/zabbix/scripts/agentd/zabora/zabora.sh -v short zabora 1.5.4

zabbix_agentd -t oracle[version] oracle[version] [m|ZBX_NOTSUPPORTED] [Unsupported item key.]

zabbix_get -s 192.168.10.100 -p 10050 -k zabora ZBX_NOTSUPPORTED

Can you help me or have any idea to solve this problem? Igor

sergiotocalini commented 3 years ago

Hi @igorxingu,

The installation is correct, you have two options to use the script. The first (old one) is using zabora.oraenv file, for this you need to specify all the oracle environment variables on that file. The other option is to use oratab with the command oraenv, so you need to be sure that you oracle installation is properly configure on the oratab. I strongly recommend to use oratab, this is the standard way and you can ensure your installation is properly setup.

On the other hand the ZBX_NOTSUPPORTED is normal because you are not passing any parameter so the script is returning this error. You can test if the script is running properly with the following command:

~# ksh /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${ORACLE_SID}" -s db_version -a 1

It should return the oracle version. Please replace the variable ORACLE_SID with your SID.

Regards, Sergio

igorxingu commented 3 years ago

Hey @sergiotocalini , thanks for answer!!!! 💯 💯 💯 So, I´ll configure the plugin to use oratab.

About this command. When I run this command, I don´t have any answer. ksh /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${xxxxx}" -s db_version -a 1

I have in this machine a Oracle Server Database 11g (11.2.0.4) working perfectly!

Abouth my oratab: more /etc/oratba xxxxx:/xxxxxx/xxx/xxxxx/product/11.2.0.4/dbhome_1:Y

Thanks for your help. 👍 👍 👍

sergiotocalini commented 3 years ago

@igorxingu

Ensure that the zabora.oraenv file doesn't exist if you are using the oratab. Also please execute the script with the following flag and show me the output:

~# ksh -x /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${ORACLE_SID}" -s db_version -a 1

Best, Sergio

igorxingu commented 3 years ago

Hello Sergio.

[root@xxx zabora]# ksh -x /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${xxxx}" -s db_version -a 1

After the command says that its did not locate ORACLE_HOME, I configured inside the zabora.sh file as you can see bellow, but I have the same problema.

!/usr/bin/env ksh

rcode=0 PATH=/usr/local/bin:${PATH} ################################################################################# export ORACLE_HOJE=/xxx/xxx/oracleclient/product/11.2.0/client_1 ################################################################################# ......

[root@xxx ~]# ksh -x /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${xxxx}" -s db_version -a 1

[root@xxx zabora]# ksh /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${xxxx}" -s db_version -a 1 Cannot locate ORACLE_HOME.

Thanks.

sergiotocalini commented 3 years ago

@igorxingu It seems to be an issue with your oratab configuration. You don't need to specify the ORACLE_HOME env variable if you are using oraenv command. Just to double check your oratab file has different location:

Abouth my oratab:
more /etc/oratba
xxxxx:/xxxxxx/xxx/xxxxx/product/11.2.0.4/dbhome_1:Y

So probably there is a path missconfiguration. Double check this and ensure that if you run the following command it works as expected:

~# . /usr/local/bin/oraenv

If you need more information about oraenv please check this article: http://www.dba-oracle.com/t_linux_oratab.htm

igorxingu commented 3 years ago

Ok, I understood. I have in this machine one oracle database server and one oracle client because I have an application thats needs to use this oracle client. As you can see bellow, all connection in my oracle database are fine/working! I´ll check with our dba for help.

[root@xxx zabora]# /usr/local/bin/oraenv ORACLE_SID = [root] ? xxxx The Oracle base has been set to /xxx/xxx/oracle/product

Using Oracle Client path to access the database instance: [root@xxx bin]# pwd /xxx/xxx/oracleclient/product/11.2.0/client_1/bin

[root@xxx bin]# export ORACLE_HOME=/xxx/xxx/oracleclient/product/11.2.0/client_1 [root@xxx bin]# ./sqlplus zabbix_monitor/pass@instance_name SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 3 16:38:17 2020 Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

Using Oracle Server path to access the database instance: [root@xxx dbhome_1]# pwd /xxx/xxx/oracle/product/11.2.0.4/dbhome_1

[root@xxx bin]# ./sqlplus zabbix_monitor/pass@instance_name SQL*Plus: Release 11.2.0.4.0 Production on Thu Dec 3 16:43:13 2020 Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>

Thanks a loto for your answer @sergiotocalini ...

igorxingu commented 3 years ago

One more question @sergiotocalini , in your zabora template, there is:

zabora.discovery[{$ORACLE_SID},tb_list,1,ORACLE_TBS] image

image

In my zabbix server log I have this error:

19201:20201203:192802.313 item "vm-xxx:zabora[{$ORACLE_SID},tb_size,ERROR:]" became not supported: Value "ERROR: ORA-12547: TNS:lost contact" of type "string" is not suitable for value type "Numeric (float)"

What is ORACLE_TBS?

sergiotocalini commented 3 years ago

Hey @igorxingu This is a tablespace discovery script, it seems that is not working. Probably there is a permission issue with your user on the oracle db. Please test the script if it is returning the right output:

~# ksh /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${ORACLE_SID}" -s tb_list -a 1 -j ORACLE_TBS

Best, Sergio

igorxingu commented 3 years ago

Hello Sergio, I find here in the oracle server that I can only run this command is with the user database. I can´t run this comand with root user.

[userdb@xxxx ~]$ /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${ORACLE_SID}" -s tb_list -a 1 -j ORACLE_TBS { "data":[ { "{#ORACLE_TBS}":"SYSTEM" }, { "{#ORACLE_TBS}":"SYSAUX" }, { "{#ORACLE_TBS}":"USERS" }, { "{#ORACLE_TBS}":"OW_ADMIN_UTILS" }, { "{#ORACLE_TBS}":"OWSYS" }, { "{#ORACLE_TBS}":"XXX_XXX_XXX" }, { "{#ORACLE_TBS}":"XXXXX_XXX" } ] } [userdb@xxxx ~]$ echo $SHELL /bin/csh

Even though I'm as root user and try to run with ksh at the beginning of the command, it doesn't work.

[userdb@xxxx ~]$ /etc/zabbix/scripts/agentd/zabora/zabora.sh -o $1 -s $2 -a $3 -j $4 Cannot locate ORACLE_HOME.

[userdb@xxxx ~]$ ksh /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${ORACLE_SID}" -s db_version -a 1 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

as root user: [root@xxxx ~]# /etc/zabbix/scripts/agentd/zabora/zabora.sh -o "${ORACLE_SID}" -s db_version -a 1 Cannot locate ORACLE_HOME.

sergiotocalini commented 3 years ago

Hi @igorxingu ,

You need to be part of the group dba and all the oracle groups to run sqlplus and oraenv commands. Usually adding the zabbix user to those groups should work ;)

Regards, Sergio