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
sql query returning critical value, nagios still thinks OK
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: sql query returning critical value, nagios still thinks
This critical threshold will only be critical if result is OVER 0 not == 0, change to
https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT
Also, the following is the automatically generated performance data that will be used to create performance graphs
Code: Select all
--critical 0:Also, the following is the automatically generated performance data that will be used to create performance graphs
Code: Select all
0 | 'select'=0;1;0Re: sql query returning critical value, nagios still thinks
Thank you. yes that makes more sense. the query was coming back with a value of 0 so I had to change the critical value to -1 to actually get the critical status in Nagios.
thanks your your help
Chaden
thanks your your help
Chaden
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: sql query returning critical value, nagios still thinks
Glad to be of assistance!