From Server Logs to Actionable Data: Automating Job Status Reports in SAS

This code is also available in: Deutsch Español
Difficulty Level
Beginner
Published on :
Simon

Expert Advice

Simon
Expert SAS et fondateur.

The power of PROC DMSRVADM lies in its ability to turn transient server status into historical data. By default, the procedure gives you a snapshot of current or recent jobs. To build a true performance dashboard, use PROC APPEND after your DMSRVADM step to accumulate these snapshots into a permanent history table. This allows you to visualize execution time trends over weeks or months and identify degrading performance before it causes a failure.

Attention : This code requires administrator privileges.
The DMSRVADM procedure allows querying a DataFlux Data Management server to obtain a detailed report on the status of its tasks. This report, generated as a SAS© data set, includes metadata about each task, such as its ID, status, execution host, and other relevant information. This is crucial for server monitoring and administration, enabling administrators to track performance and identify issues. The resulting data set can be used for further analysis, reporting, or to trigger other administrative processes.
Data Analysis

Type : CREATION_INTERNE


Examples use generic hosts and ports for connecting to the DataFlux Data Management server. The output data set 'work.jobReport' is dynamically created by the DMSRVADM procedure itself. No external data set is required.

1 Code Block
PROC DMSRVADM
Explanation :
This code is the simplest use of the DMSRVADM procedure. It connects to a DataFlux Data Management server specified by the HOST and PORT options, then generates a SAS data set named `work.jobReport` containing the task status. A PROC PRINT is added to quickly view the first lines of the report.
Copied!
1/* Cet exemple génère un rapport d'état de tâche basique
2 à partir d'un serveur DataFlux Data Management spécifié. */
3PROC DMSRVADM
4 out=work.jobReport
5 host='http://myviyahost.example.com' port=50001;
6RUN;
7 
8/* Affiche les 5 premières observations du rapport généré */
9PROC PRINT DATA=work.jobReport(obs=5);
10title 'Rapport d''état de tâche basique';
11RUN;
2 Code Block
PROC DMSRVADM
Explanation :
This example illustrates an intermediate use by filtering the `work.fullJobReport` data set generated by `DMSRVADM` to include only tasks with 'COMPLETED' status. Although direct filtering options for DMSRVADM are not specified in the excerpt, post-processing the output data set is a common approach. Column names like '_Status_' are assumptions based on typical task status reports. A PROC PRINT displays the filtered result.
Copied!
1/* Cet exemple génère un rapport d'état de tâche,
2 puis filtre les tâches avec un statut 'COMPLETED'.
3 NOTE: Les options comme STATUS= ou JOBNAME= sont hypothétiques car non spécifiées
4 dans l'extrait de documentation fourni pour DMSRVADM directement, mais la post-traitement
5 est une approche standard pour des procédures d'administration de ce type. */
6PROC DMSRVADM
7 out=work.fullJobReport
8 host='http://myviyahost.example.com' port=50001;
9RUN;
10 
11/* Filtre et affiche uniquement les tâches terminées */
12DATA work.completedJobs;
13 SET work.fullJobReport;
14 where _Status_ = 'COMPLETED'; /* '_Status_' est un nom de colonne supposé */
15RUN;
16 
17PROC PRINT DATA=work.completedJobs;
18title 'Rapport des tâches terminées';
19RUN;
3 Code Block
PROC DMSRVADM
Explanation :
This advanced example leverages SAS macro variables to make the `HOST`, `PORT`, and output data set name parameters dynamic. After report generation, additional analysis procedures (PROC FREQ and PROC SQL) are used to understand the distribution of task statuses and create an aggregated summary. This shows how DMSRVADM output can be integrated into a more complex analysis workflow.
Copied!
1/* Cet exemple utilise des macro-variables pour paramétrer
2 l'hôte et le port du serveur DataFlux Data Management,
3 offrant une plus grande flexibilité. Le rapport est ensuite analysé plus en détail. */
4%let server_host = http://myviyahost.example.com;
5%let server_port = 50001;
6%let output_dataset = work.dynamicJobReport;
7 
8PROC DMSRVADM
9 out=&output_dataset
10 host=&server_host port=&server_port;
11RUN;
12 
13/* Analyse la distribution des statuts de tâche */
14PROC FREQ DATA=&output_dataset;
15 tables _Status_;
16 title "Distribution des statuts de tâche pour le serveur &server_host";
17RUN;
18 
19/* Création d'un rapport agrégé par statut de tâche */
20PROC SQL;
21 create TABLE work.statusSummary as
22 select _Status_, count(*) as NumberOfJobs
23 from &output_dataset
24 group BY _Status_;
25QUIT;
26 
27PROC PRINT DATA=work.statusSummary;
28 title 'Résumé des tâches par statut';
29RUN;
4 Code Block
PROC DMSRVADM / PROC CASUTIL
Explanation :
This example demonstrates how to integrate `DMSRVADM` output into the SAS Viya Cloud Analytic Services (CAS) environment. The initial `work.jobReportLocal` report is first generated locally, then the `PROC CASUTIL` procedure is used to load this data set into the CASUSER library (or another specified CAS library) under the name `jobReportCAS`. This allows leveraging CAS's distributed and in-memory processing capabilities for large or complex task status report data analysis. `cas` commands are included to manage the CAS session. A `PROC CAS PRINT` is then used to view the CAS table.
Copied!
1/* Cet exemple génère un rapport d'état de tâche,
2 puis le charge dans une table CAS pour une analyse en mémoire distribuée. */
3PROC DMSRVADM
4 out=work.jobReportLocal
5 host='http://myviyahost.example.com' port=50001;
6RUN;
7 
8/* Démarre une session CAS si elle n'est pas déjà active */
9/* Remplacez 'cas.example.com' et 'casuser' par vos informations de session CAS */
10options cashost="cas.example.com" casport=5570;
11cas casauto;
12 
13/* Charge le jeu de données local dans une table CAS */
14PROC CASUTIL;
15 load casdata="jobReportLocal" incaslib="WORK" outcaslib="CASUSER" replace;
16RUN;
17 
18/* Affiche les premières lignes de la table CAS */
19PROC CAS PRINT DATA=CASUSER.jobReportCAS(obs=5);
20title 'Rapport d''état de tâche chargé dans CAS';
21RUN;
22 
23/* Termine la session CAS (facultatif) */
24cas casauto terminate;
25 
26/* Le flag CAS est à 1 pour cet exemple */
Pro Tip
The PROC DMSRVADM procedure is an essential tool for administrators to bridge the gap between DataFlux Data Management Server operations and SAS Viya analytics. By converting server metadata into a standard SAS data set, it enables automated monitoring and proactive troubleshooting.

To leverage this procedure effectively, follow these administrative best practices:

Automate Health Checks: Use PROC DMSRVADM within a scheduled job (via SAS Job Execution or CRON) to pull status reports at regular intervals. Combined with a PROC FREQ or PROC SQL step, you can automatically detect surges in "FAILED" or "ERROR" statuses and trigger alert emails.

Centralize with CAS: For organizations running multiple DataFlux servers, aggregate the local data sets from each server and load them into a global CAS table. This allows for a unified, real-time dashboard of your entire data management landscape using SAS Visual Analytics.

Handle Metadata Naming: Be aware that metadata column names (like _Status_ or _Host_) can vary depending on your DataFlux version. Always run a PROC CONTENTS or table.columnInfo on your first output to verify the exact variable names before building downstream filters or SQL logic.

Secure Connection Parameters: Avoid hardcoding server credentials. Use macro variables or the SAS Metadata Server to manage host and port values, ensuring that administrative scripts remain portable and easier to maintain across different environments (Dev, Test, Prod).
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright © SAS Institute Inc. All Rights Reserved


Related Documentation

Aucune documentation spécifique pour cette catégorie.