Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_file_age_fmt
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
Changes the output of Steven Grimm's check_file_age plugin to display times as days, hours, minutes and seconds, and to convert file sizes to the largest standard unit.
The file age is formatted as "[#d ][#h ][#m ]#s, where days, hours, or minutes are omitted if their value is zero. Therefore, time might be listed as "21h 30m 45s" or "5d 7m 0s" or any combination of units.
File sizes are formatted by dividing the number of bytes into the standard 1024-based sizes of B, KB, MB, GB, TB. Examples: 530.30 KB, 1023.99 MB, 1.00 GB.
This script also takes formatted times for its inputs, or with unformatted seconds, as in the original script. For example, you can pass the arguments "-w 5d14h3m20s -c 6d30m9s" or "-w 482600 -c 520209" and these will be equivalent. File sizes (-W -C) must still be specified in bytes.
The file age is formatted as "[#d ][#h ][#m ]#s, where days, hours, or minutes are omitted if their value is zero. Therefore, time might be listed as "21h 30m 45s" or "5d 7m 0s" or any combination of units.
File sizes are formatted by dividing the number of bytes into the standard 1024-based sizes of B, KB, MB, GB, TB. Examples: 530.30 KB, 1023.99 MB, 1.00 GB.
This script also takes formatted times for its inputs, or with unformatted seconds, as in the original script. For example, you can pass the arguments "-w 5d14h3m20s -c 6d30m9s" or "-w 482600 -c 520209" and these will be equivalent. File sizes (-W -C) must still be specified in bytes.
Reviews (2)
byJamieV, June 29, 2021
Thanks so much for this little amplification of the check_file_age plugin! This was exactly what I needed rn, so I'm quite happy that I found it. Also, the first review helped as well, as I had to change the "use lib".
Tested today with Nagios Core 4 and several CentOS 6.8 monitored servers. I've only had to change the "use lib" path to the right one. In my case: "/usr/lib64/nagios/plugins".
Thanks a lot!
Thanks a lot!