How to monitor percent free disk space on Linux

Article:HOWTO76990  |  Created: 2012-05-09  |  Updated: 2013-10-25  |  Article URL http://www.symantec.com/docs/HOWTO76990
Article Type
How To



The default Monitor Policies, provided with Monitor Pack for Servers 7.x, do not include any rules which monitor "percent free disk space". The primary reason for this, is that there are more variables/unknowns regarding disk volumes in Linux as compared to Windows. In Windows, one would most likely wish to monitor the system drive's free space, which will be C:\ in nearly all cases. However, in Linux a system administrator can mount any logical disk device to any path. While the root path of / will exist in nearly all cases, that doesn't necessarily mean that /var, /tmp, /usr will be included. If a UNIX/Linux system admin wishes to monitor for free disk space, they will need to specify which volume, or mount point, via a custom metric. The following steps outline an example of accomplishing this goal, but should be adjusted to meet the needs of each customer and environment. These steps should not necessarily be implemented "as is".

  1. Identify a shell command which returns the desired label and value to operate off of. Commands and shells vary in UNIX/Linux, so the appropriate command must be tested and confirmed before implementing it within Monitor Solution. The following command is an example as confirmed in Red Hat Enterprise Linux (RHEL):

df -Pl|grep '^/dev'|awk '{print $6, 100 - $5}'|sed 's/%//'
  

This command returns the mount point in the first column, and the percent free space in the second column:

# df -Pl|grep '^/dev'|awk '{print $6, 100 - $5}'|sed 's/%//'
/ 75
/boot 87
  

This command only returns /dev based mounted volumes. It also strips out the percent symbol as returned by the df command. When leveraging commands in metrics, the Return value column data should be as simple as possible. It also must be operable, and you cannot evaluate "less than", "greater than", etc., if a percent symbol is present. The values returned in the Return value column must be numeric only. The Instance column, however, represents the label (e.i.  "friendly name") for each returned instance, and may be a string.
  
  
  1. Create a new Command Metric which leverages this, or a similar, command
  1. In the Console, access:  Home > Monitoring and Alerting > Monitor > Policies > Metric Library
  2. Under Agent-based, choose New > Command
  3. Enter an appropriate Name and Description, an appropriate Polling interval  (e.g.  900 Seconds), a Timeout of 30 Seconds, and Data type of Numeric
  4. For Use, choose Command line, and paste the command in the neighboring text box
  5. For Line and Search pattern, leave them default. No changes are necessary
  6. For Instance column enter 0  (note:  columns start at zero, not one), and for Return value column enter 1
  7. In this case, a Column delimeter is not required so it may remain empty / default
  8. Choose OK to save the new Command Metric

 

  1. Create a new Rule which leverages this Command Metric
  1. In the Console, access:  Home Monitoring and Alerting > Monitor Policies Rule Library
  2. Under Agent-based, choose New > Metric
  3. Enter an appropriate Name and Description, and choose an appropriate Category
  4. Under Metrics, choose New, choose Select Metric, locate the new Command Metric, then OK
  5. Leave Use profiled data, Statistics, Time period, Value type, and All instances default
  6. For Condition, choose Is less than, and for Value enter the percent value to trigger on  (e.g.  enter 10 to cause the rule to trigger if a volume has less than 10% free disk space), then OK
  7. The Repeat configuration may be adjusted as desired or left default. Refer to the Monitor Solution for Servers User's Guide for more information
  8. Under Actions, choose the appropriate severity for Set severity to. This is the severity in which the rule will trigger as. Typically, Reset severity using should be set to Updated metric value. This will allow the rule to trigger and resolve on its own, based on the value returned by the metric. OK to save the rule

  

  1.  Add this rule to an existing agent-based UNIX or Linux Monitor Policy, or create a new Monitor Policy. Ensure that the target includes the desired monitored UNIX/Linux machines

  

   



Article URL http://www.symantec.com/docs/HOWTO76990


Terms of use for this information are found in Legal Notices