[lug] Monitoring file descriptors
David L. Anselmi
anselmi at anselmi.us
Mon Jul 28 20:26:54 MDT 2008
Jeffrey Haemer wrote:
> If only I had a mail program that interpreted "-E" as "don't send if the
> body's empty", this would be still easier for me to read. (YMMV.)
Very nice.
> awk '(diff = $3 - $1) < 10 {print "Low on file descriptors - " diff}'
> /proc/sys/fs/file-nr |
> mail -E -s "ftp1 file descriptors" ben at atrust.com
Yeah, putting it in awk makes it shorter and more readable. But I
usually avoid awk for things that complicated because a notch or two
more than that and I'd be using perl.
If perl has a mail package that's as easy as the above I'd say we're a
few lines from the point of switching.
> Of course, that would require a Berkeley-style "mail" which would mean I
> wouldn't have /proc. Catch-22.
Hmmm... My mail(1) has that (-e actually). And a little jaunt through
the Debian alternatives system shows it's really bsd-mailx(1) from the
package by the same name.
Dave
More information about the LUG
mailing list