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

are there any script to validate the servers?  want to setup some schedule jobs to check the status of the servers.  thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
PaulHomes
Rhodochrosite | Level 12

Hi Ronan,

 

Glad to hear the link to that SAS note helped you too. I was initially puzzled when I ran it and got no output. I was expecting it to print usage info to the console like the other SAS Platform Object Framework utilities do. It wasn't until I was looking around for a log file with errors that I saw the usage info and then that note confirmed it.

 

I was finding that I had to specify most of the parameters to get it to work and it would just log "null" and return 1 when I didn't get the complete set required. It would probably be easier to just point it at a profile (.swa) but here is an example that worked for me:

 

# Validate Logical Workspace Server

/opt/sas94/sashome/SASPlatformObjectFramework/9.4/ValidateServer -msp "host=localhost port=8561 domain=DefaultAuth userid=myuserid password={sas002}MYPWENCODEDPASS reposid=A0000001.A9ZZZZZ9" -sn "SASApp - Logical Workspace Server" -cred "domain=DefaultAuth userid=myuserid password={sas002}MYPWENCODEDPASS"; echo $?

 

Examples for servername (sn) that worked for me were:

  • SASMeta - Logical Metadata Server
  • SASMeta - Metadata Server
  • SASApp - Logical Workspace Server
  • SASApp - Workspace Server
  • SASApp - Logical Pooled Workspace Server
  • SASApp - Pooled Workspace Server
  • SASApp - Logical Stored Process Server
  • SASApp - Stored Process Server
  • SASApp - Logical OLAP Server
  • SASApp - OLAP Server
  • SASApp - Connect Server
  • SAS Content Server
  • Operating System Services - hostname

I have found that a typo in the server name logs "null" and returns 0.

 

I didn't want to duplicate the credentials (assuming credential caching would be used) but if I didn't then it logged  "A null user ID is invalid for creating a User Context." and returned 1. When it works it returns 0.

Cheers

Paul

View solution in original post

17 REPLIES 17
Kurt_Bremser
Super User

(UNIX)

In the Lev1 subdirectory of your SAS configuration tree, there is a script called sas.servers.

In that script, you find a function is_server_up(), which might serve as a blueprint for what you want to do.

PaulHomes
Rhodochrosite | Level 12

I would also suggest you look into SAS Environment Manager where you can have alerts that notify people when they get triggered. See the Working with Resource Alerts section in the SAS Environment Manager 2.5: User's Guide. You might also want to look at the Service Architecture Alert Definitions appendix for some examples of the alerts you get when you enable the SAS Environment Manager Service Architecture. It includes server/service and spawner availability alerts and many more.

ronan
Lapis Lazuli | Level 10

No there aren't any as far as I know, but this would be most useful.

The SMC Server Manager plugin "Validate" command is only available in the interactive point & click interface, no corresponding CLI unfortunately. 

 

I have tried to develop some workspace validation script of my own, but it's assessing roughly a proxy state of the server, not a standardized technical validation status. When the server is down, then the script execution status displays an error accordingly. The IOMOPERATE procedure has some List Information command which can be used indirectly to test the server status. 

 

It's a rather simple case since the Workspace server I worked with reused the same technical account, was not clustered and is merely a command-line + socket. In more complex situations, for instance with shared-context servers like Stored Process servers, Pooled Workspace etc, this might be more tricky not to mention the validation of the authentication sub-process itself: if the remote SAS sessions are launched under the personal identity/account of the user then the validation process has to take into account this variability (eg sassrv account or even sasdemo might work, whereas another specific account might not due to some permissions problems outside the scope of SAS).

 

tested with 9.3 M1 on Linux RHEL6

 

Important : a token-based authenticating Workspace was required and an internal sas admin account like sasadm@saspw (IOMOPERATE in 9.3 M1 doesn not authenticate with LDAP providers, only with "@saspw" domains : check with 9.4, this might have changed)

 

 /* Standard SASApp Workspace server status check */

proc iomoperate ; connect hostname="<machine>" port=8591 username="someadminaccount@saspw" password="guesswhat";

list information;

quit;

 

 Launched within a linux script, it can capture some approaching server status, but it remains coarse. 

 

BTW, the Metadata Server comes with a built-in validation feature  (I merely copied the underlying SAS code  based on METAOPERATE procedure for my own purpose above) :

 

<sas config meta>/Lev1/SASMeta/MetadataServer/MetadataServer.sh status

 

 

 

 

 

 

PaulHomes
Rhodochrosite | Level 12

Hi Ronan, not sure if you saw the ValidateServer command line tool in the SAS Platform Object Framework. I can't find the documentation link for it but there is a note about it: SAS Usage Note 42523: ValidateServer utility to check availability of SAS® 9.2 Business Intelligence.... The note is about SAS 9.2 but it's still there in SAS 9.4 M3 ($SASHOME/SASPlatformObjectFramework/9.4/ValidateServer).

ronan
Lapis Lazuli | Level 10

Hi Paul, 

 

Thanks. Spot on : this is the answer 🙂

 

Yes, I saw the tool and I even tried to run it before sending my post (ValidateServer --help).

Unfortunately, I wasn't aware that the tool by default redirects its output to some Log file : strange beast !

I mistakenly assumed that this meant the tool was provided only to feed the SDW/SDM in background calls,

and was not a front end piece of code. Lack of curiosity killed the cat, they say ? 😉

 

Here is the syntax properly extracted from the redirected log file :

 

ValidateServer validates a specified server type with given server attributes.

Usage:
      java -classpath sas.servermgr.jar com.sas.management.servers.validator.commands.ValidateServer <options>

Where <options> are:

-metaserverparms "<parms>" (or -msp "<parms>")
      Consists of name/value pairs of methods to connect to a metadata server i.e. metadata connection attributes or metadata profile
      Valid values are:
          <parms>: "host=XXX port=XXX domain=XXX userid=XXX password=XXX reposid=XXX"
          <parms>: "metadataprofile=XXX.swa"

-servername Name (or -sn Name)
      This is the name of the server metadata definition of the server to be validated.
      Use either this option or -serverid (-sid)

-serverid ID (or -sid ID)
      This is the ID of the server metadata definition of the server to be validated.
      Use either this option or -servername (-sn)

-serverparms "<parms>" (or -sp "<parms>")
      Consists of name/value pairs of server/connection attributes for the server to be validated.
      e.g. <parms>: "code=XXX contentlocation=XXX"

-credentials "<parms>" (or -cred "<parms>")
      Consists of a domain, userid and password
      Valid values are:
          <parms>: "domain=XXX userid=XXX password=XXX"

-log
      Writes out logging information out to a file.
      File: <user profile directory>\ValidateServerErrorLog.log
      If not specified, logging information is written out to the file "ValidateServerErrorLog.log" in <user profile directory>\ApplicationData\SAS\LOGS on Windows and <user profile directory>\.SASAppData\SAS\LOGS on all other operating systems.

-help (or -?)
      Prints this help information

 

I played a little with it but to no avail at this point. 

PaulHomes
Rhodochrosite | Level 12

Hi Ronan,

 

Glad to hear the link to that SAS note helped you too. I was initially puzzled when I ran it and got no output. I was expecting it to print usage info to the console like the other SAS Platform Object Framework utilities do. It wasn't until I was looking around for a log file with errors that I saw the usage info and then that note confirmed it.

 

I was finding that I had to specify most of the parameters to get it to work and it would just log "null" and return 1 when I didn't get the complete set required. It would probably be easier to just point it at a profile (.swa) but here is an example that worked for me:

 

# Validate Logical Workspace Server

/opt/sas94/sashome/SASPlatformObjectFramework/9.4/ValidateServer -msp "host=localhost port=8561 domain=DefaultAuth userid=myuserid password={sas002}MYPWENCODEDPASS reposid=A0000001.A9ZZZZZ9" -sn "SASApp - Logical Workspace Server" -cred "domain=DefaultAuth userid=myuserid password={sas002}MYPWENCODEDPASS"; echo $?

 

Examples for servername (sn) that worked for me were:

  • SASMeta - Logical Metadata Server
  • SASMeta - Metadata Server
  • SASApp - Logical Workspace Server
  • SASApp - Workspace Server
  • SASApp - Logical Pooled Workspace Server
  • SASApp - Pooled Workspace Server
  • SASApp - Logical Stored Process Server
  • SASApp - Stored Process Server
  • SASApp - Logical OLAP Server
  • SASApp - OLAP Server
  • SASApp - Connect Server
  • SAS Content Server
  • Operating System Services - hostname

I have found that a typo in the server name logs "null" and returns 0.

 

I didn't want to duplicate the credentials (assuming credential caching would be used) but if I didn't then it logged  "A null user ID is invalid for creating a User Context." and returned 1. When it works it returns 0.

Cheers

Paul

PaulHomes
Rhodochrosite | Level 12

Oh, and you can get the Foundation repository id either by looking in SAS Management Console with the Metadata Manager plug-in, or looking at SelectedReps inside a working SAS metadata server profile (.swa) file.

ronan
Lapis Lazuli | Level 10

Thanks a lot, Paul. I confirm the syntax above works perfectly fine. I also had extracted the ReposId from the SMC MetadataManager; my second option would have been some request using Metacoda's Metadata Explorer, of course ;).

 

Should I say, this is definitely worth another brilliant post of yours on Platformadmin blog ?

 

Below the log file generated on a 9.3 Linux server whose licence had expired : 

 

[sasinstallaccount@host]$ cat .SASAppData/Logs/ValidateServerErrorLog.log
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE log SYSTEM "logger.dtd">
<log>
<record>
  <date>2016-08-23T09:59:28</date>
  <millis>1471939168322</millis>
  <sequence>9</sequence>
  <logger>Aug 23, 2016 9:59:28 AM com.sas.management.servers.validator.ServerValidatorUtil validateIOMServerMakeConnection
INFO: Starting extended validation for Workspace server (level 1) - Making a connection
Aug 23, 2016 9:59:43 AM com.sas.management.servers.ServerUtil logChainedExceptionMessages
SEVERE: The launch of the server process failed due to a site validation problem.
Tue Aug 23 09:59:43 CEST 2016: The launch of the server process failed due to a site validation problem.

Tue Aug 23 09:59:43 CEST 2016: Return code: 1
gger>
  <level>SEVERE</level>
  <class>com.sas.management.servers.ServerUtil</class>
  <method>logChainedExceptionMessages</method>
  <thread>10</thread>
  <message>The launch of the server process failed due to a site validation problem.</message>
</record>

Cheers

Ronan

ronan
Lapis Lazuli | Level 10

BTW, this also disproves my initial claim that the SMC Server Manager's Validate interactive command had no corresponding CLI feature. The ValidateServer command replicates exactly the SMC (the same Java class might be called).

PaulHomes
Rhodochrosite | Level 12

No problem Ronan. I like these challenges 😉 Good suggestion about the blog post. I'll try to get to that soon. Thanks for posting that sample log fragment for a failing workspace server. I forgot to mention that the validation information goes into the log file (and you see nothing on the console).

ShelleySessoms
Community Manager

Hi @Grumbler,

 

Will you be so kind as to mark @PaulHomes solution as "Accept as Solution"? This will help others looking for the same information.

 

I originally thought @ronan asked the question, sorry for the confusion!

 

Thanks for using the communities!

Shelley

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Jlochoa
Obsidian | Level 7

I followed the example in the post to create a script that verifies the servers in my two SAS enviornments. What is the purpose for the following option?

 

-serverparms "<parms>" (or -sp "<parms>")
      Consists of name/value pairs of server/connection attributes for the server to be validated.
      e.g. <parms>: "code=XXX contentlocation=XXX"

 The example implies code and code directory path location that is executed by the server. Is this the case?

 

Cheers,

jose 

PaulHomes
Rhodochrosite | Level 12

Hi Jose,

 

I haven't tried using -serverparms myself and cannot find any additional documentation other than the brief descripion you get from the -help option (as you posted). 

 

I'd suggest contacting SAS Tech Support to see if there's any extra usage/example information available. Please post back to this thread with any additional information you do get 🙂

 

Cheers

Paul

acfarrer
Quartz | Level 8

Has anyone run ValidateServer under SAS94M5 on Linux ? My ValidateWSServer.sh script was fine under SAS4M3 at previous Linux sites but is complaining about loading main class com.sas.management.servers.validator.commands.ValidateServer

 

Under SAS92, I had to specify $CLASSPATH to make it work but those jar locations are very different now.

 

A scheduled ValidateServer script is great for catching EG connection issues before the users notice.

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 

CLI in SAS Viya

Learn how to install the SAS Viya CLI and a few commands you may find useful in this video by SAS’ Darrell Barton.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 17 replies
  • 7162 views
  • 12 likes
  • 7 in conversation