|
|
|
How to check the status of your SAS/SHARE services
|
This application addresses the problem of needing to know the status of SAS/SHARE services.
Specifically, this program:
- Captures the status of a SAS/SHARE service using PROC OPERATE
- Checks to see if the service is active
- Sends an email and text message if the services are not running
Note: Although this application is designed for a UNIX environment, it could be modified for Windows or other platforms.
%macro share_chk(share=,server=);
/*create a text file to capture the share server interrogation status*/
x "rm /some/directory/share.txt";
filename share "/some/directory/share.txt";
proc printto print=share new;
run;
/*execute the PROC OPERATE and send the results to the text file*/
proc operate server=&share. Pf=print;
run;
/*reset the output window*/
proc printto;
run;
/*read in the status flag and send email/text message if a service is not detected*/
data one (keep=flag);
infile share pad missover;
input var1 $char100.;
if _n_=3;
if substr(var1,1,4)='PROC' then flag=1;
else flag=0;
call symput('flag',flag);
run;
%if &flag=0 %then %do;
data _null_;
set one;
filename outbox email "your@email";
file outbox
cc = ("8005551212@txt_messaging.srvc")
subject="Please Check the &SHARE SAS/Share Services on &server";
put "The &share SAS/SHARE services on &server were flagged";
put "as not running on &sysday.,&sysdate., at &systime.";
run;
%end;
%mend share_chk;
/*invoke the macro for the services of interest*/
%share_chk(share=unixshr1,server=mysun1);
%share_chk(share=unixshr2,server=mysun1);
|