Ad Widget

Collapse

Troubleshoot UserParameter Oracle Linux 5.11

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • edisonguerra
    Junior Member
    • Feb 2021
    • 4

    #1

    Troubleshoot UserParameter Oracle Linux 5.11

    Hello,

    I believe I need some help to find out out to troubleshoot a UserParameter of mine.

    While I don't actually need to monitor the contents of this Oracle Database, I do need to monitor it's instance status, directories and file sizes.

    I never had any issue using these UserParameters on SLES 11 and Oracle Linux 7.x, but the parameter won't work on Oracle Linux 5.11.

    Forgive my script's crudeness, but it does exactly what I need it to.

    UserParameter=oracle.discovery.instances,if [ ! -d /u01/oracle/oradata ]; then exit 0 ; fi; echo '{#BASE},{#DIAG},{#DBF}' ; find /u01/oracle/oradata -mindepth 1 -maxdepth 1 -type d -name ???????? -exec find {} -mindepth 1 -maxdepth 1 -type f \; |cut -f 5- -d \/ | while read data; do base="`echo $data | cut -f1 -d \/`" ; diag="`echo $data | cut -f1 -d \/ | tr [:upper:] [:lower:]`" ; dbf="`echo $data | cut -f2 -d \/`" ; echo $base,$diag,$dbf; done 2>/dev/null
    UserParameter=oracle.discovery.arch,if [ ! -d /u04/oracle/oradata/ ] ; then exit 0 ; fi ;echo '{#ARCDIR}' ; find /u01/oracle/oradata -mindepth 1 -maxdepth 1 -type d -name ???????? |cut -f 5- -d \/ | while read BASE; do if [ -d /u04/oracle/oradata/$BASE ] ; then echo $BASE ; fi ; done 2> /dev/null

    I have these two parameters for discovery and with them I'll create custom items to monitor the Oracle instance status (process), size of data directories, datafiles and a few other things that I cut from the example.

    I've compiled the Zabbix Agent for this machine from sources, since it's too old to have official packages available:

    [root@ifsdbc03 /]# /opt/zabbix/sbin/zabbix_agentd -V
    zabbix_agentd (daemon) (Zabbix) 5.2.1
    Revision 4d0d532fb0 9 November 2020, compilation time: Nov 25 2020 13:51:40

    Copyright (C) 2020 Zabbix SIA
    License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it according to
    the license. There is NO WARRANTY, to the extent permitted by law.



    1. If I run the zabbix agent as root, I'll get the following output:

    [root@ifsdbc03 ~]# /opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf -t oracle.discovery.instances
    oracle.discovery.instances [t|{#BASE},{#DIAG},{#DBF}
    BUT01HML,but01hml,temp01.dbf
    BUT01HML,but01hml,ifsapp_archive_data.dbf
    BUT01HML,but01hml,ifsapp_report_index.dbf
    BUT01HML,but01hml,users01.dbf
    BUT01HML,but01hml,ifsapp_report_data.dbf
    BUT01HML,but01hml,undotbs01.dbf
    BUT01HML,but01hml,ifsapp_lob.dbf
    BUT01HML,but01hml,ifsapp_index.dbf
    BUT01HML,but01hml,system01.dbf
    BUT01HML,but01hml,sysaux01.dbf
    BUT01HML,but01hml,ifsapp_data.dbf
    BUT01HML,but01hml,ifsapp_data01.dbf
    BUT01HML,but01hml,ifsapp_archive_index.dbf]
    [root@ifsdbc03 ~]#


    2. If I change the shell for the zabbix user and log with it, I'll have a similar output:

    [zabbix@ifsdbc03 ~]$ /opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf -t oracle.discovery.instances
    oracle.discovery.instances [t|{#BASE},{#DIAG},{#DBF}
    BUT01HML,but01hml,temp01.dbf
    BUT01HML,but01hml,ifsapp_archive_data.dbf
    BUT01HML,but01hml,ifsapp_report_index.dbf
    BUT01HML,but01hml,users01.dbf
    BUT01HML,but01hml,ifsapp_report_data.dbf
    BUT01HML,but01hml,undotbs01.dbf
    BUT01HML,but01hml,ifsapp_lob.dbf
    BUT01HML,but01hml,ifsapp_index.dbf
    BUT01HML,but01hml,system01.dbf
    BUT01HML,but01hml,sysaux01.dbf
    BUT01HML,but01hml,ifsapp_data.dbf
    BUT01HML,but01hml,ifsapp_data01.dbf
    BUT01HML,but01hml,ifsapp_archive_index.dbf]


    3. BUT, if I run the request through a standard su command, I'll get nothing but the first print for those values:

    [root@ifsdbc03 /]# su zabbix -c '/opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf -t oracle.discovery.instances'
    oracle.discovery.instances [t|{#BASE},{#DIAG},{#DBF}]
    [root@ifsdbc03 /]#


    4. If I add the "-login" argument to the su command, it'll work just fine:

    [root@ifsdbc03 /]# su - zabbix -c '/opt/zabbix/sbin/zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf -t oracle.discovery.instances'
    oracle.discovery.instances [t|{#BASE},{#DIAG},{#DBF}
    BUT01HML,but01hml,temp01.dbf
    BUT01HML,but01hml,ifsapp_archive_data.dbf
    BUT01HML,but01hml,ifsapp_report_index.dbf
    BUT01HML,but01hml,users01.dbf
    BUT01HML,but01hml,ifsapp_report_data.dbf
    BUT01HML,but01hml,undotbs01.dbf
    BUT01HML,but01hml,ifsapp_lob.dbf
    BUT01HML,but01hml,ifsapp_index.dbf
    BUT01HML,but01hml,system01.dbf
    BUT01HML,but01hml,sysaux01.dbf
    BUT01HML,but01hml,ifsapp_data.dbf
    BUT01HML,but01hml,ifsapp_data01.dbf
    BUT01HML,but01hml,ifsapp_archive_index.dbf]


    When I use the web interface to test the item, I'll get only the first line, the same behavior as the "su zabbix" (3) scenario.

    Could anyone point me what could be different on this machine so I can try and debug this situation?

    The remarkable aspect for me is that these commands used to work on SLES11 and OL 7.x, but not on this version.
    Last edited by edisonguerra; 10-02-2021, 21:31.
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #2
    If your Zabbix Agent is already running, why don't you test your host items by using just this:
    Code:
    zabbix_agentd -t oracle.discovery.instances
    Why add "-c /opt/zabbix/etc/zabbix_agentd.conf"?


    Is that what your script would be like?

    # oracle.discovery.instances
    Code:
    if [ ! -d /u01/oracle/oradata ]; then
        exit 0
    fi
    
    echo '{#BASE},{#DIAG},{#DBF}'
    data=$(find /u01/oracle/oradata -mindepth 1 -maxdepth 1 -type d -name ???????? -exec find {} -mindepth 1 -maxdepth 1 -type f \ | cut -f 5- -d \/)
    #find /u01/oracle/oradata -mindepth 1 -maxdepth 1 -type d -name ???????? -exec find {} -mindepth 1 -maxdepth 1 -type f \; |cut -f 5- -d \/ |
    
    while read data; do
        base="`echo $data | cut -f1 -d \/`"
        diag="`echo $data | cut -f1 -d \/ | tr [:upper:] [:lower:]`"
        dbf="`echo $data | cut -f2 -d \/`"
        echo $base,$diag,$dbf
    done 2>/dev/null
    # oracle.discovery.arch
    Code:
    if [ ! -d /u04/oracle/oradata/ ] ; then
        exit 0
    fi
    
    echo '{#ARCDIR}'
    BASE=$(find /u01/oracle/oradata -mindepth 1 -maxdepth 1 -type d -name ???????? | cut -f 5- -d \/)
    #find /u01/oracle/oradata -mindepth 1 -maxdepth 1 -type d -name ???????? | cut -f 5- -d \/ |
    
    while read BASE; do
        if [ -d /u04/oracle/oradata/$BASE ]; then
            echo $BASE
        fi
    done 2> /dev/null
    Have you tried to add these commands ta a .sh file and execute through UserParameter?

    Comment

    • edisonguerra
      Junior Member
      • Feb 2021
      • 4

      #3
      Thank you so much for your quick response, Markfree.

      Now, answering the questions, I've used the zabbix agent 2 for windows in the past for a while and I always had to specify the configuration file by hand or else it would look for a non-existent configuration file, so I started using that when I must be sure of what I'm running.

      And yeah, that's exactly what the code would be like. Crude, and not so effective as I expected.

      I ended up splitting the parameters in different scripts, so I've added the "#/bin/bash -x" to the script's header to increase the output, causing errors in the web interface, but that showed exactly what was wrong.

      It seems that the older EL 5.11 have a /tftpboot directory, and that matched exactly my 8 character string filter.

      When running as a service, the zabbix instance ignores their home directory, running straight at the /. So whenever I ran the parameter, it would use the find command looking for ftfpboot directories on all directories in it's search path.

      I just needed to add double quotes to the search string ("????????") for the name and it was all fixed.

      Problem solved.

      Thanks again.

      Comment

      Working...