In certain cases, the Discovery datastore can grow sufficiently to fill its disk partition. Other partitions, such as /usr or /var, may also run out of space.
When this happens, Discovery services are stopped and the UI is not available.
One way to avoid this is to take advantage of a Discovery log file that tracks disk usage. This file is named "tw_appliance_df.log" and is updated daily. It's basically the output of a 'df' command, and it appends each new day's output at the end. This allows you to see growth over time.
The attached script reads this file and generates an email with an attached report. A quick look at this report shows you if any disk partitions are nearing 100% full. This allows you to take action before an outage occurs.
The script looks like this:
### Remove previous output file
rm -f /usr/tideway/df_report.txt
### Run the report
tail -10 /usr/tideway/log/tw_appliance_df.log > /usr/tideway/df_report.txt
### Email the results
echo "Current Discovery disk usage" | smtp=mailhost.mycompany.com mailx -a "/usr/tideway/df_report.txt" -n -s "Disk Usage Report" email@example.com
It will be necessary to edit the script to:
- Specify a valid smtp server
- Specify a valid email address
Also, since the length of the 'df' output can vary by environment, the value of the "tail -10" command may need to be adjusted to make sure that you're getting all the output of the most recent 'df' command, but not the output of the prior day.
Once the script has been edited, copy it to your Discovery appliance in the /usr/tideway directory and run these commands:
1. Use dos2unix to convert the script to UNIX format:
2. Run the script:
Confirm that the /usr/tideway/df_report.txt file was created, and that the email was received.
The script can then be scheduled to run on a regular basis (weekly is suggested) using a cron job:
1. As the tideway user, create a cron job file, for example:
# cron job to report disk usage
# runs every Wednesday at 1:25pm
25 13 * * 3 /bin/sh /usr/tideway/df_report.sh
Note: if the cron job file is created on your desktop and copied to the Discovery appliance, use dos2unix to convert the file to UNIX format:
2. Run /usr/tideway/bin/tw_cron_update to add this job to the crontab.
3. Run "crontab -l" to verify that the job is on the crontab.
df_report.sh 357 bytes