Monitoring Cron jobs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
inas.labib
Posts: 170
Joined: Tue Sep 11, 2012 3:48 am

Monitoring Cron jobs

Post by inas.labib »

Hi Team,

We are using nagios 5.2.2

I would like to know how can we monitor cron jobs ran by oracle user in a particular time interval like between 8am and 11am. I believe this can be done with exit code results. i would like to know how this can be achieved and is there any plugin available.

Your suggestions would be helpful
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Monitoring Cron jobs

Post by npolovenko »

Hello, @inas.labib. Looks like someone wrote a plugin for that:

Code: Select all

https://github.com/bbuchalter/check_exit_code
And here's the manual on how to set it up:

Code: Select all

https://arkit.co.in/monitor-cronjob-execution-status-using-nagios/
between 8am and 11am
This is more than 24 hours. Did you mean to say 11 pm? Either way, consider creating a custom time period for this check:
Untitled.png
Untitled1.png
Now, as far as filtering out
cron jobs ran by oracle user
Consider this example:

Code: Select all

2>&1 > /var/log/cronjobname.log; echo "Exit code: $?" >> /var/log/cronjobname.log
You'd open the crontab and find all the crons that are supposed to be run by the oracle user. Then you change:

Code: Select all

>> /var/log/cronjobname.log
To some other file that is going to be dedicated to the Oracle entries:

Code: Select all

>> /var/log/oracleentries.log
Also, add:
echo "Exit code: $?"
To the each oracle cron.

Finally, run the plugin with:

Code: Select all

-f /var/log/oracleentries.log
That should do it.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked