Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to reconfigure Nagios e-mail notification to send me information about largest files on a disk.

This is oneliner which shows me largest 20 files:

find / -type f -ls | sort -k 7 -r -n | head -20 |grep -v lastlog | awk '{ sum=$7 ; hum[1024**3]="Gb";hum[1024**2]="Mb";hum[1024]="Kb"; for (x=1024**3; x>=1024; x/=1024){ if (sum>=x) { printf "%.2f %s" " " $11 "\n",sum/x,hum[x];break;} }}'

I'd like Nagios to trigger this command on check_disk alert and to attach results in Nagios notification.

Could that be possible?


share|improve this question

You probably want to use check_nrpe for this and add it as a separate check and give it the one liner as the remote command to be executed. You can't alter check_disk unless you edit the source code and recompile it.

The max output for chech_nrpe is 1024 chars, so you might need to cut it down a bit.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.