BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Djones4822
Obsidian | Level 7

I've been asked to provide a review of how we're using the allocated space and memory for our SAS installation so that we can prepare resources necessary for the new year and also perform administrative cleanup.

 

Along those lines, I would like to export the LASR server statistics regarding any table information that is accessible. I can't seem to find any option to export out of the hub Administration view or any batch scripts. 

 

I'd like to export the information currently displayed in the LASR Table tab in the Administrator view of the SAS Hub. Is this possible?

 

Ideally, I'd also like to get last known size information on tables that aren't loaded and information about the last load for those (which is only present on a few tables in the description and seems to be largely out of date).

 

Thank you for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
alexal
SAS Employee

@Djones4822,

 

I gave you the code that pulls the information about actual tables that sitting in the memory on the LASR server. If you want to pull the metadata entries for SASOILA libraries, that will be a different piece of code (more complicated). Will you be able to use REST API? 

If so, use REST API from SAS LASR Authorization Service, you will be able to get list of the LASR servers:

http://<FQDN_OF_THE_MIDDLE_TIER>/SASLASRAuthorization/rest/servers/

status of the particular server:

http://<FQDN_OF_THE_MIDDLE_TIER>/SASLASRAuthorization/rest/servers/A5MTT44D_AZ00000G/status

list with tables from the particular server:

http://<FQDN_OF_THE_MIDDLE_TIER>/SASLASRAuthorization/rest/servers/A5MTT44D_AZ00000G/tables

View solution in original post

7 REPLIES 7
alexal
SAS Employee

@Djones4822,

 

Something like that?

 

LIBNAME LASRLIB SASIOLA  TAG=VAPUBLIC  PORT=<LASR_PORT> HOST="<FQDN_OF_THE_LASR_HOST>"  SIGNER="http://<FQDN_OF_THE_MIDDLE_TIER_SERVER>/SASLASRAuthorization" ;

%let sizecols = InMemorySize UncompressedSize 
                CompressedSize TableAllocatedMemory
                InMemoryMappedSize ChildSMPTableMemory
                VirtualMemory ResidentMemory AllocatedMemory;
%let countcols = NumberRecords UseCount RecordLength ComputedColLength;

data tablemem;
    set lasrlib._T_TABLEMEMORY;
run;

data lasrmem;
	set lasrlib._T_LASRMEMORY;
run;

proc print data=lasrmem;
    title "LASR Server Memory Usage";
    format &sizecols.  sizekmg9.2;
    format &countcols. 8.;
    sum _numeric_;
run;

proc print data=tablemem;
    title "LASR Server Table Memory Usage";
    format &sizecols.  sizekmg9.2;
    format &countcols. 8.;
    sum _numeric_;
run;
Djones4822
Obsidian | Level 7

Yes that is extremely close. Is it possible to include the location directory within the SAS Folder hierarchy as well? 


And also, I suppose I can just load every table but I'd like to include those which are not loaded but registered and sitting as "unloaded", is that possible? 

alexal
SAS Employee

@Djones4822,

 

I gave you the code that pulls the information about actual tables that sitting in the memory on the LASR server. If you want to pull the metadata entries for SASOILA libraries, that will be a different piece of code (more complicated). Will you be able to use REST API? 

If so, use REST API from SAS LASR Authorization Service, you will be able to get list of the LASR servers:

http://<FQDN_OF_THE_MIDDLE_TIER>/SASLASRAuthorization/rest/servers/

status of the particular server:

http://<FQDN_OF_THE_MIDDLE_TIER>/SASLASRAuthorization/rest/servers/A5MTT44D_AZ00000G/status

list with tables from the particular server:

http://<FQDN_OF_THE_MIDDLE_TIER>/SASLASRAuthorization/rest/servers/A5MTT44D_AZ00000G/tables

Djones4822
Obsidian | Level 7

@alexal

 

Thanks so much for this, the rest api has exactly what I need.

 

Is there any documentation for programatically accessing it? I tried issuing a POST request for table info of one of my servers with no success. I can access it through a browser (after logging in) but I can't seem to get any success through other means like R or python using the body described here: http://support.sas.com/resources/papers/proceedings16/SAS6363-2016.pdf such as

 

POST http://<FQDN_OF_THE_MIDDLE_TIER>/SASLASRAuthorization/rest/servers/<my server>/tables

username=<username>&password=<pw>

 

Is there anywhere I can read how to properly access it? 

 

 

 

 

alexal
SAS Employee

@Djones4822,

 

You are looking at the correct document (I will give you CURL examples). The first thing that you need to authenticate with the Central Authentication Server protocol is to POST your credentials as a form to SASLogon to create a ticket-granting ticket (TGT).

 

curl -X POST -i -d 'username=<USERNAME>&password=<PASSWORD>' http://<MIDDLE_TIER_URL>/SASLogon/v1/tickets 

You will get the output as shown below:

 

HTTP/1.1 201 Created
Date: Tue, 20 Mar 2018 17:48:54 GMT
X-UA-Compatible: IE=edge
Location: http://<MIDDLE_TIER_URL>/SASLogon/v1/tickets/TGT-94177-GrivAjaQ1pPKzzTmyZBXNZqcoqyMNaxDGgwSksO1rbHPJxsneO-cas
Content-Type: text/plain;charset=UTF-8
Content-Length: 0
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Strict-Transport-Security: max-age=31536000

Get value from Location header and run this command:

 

curl -X POST -d "service=http://<MIDDLE_TIER_URL>/SASLASRAuthorization/rest/servers" http://<MIDDLE_TIER_URL>/SASLogon/v1/tickets/TGT-94177-GrivAjaQ1pPKzzTmyZBXNZqcoqyMNaxDGgwSksO1rbHPJxsneO-cas

 

You will get CAS ticket:

 

ST-192211-1bKiqaOuslPdWdvX4cgO-cas


You can use this ticket to access LASR Authorization Service REST API:

 

curl http://<MIDDLE_TIER_URL>/SASLASRAuthorization/rest/servers?ticket=ST-192211-1bKiqaOuslPdWdvX4cgO-cas

curl is just an example here. You need to convert all of that to code on Python or R or whatever you like.

 

 

Djones4822
Obsidian | Level 7

Perfect! Thank you so much

alexal
SAS Employee

@Djones4822,

 

You are welcome!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 2249 views
  • 5 likes
  • 2 in conversation