Page 1 of 1
Compare check_mssql result with today date
Posted: Tue Feb 20, 2018 6:07 am
by vusaravi
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.
Re: Compare check_mssql result with today date
Posted: Tue Feb 20, 2018 9:51 am
by mcapra
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".
Re: Compare check_mssql result with today date
Posted: Tue Feb 20, 2018 5:18 pm
by tmcdonald
Thanks for the assist,
@mcapra!
Re: Compare check_mssql result with today date
Posted: Wed Feb 21, 2018 12:32 am
by vusaravi
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:
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'
You may close this ticket.
Re: Compare check_mssql result with today date
Posted: Wed Feb 21, 2018 5:00 pm
by kyang
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!