sql query returning critical value, nagios still thinks OK
Posted: Tue Aug 22, 2017 12:01 pm
Ok, I'm seriously so close to getting this resolved but I must be doing something wrong. I'm running the following oracle query and the query is returning the value of 0. if I run the same query below in Oracle SQL Developer it returns the value of 0. I'm taking that query value and plugging it into the critical value at the end but yet it still comes back and says it's OK.... and I don't understand what the 'select'=0;1;0 is at the end. is that the 0;1;5 minute values that Nagios does it's checks on?
thanks for your help!
query:
[root@nagios libexec]# ./check_oracle_health --connect 'servername:port#/sid' --username '<username>' --password '<password>' --mode sql --name "SELECT case when end_date is null then 1 else 0 end RETVAL FROM SNP_LPI_RUN a,SNP_LP_INST b WHERE a.i_lp_inst = b.i_lp_inst and load_plan_name like 'Extract eBSO, Transform, Load DW Minimal%' and TO_CHAR(start_date, 'DD-MON-YYYY HH24:MI:SS') in (select max(TO_CHAR(start_date, 'DD-MON-YYYY HH24:MI:SS')) FROM SNP_LPI_RUN a,SNP_LP_INST b where a.i_lp_inst = b.i_lp_inst and load_plan_name like 'Extract eBSO, Transform, Load DW Minimal%')" --critical 0
OK - select case when end_date is null then 1 else 0 end retval from snp_lpi_run a,snp_lp_inst b where a.i_lp_inst = b.i_lp_inst and load_plan_name like 'extract ebso, transform, load dw minimal%' and to_char(start_date, 'dd-mon-yyyy hh24:mi:ss') in (select max(to_char(start_date, 'dd-mon-yyyy hh24:mi:ss')) from snp_lpi_run a,snp_lp_inst b where a.i_lp_inst = b.i_lp_inst and load_plan_name like 'extract ebso, transform, load dw minimal%'): 0 | 'select'=0;1;0
thanks for your help!
query:
[root@nagios libexec]# ./check_oracle_health --connect 'servername:port#/sid' --username '<username>' --password '<password>' --mode sql --name "SELECT case when end_date is null then 1 else 0 end RETVAL FROM SNP_LPI_RUN a,SNP_LP_INST b WHERE a.i_lp_inst = b.i_lp_inst and load_plan_name like 'Extract eBSO, Transform, Load DW Minimal%' and TO_CHAR(start_date, 'DD-MON-YYYY HH24:MI:SS') in (select max(TO_CHAR(start_date, 'DD-MON-YYYY HH24:MI:SS')) FROM SNP_LPI_RUN a,SNP_LP_INST b where a.i_lp_inst = b.i_lp_inst and load_plan_name like 'Extract eBSO, Transform, Load DW Minimal%')" --critical 0
OK - select case when end_date is null then 1 else 0 end retval from snp_lpi_run a,snp_lp_inst b where a.i_lp_inst = b.i_lp_inst and load_plan_name like 'extract ebso, transform, load dw minimal%' and to_char(start_date, 'dd-mon-yyyy hh24:mi:ss') in (select max(to_char(start_date, 'dd-mon-yyyy hh24:mi:ss')) from snp_lpi_run a,snp_lp_inst b where a.i_lp_inst = b.i_lp_inst and load_plan_name like 'extract ebso, transform, load dw minimal%'): 0 | 'select'=0;1;0