Everyone has their own layout and content preferences for cron files. These are some basic elements I usually include in root's crontab.
1) PATH statement at the top to help setup the environment. Even though this is root's crontab, cron entries don't run with the same environment setup for user root. Having the PATH statement in the cron file means I can shorten some of my entries. I think it looks cleaner.
2) A monthly job to gather system information. The script run by this job gathers key system information and various configuration files. The output of the script is sent to a central server where all server configurations are stored. The gathered data is a safety net in case a server needs to be rebuilt or I just need to compare the current server configuration with a previous configuration, to see what changed.
3) A job to check available disk space. This script runs a few times per hour. It checks for file systems that have filled up above a given threshold. The sysadmin receives an email when a threshold is crossed. **This is beyond Nagios disk monitors that also check the servers for file systems that are filling up. I like having both disk space checks in place.
4) A job to check system security and integrity. This script checks a wide variety of critical system areas and reports differences and changes to the sysadmin.
5) A weekly cron job to check backups. This script compresses and rotates backup logs. It also sends an email report to the sysadmin about what is being backed up.
6) A cron job to verify VMtools is running. This script runs several time a day. It checks whether VMware VMtools is running or not. If it isn't, it tries to restart it. If that fails, an email is sent to the sysadmin to check into the problem.
7) A job to check NFS mounts (on servers with NFS mounts). Monitoring the status of NFS mounts is critical to making sure the environments are functioning properly. This script checks for missing NFS mounts and mounts that are stale.
8) A cron job to report on sudo activity. This script sends a daily sudo report to the sysadmin.
9) A daily job to report system errors. This job runs a custom script which parses various logs for errors and alerts of interest to the sysadmin and reports them via email.
No comments:
Post a Comment