Everyone who codes with SAS knows what the SASWORK directory space is, and everyone who has ever managed a medium-large installation knows that you need to monitor this space to avoid a huge buildup of worthless disk usage. One of the most common snarls happens when large SAS jobs go bust for one reason or another, and the work space does not get cleaned up properly. Here’s a technique you can use, with the help of SAS Environment Manger, to get a proxy for the amount of disk space being used–it’s not perfect, but it’s better than being in the dark.
Before illustrating the technique, a little explanation is needed. In SAS Environment Manager, you will find two types of SAS directories, both at the Server level:
- SAS Config Level Directory 9.4, referring to the …/Lev1 directory
- SAS Home Directory, referring to the …/SASHome/SASFoundation directory
The SASWORK directory is an additional Service level resource, underneath the SAS Home Directory, with the full name of:
<machine> SAS Home Directory 9.4 SAS work directory
Further, the SASWORK directory (or, “work directory”) can be located anywhere on the machine–it’s always some place outside the physical hierarchies of SAS Config and SASHome.
Here we are interested in monitoring the work directory. The problem is that the SAS EV agents are only able to scan and collect information about the disk volume where this work directory resides; they cannot get to the level of just the work directory by itself. Therefore the metrics we can observe provide the amount of space being used on the entire disk volume on which the work directory resides. We will use the metric called “Use Percent”–this is the same “Use Percent” metric that’s found in the alerts in the Service Architecture Framework:
Despite this limitation, it’s still useful for our purposes to monitor this “work directory” object, so here’s how it’s done:
1. Confirm the location and the resource for the SAS workspace. On the main interface, logged in as a SAS administrator, select Resource->Browse->Services, then search on the string “work directory”. Notice that there are two SAS work directories in this example, one on the compute01 machine, one on the meta01 machine, since this particular installation has two machines with base SAS installed:
Here we select the compute01 machine by clicking on it. The properties indicates the location of the SASWORK directory, which is /tmp :
Note that Use Percent is one of the metrics, and also note the file system location: /tmp on the Linux server. You can confirm this if you like by opening a SAS session and running a SAS PROC OPTIONS. The work directory is indicated below:
2. Go to the Dashboard interface, and add a portlet of type “Metric Viewer” to the interface. On the bottom of the right column, in the “Add Content to this column” portlet, choose the Metric Viewer option in the dropdown list and click on the plus “+” sign to add the new portlet.
3. Click on the configuration button located at the top right corner of the new Metric Viewer portlet:
4. Enter the following properties:
Description: SASWORK Disk Volume
Resource Type: – SAS Home Directory 9.4 SAS Directory
Metric: – Use Percent
Then at the bottom of the screen, select the Add to List button. Move the object called “compute01 SAS Home Directory 9.4 SAS work directory” to the right, using the arrow, and select OK. You should see this screen:
5. Select the OK button, and you will see your new portlet with the “Use Percent” metric displayed:
As stated earlier, this metric is imperfect because we are not getting the actual SASWORK space only but rather the work space plus the rest of the disk volume, but it’s better than nothing. There are two potential solutions to this problem:
1. It’s considered a best practice on a production site to create a separate disk volume to be used only for SASWORK–in that case the metric gives us the precise measure that we want. In the case of Windows that would be a separate new drive letter (D:, E:, etc.)
2. It’s possible to use a resource type of “FileServer Directory Tree," point it at the physical SASWORK directory location, and get the total disk space being used, HOWEVER, this will not work unless the userID running the SAS EV agent has read permissions to all the subdirectories of the SASWORK area. Each SAS user gets their own subdirectory within the SASWORK area, and each user is normally the only one that has directory read permissions to their own work area. Therefore this solution would only work in a few unique cases, such as where the agent userID has specifically been given read permissions to the entire SASWORK directory.