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.
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.
Comment