Hey all, I'm running the latest version of Nagios XI 5.3.0. I want to run an Oracle Query to return a specific value (1 or 0). I've used the Configuration wizard to go through and setup the oracle db info along with SID, username, password, and query. the query I'm running is below. The problem I'm running into is nagios add's a --warning <value> --critical <value> at the end of the query. I would like to see nagios alarm on if the value returned is "1"....
check_xi_oraclequery!--connect '<servername>:1521/<instance name>' --username '<username>' --password '<password>' --mode sql --name="SELECT count(*) FROM <table name>.ETL_RUN_INFO WHERE STATUS ='RUNNING' AND ETL_NO = ( SELECT MAX(ETL_NO) FROM <table name>.ETL_RUN_INFO )" --critical 1
Maybe I'm not running the proper monitoring plugin (if anyone has any ideas on what I could use for this that'd be great) I did see this one (https://labs.consol.de/nagios/check_oracle_health/) but I wanted to try the integrated sql query first before I tried installing another plugin.
thanks for your help!
Oracle Query
Re: Oracle Query
Sorry I pulled that query directly from the "configure Service" area: here's the original query:
SELECT count(*) FROM <table name>.ETL_RUN_INFO WHERE STATUS ='RUNNING' AND ETL_NO = ( SELECT MAX(ETL_NO) FROM <table name>.ETL_RUN_INFO )
SELECT count(*) FROM <table name>.ETL_RUN_INFO WHERE STATUS ='RUNNING' AND ETL_NO = ( SELECT MAX(ETL_NO) FROM <table name>.ETL_RUN_INFO )
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Oracle Query
This plugin uses the development guidelines:
https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT
Try:
https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT
Try:
Code: Select all
--critical @1As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Oracle Query
so here's my query now . check_xi_oraclequery!--connect '<server name:1521/instance name>' --username <username> --password <password> --mode sql --name="SELECT count(*) FROM <table name>.ETL_RUN_INFO WHERE STATUS ='RUNNING' AND ETL_NO = ( SELECT MAX(ETL_NO) FROM <table name>.ETL_RUN_INFO )" --critical @1
the query and that critical value is working!!!! thank you!!
One last question. is there anyway I can set this to ONLY run once a day? the DBA only wants the check done at 8am every morning. I see in the core config manager I can set it to only monitor every <#> minutes. would I just put it to <1440> min indicating every 24 hours? just not sure how to set it to only run at 8am daily.
thanks for you help!!
the query and that critical value is working!!!! thank you!!
One last question. is there anyway I can set this to ONLY run once a day? the DBA only wants the check done at 8am every morning. I see in the core config manager I can set it to only monitor every <#> minutes. would I just put it to <1440> min indicating every 24 hours? just not sure how to set it to only run at 8am daily.
thanks for you help!!
Re: Oracle Query
There are two routes you could go.Chite wrote:so here's my query now . check_xi_oraclequery!--connect '<server name:1521/instance name>' --username <username> --password <password> --mode sql --name="SELECT count(*) FROM <table name>.ETL_RUN_INFO WHERE STATUS ='RUNNING' AND ETL_NO = ( SELECT MAX(ETL_NO) FROM <table name>.ETL_RUN_INFO )" --critical @1
the query and that critical value is working!!!! thank you!!
One last question. is there anyway I can set this to ONLY run once a day? the DBA only wants the check done at 8am every morning. I see in the core config manager I can set it to only monitor every <#> minutes. would I just put it to <1440> min indicating every 24 hours? just not sure how to set it to only run at 8am daily.
thanks for you help!!
A. Set the check to run every 1440. (this would not explicitly specify at 8AM though)
B. Set the check to run every x minutes, and assign a specific time period to the check_period (that is between say 7:58 and 8:02). This would cause it to get scheduled within that time span.
Former Nagios Employee
Re: Oracle Query
yeah that's a great idea to set a check_period. the only question I have is, do I have to add a check_period called timeperiod_8am or something like that, and set the value 7:58 - 8:02 to it? I've never done that before, where do I create that?
thanks, sorry for all the questions but this has been very helpful!
Chaden
thanks, sorry for all the questions but this has been very helpful!
Chaden
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Oracle Query
Yes, create a timeperiod with the time when you want to be allowed to run.
CCM > Alerting > Time Periods
Add
Give it a name and Description
Add each of these definitions:
sunday 07:58-08:02
monday 07:58-08:02
tuesday 07:58-08:02
wednesday 07:58-08:02
thursday 07:58-08:02
friday 07:58-08:02
saturday 07:58-08:02
Save
Now go to the service and on the Check Settings tab select the time period in the "Check Period" drop down list
Save and apply config
CCM > Alerting > Time Periods
Add
Give it a name and Description
Add each of these definitions:
sunday 07:58-08:02
monday 07:58-08:02
tuesday 07:58-08:02
wednesday 07:58-08:02
thursday 07:58-08:02
friday 07:58-08:02
saturday 07:58-08:02
Save
Now go to the service and on the Check Settings tab select the time period in the "Check Period" drop down list
Save and apply config
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Oracle Query
Awesome! Anything else we can help with? Or is it okay to close this?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.