BookmarkSubscribeRSS Feed
Question
Fluorite | Level 6

Hi All,

 

One of the library is used by lots of users and can get full quickly.

I would like to know if there is a code that gives how much is the space used and % of space remaining etc...

 

Your help would be much appreciated

 

Thank you

8 REPLIES 8
Kurt_Bremser
Super User

I do that outside of SAS, by using a script with df (the UNIX command that shows disk usage) through the CGI gateway, so a simple click on a web link is all that's needed.

 

But you can use such command from SAS (if XCMD is enabled, of course).

 

So we need to know

  • which operating system your SAS server runs on
  • if XCMD is enabled (PROC OPTIONS)
Question
Fluorite | Level 6

Hi Kurt,

 

Thank you for your response.

Please see below my answers :

 

  • which operating system your SAS server runs on : Unix
  • if XCMD is enabled (PROC OPTIONS) :   NOXCMD     Disables the X command in SAS.

I have run the proc options and I get the above ...so not sure how to proceed now.

 

Cheers

Kurt_Bremser
Super User

To my knowledge, SAS has no built-in tools to retrieve information like disk size and disk usage.

So you will either have to do it via shell script, or have XCMD enabled.

This is the code that gets all mounted volumes and their usage:

data df;
infile "df" pipe truncover firstobs=2;
input
  volname :$50.
  blocks
  free
  used_blocks percent7.
  iused
  ipercent percent7.
  mountpoint :$50.
;
format used_blocks ipercent percent7.2;
run;

(used on AIX, Linux might need a slighly different column layout)

 

If you can't get XCMD enabled, you can use crontab to run the df regularly (every minute, if you want) and write the result to a file, which you then pick up with the same data step as above (just change the INFILE).

 

You then need to identify which mount points contain your SAS libraries.

Question
Fluorite | Level 6

Thank you Kurt,

 

yes I definitely need XCMD enabled as I get the below errror...so will speak to our SAS administrators etc and see if I am allowed to use this function ect...

 

ERROR: Insufficient authorization to access PIPE.

 

Cheers

Kurt_Bremser
Super User

As I said, you can run the command outside SAS and pick up the result. For this, you need to log on to the UNIX server with a SSH client (e.g. PuTTY). If you want to go down that route, let me know.

In particular would it be nice to know the exact UNIX brand you use (Linux, Solaris, AIX, HP-UX).

ChrisNZ
Tourmaline | Level 20

If you don;t have access ti PIPE (talk to the admins, there's seldom a good reason not to), you cannot retrieve free space information. You can still retrieve file information. Look a the very first (pinned) topic in the programming community. It should contain everything you need.

LinusH
Tourmaline | Level 20

This kind of monotring is usually managed by platform administrators, and standard tool exists for this. So I sugets that you investigate those options first, before you are building something specific in SAS, or that is driven by the SAS platform.

Data never sleeps
SASKiwi
PROC Star

SAS Environment Manager monitors your SAS server resources and can be configured to send alerts when disk usage is high - for example > 95%. See screenshot for an example:

screenshot35.JPG 

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 1536 views
  • 4 likes
  • 5 in conversation