Hi
We are using check_mssql plugin to monitor some db checks.
We have a new requirement to compare the result of the query with today's date.
Need some help in achieving the same.
Thanks in Advance.
Compare check_mssql result with today date
Re: Compare check_mssql result with today date
So you want to check a query's result against the current date?
Is there anything stopping you from doing that in the query itself?
https://stackoverflow.com/questions/103 ... odays-date
Then you could just have the query return 0 or something if the date is "correct" and use the --regex arg of check_mssql to match "0".
Is there anything stopping you from doing that in the query itself?
https://stackoverflow.com/questions/103 ... odays-date
Then you could just have the query return 0 or something if the date is "correct" and use the --regex arg of check_mssql to match "0".
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Compare check_mssql result with today date
Thanks for the assist, @mcapra!
Former Nagios employee
Re: Compare check_mssql result with today date
Hi @mcapra
Thanks for your response.
My actual requirement is, my query will return response in data format (1 row) and now i want to compare the date with check_mssql whether it is today's date or not.
Finally i have modified the queries by using case and it is resolved.
Actual query:
Modified Query:
You may close this ticket.
Thanks for your response.
My actual requirement is, my query will return response in data format (1 row) and now i want to compare the date with check_mssql whether it is today's date or not.
Finally i have modified the queries by using case and it is resolved.
Actual query:
Code: Select all
SELECT LAST_RUN_DATE from CRC
Code: Select all
SELECT (CASE WHEN CAST(LAST_RUN_DATE AS DATE) = CAST(GETDATE() AS DATE) THEN 'SUCCESS' ELSE 'FAILED' END) AS NBWIP_REPORT_STATUS
FROM CRC
WHERE REPORT_CODE = 'NBWIPB'
Re: Compare check_mssql result with today date
Sounds good! I'll be closing this thread!
If you have any more questions, feel free to create another thread.
Thanks for using the Nagios Support Forum!
If you have any more questions, feel free to create another thread.
Thanks for using the Nagios Support Forum!