Using network monitoring tools, 174 using network monitoring tools – Apple Mac OS X Server (Version 10.6 Snow Leopard) User Manual
Page 174

df -Hl
Filesystem Size Used Avail Capacity Mounted on
/dev/disk0s9 40G 38G 2.1G 95% /
In this example, the hard disk is almost full with only 2.1 GB left. This tells you that
you should act immediately to free space on your hard disk before it fills up and
causes problems for your users.
Â
du
. This command tells you how much space is used by specific folders or files.
For example, the following command tells you how much space is used by each
user’s home folder:
sudo du -sh /Users/*
3.2M /Users/Shared
9.3M /Users/omar
8.8M /Users/jay
1.6M /Users/lili
Knowing who’s using most of the space on the hard disk lets you contact users and
have them delete unused files.
Note: With Workgroup Manager, you can set disk quotas for users and generate disk
usage reports.
Â
diskspacemonitor
. This command lets you automate the process of monitoring disk
space usage. When the amount of free disk space drops below the level you specify,
diskspacemonitor
executes shell scripts that send you a notification. This command
defines two action levels:
Alert—Sends you a warning message when disk space usage reaches 75%.
Â
Recover—Archives rarely used files and deletes unneeded files when disk space
Â
usage reaches 85%.
For more information about these commands, see the corresponding man page.
Using Network Monitoring Tools
Degradation in network performance or other network problems can adversely affect
the availability of your services. The following network monitoring tools can alert you
to problems early, so you can take corrective action to avoid or minimize down time.
To monitor network activity, use the
Â
tcpdump
utility in Mac OS X Server. This utility
prints the headers of incoming and outgoing packets on a network interface that
match specified parameters.
Using
tcpdump
to monitor network traffic is especially useful when trying to detect
denial of service (DoS) attacks. For example, the following command monitors
incoming traffic on port 80 on your computer:
sudo tcpdump -i en0 dst port 80
174
Chapter 8
Monitoring Your System