BookmarkSubscribeRSS Feed

SAS Viya Inventory scan and reporting

Started ‎07-21-2023 by
Modified ‎07-21-2023 by
Views 1,759

SAS 9 Content Assessment is a very popular way to examine and document the content of a SAS 9.4 environment. Did you know you have similar functionality in SAS Viya? In this blog post, I will look at the inventory options in SAS Viya. In Viya 4 recent improvements have made scanning your environment and examining the configuration and content even easier. It is a recommended best practice to run a scan before and after any major changes in your Viya environment. For example, scan before and after a system migration, an update of the Viya software, before a backup, and after a restore, and before and after migrating content.

 

In this post, we will focus on Viya 4, but first, let us recap what is available on Viya 3.5.

 

SAS Viya 3.5 Inventory scan and reporting

 

In SAS Viya 3.5 the scanning functionality that collects the inventory data is provided by the inventory plug-in of the sas-admin

-line interface. The inventory plug-in of the CLI:

  • Generates the Plan and Backup Ansible playbook​
  • Delivers the Viya Inventory Reports​

The Plan and Backup playbook is the way you run a scan, the playbook creates and publishes all the data that supports the Viya Inventory reports. I covered this process in the first part of this YouTube video. Recent updates to the playbook have added support for scanning a Viya 3.x multi-tenant environment.

 

SAS Viya 4 Inventory scan and reporting

 

In Viya 2022.09 and later inventory scanning in Viya 4 became easier. A Cronjob the sas-viya-inventory-collector makes it simple to scan and inventory the Viya 4 environment. The Cronjob also supports the ability to compare the two most recent scans.  Additionally then Cronjob provides support. for scanning deployments that are multi-tenant and/or SCIM-enabled.

 

The Inventory Reports are delivered when Viya is installed, there are two reports available at Products > SAS Environment Manager > Dashboard

 

  • SAS Viya 4 Inventory: surfaces the result of the most recent inventory scan of the Viya environment.
  • SAS Viya Inventory Comparison: compares the last two inventory scan results.

The reports are supported by data loaded into the SystemData CAS library by the scan process. Two tables hold the results of the most recent inventory scan.

 

  • SASVIYAINVENTORY4 
  • SASVIYAINVENTORY4_CASSVRDETAILS

 

To enable comparison after the second scan runs each scan also keeps a copy of the prior SASVIYAINVENTORY4 table. If you have run at least two scans you should also have the table SASVIYAINVENTORY4_PRIOR.

 

Running a Viya 4 Inventory scan

 

Scan functionality is delivered by the sas-viya-inventory-collector Kubernetes Cronjob. The Cronjob, by default, is not scheduled. Instead, it is delivered as a convenient way of performing a scan. The following command runs a scan by creating and running a Kubernetes job from the Cronjob. The new job is named sas-inventory-collector-job (you can give it any name).

 

kubectl create job --from=cronjob/sas-inventory-collector sas-inventory-collector-job

 

To follow the log as the job runs execute:

 

kubectl logs -l job-name=sas-inventory-collector-job -f | klog

gn_1_scan_001.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

The example scan will scan a non-multi-tenant environment. In a multi-tenant environment an inventory can be performed on a per-tenant basis by setting the tenant environment variable to the tenant name prior to running a scan.

 

kubectl set env cronjob/sas-inventory-collector TENANT=tenant_name

 

When the job is complete you can view the SAS Viya Inventory Report (more on the report later).

 

Running an Inventory Comparison

 

If you have run at least two scans you can do a comparison. The comparison scan will compare the most recent scan results to the previous scan results. To perform a comparison set the COMPARISON environment variable to true and create a job (When the job is completed it is a good practice to reset the environment variable.)

 

kubectl set env cronjob/sas-inventory-collector COMPARISON=true 
kubectl create job --from=cronjob/sas-inventory-collector sas-inventory-comparison-job
kubectl set env cronjob/sas-inventory-collector COMPARISON-

 

Follow the job log:

 

kubectl logs -l job-name=sas-inventory-collector-comparison -f | klog

 

The output of the comparison scan process looks like this.

 

gn_2_scan_002-1.png

 
Comparison with Viya 3.5 after Migration

 

In a migration from Viya 3.x you can compare your new Viya 4 environment to the source Viya 3.x environment. In order to do this

  • Before migration perform an inventory scan of the source environment (for details see this YouTube video.)
  • Perform a full-system migration of the Viya  3.5 environment to Viya 4. The data from the scan of your Viya 3.x environment will be included in the migration.
  • Perform an inventory scan of the new Viya 4 environment.
  • Perform a comparison scan to compare the inventory results from step 3 to those from step 1.

 

To run a Viya 4 to 3 comparison, set the COMPARISON environment variable to migration and then run the job. The scan will compare the most recent Viya 4 scan results to the scan results that were migrated from Viya 3.5. When the job is completed it is a good practice to reset the environment variable.

 

kubectl set env cronjob/sas-inventory-collector COMPARISON=migration
kubectl create job --from=cronjob/sas-inventory-collector sas-inventory-comparison-job
kubectl logs -l job-name=sas-inventory-comparison-job -f | klog
kubectl set env cronjob/sas-inventory-collector COMPARISON-

 

Scan Results

 

SAS Viya 4 Inventory Report

 

The SAS Viya 4 Inventory Report surfaces the inventory results. The Status tab gives a summary of the scan results. Let's look at a couple of the useful Tabs on the report.

 

CAS Inventory

 

The CAS Inventory lists the defined CAS Libraries, the types of CAS Libraries, and the number of tables and file system size of each CAS Library.

 

 

gn_3_scan_003.png

 

Object Inventory

 

The Object Inventory tab lists all the objects in the SAS Viya Environment. You can filter on Internal Objects versus Customer Created Objects. The screenshot shows a count and list of the Visual Analytics Reports in the Viya environment.

 

 

gn_4_scan_004.png

 

NOTE: if you have a report named "Viya Inventory Report" your system was most likely migrated from Viya 3 and that is the Viya 3 version of the report.

 

SAS Viya Inventory Comparison Report

 

The SAS Viya Inventory Comparison report compares the two most recent scans or, if you have migrated from Viya 3.x it can compare to the scan results the Viya 3.x scan results. The report flags if the:

  • content is different.
  • an object exists in the source deployment but not in the target deployment.
  • an object exists in the target deployment but not in the source deployment.
  • an object is different but only in the created or modified dates.

gn_5_scan_005.png

 

 

Wrap-Up

 

The inventory collector Cronjob makes it very easy to perform an inventory scan of a SAS Viya environment. The inventory reports surface the results of the scan. It is a recommended best practice to run a scan before and after any major changes in your Viya environment. For example, scan before and after migration from 3.5 or 4 to 4, an update of the Viya software, before a backup, and after a restore and before and after migrating content. The documentation for SAS Viya Inventory was recently updated and moved to the Tools area of the Viya Administration Guide.

 

Additional Information

SAS Viya Inventory Documentation

 

Find more articles from SAS Global Enablement and Learning here.

Comments

hello Gerry,

thank you for this article, now I know what for the inventory report is. After reading this blog, I have installed klog as well. However, I am not able to execute the inventory scan  probably because of large number of audit entries. On request of our users which are interested to see who is reading the reports, we have set audit recording.level to high but we only retain 7 days of audit records. The inventory scan has scanned more than one million audit entries and then it has generated the following error at audit.entry 1086000:

kubectl -n viya logs -l job-name=sas-inventory-collector-job | klog

Defaulted container "sas-inventory-collector" out of: sas-inventory-collector, sas-certframe (init)

WARN  2023-09-25 12:43:48.720 +0000 [sas-inventory-collector] - Error invoking API /audit/entries 401 /audit/entries

INFO  2023-09-25 12:43:48.720 +0000 [sas-inventory-collector] - 1086000 inventory items collected /audit/entries

 

When I changed back the level of  audit records to low, then I was able to execute the scan. The same happens when you have a lot of files in content. Is possible to make the inventory job to be able to perform also when there are a lot of items? Maybe you have some other advise or there is another reason. Thank you

I don't believe there is any documented limit on the scanning process. I will provide this feedback to the development team to see if they can address the problem.

Hi @GerryNelson ,

 

Thanks for sharing this article. I wasn't able to download the 'klog' filtering tool or even to locate the executable. 

I searched the GitHub page of Technical Support, for instance, but to no avail.

 

- could you, please, provide a download link ?

 

Ronan

 

Thanks to a wonderful Learning Guide 😉 - SAS Viya Operations Course Notes, namely, I discovered its jq one-liner equivalent :

 

jq -R -r '. as $line | try (fromjson|"\(.level | ascii_upcase) \(.timeStamp) [\(.source)] \(.properties.sessionUser )\(.message)" ) catch $line | sub("null";"")'

 

Better defined as a function in .bashrc for further reuse:

 

fklog(){
jq -R -r '. as $line | try (fromjson|"\(.level | ascii_upcase) \(.timeStamp) [\(.source)] \(.properties.sessionUser )\(.message)" ) catch $line | sub("null";"")'
}

Hi @Ronan_Lincoln glad you found the function. We have also switched to using a similar function instead of log.

Version history
Last update:
‎07-21-2023 08:04 AM
Updated by:
Contributors

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started