Saving or extracting job output from schedule manager
search cancel

Saving or extracting job output from schedule manager

book

Article ID: 444286

calendar_today

Updated On:

Products

VMware Smart Assurance Network Observability

Issue/Introduction

How can the output of a scheduled job (e.g., a command executed on multiple devices) be saved into an external output file? Currently, the Job View within Schedule Manager displays historical data but does not provide a native "Save to File" option for bulk exports.

Environment

All Supported NCM versions

Cause

The Schedule Manager and Job View are designed for tracking and monitoring job status and history within the application interface. There is no built-in UI feature to export these historical logs directly to an external file for multiple devices simultaneously.

Resolution

Though NCM does not provide direct 'Save To File' or 'Export' button to save the output, requested ask could be achieved by following below steps:

Step 1: Execute and Schedule a Saved Command

  1. Log in to the NCM GUI Client.
  2. Select the target devices.
  3. Right-click and select Editor --> Command, refer image:
  4. Enter the required command (e.g., show running-config or any other CLI command) in newly opened Command Editor Window.
  5. Configure the job schedule as required and make note of Job Name as it will be used in next Step, refer image:

Step 2: Extract Output from the Database

  1. Log in to the voyencedb following KB : Logging in to postgesDB
  2. Run query by replacing JOB NAME copied from NCM GUI. 
    SELECT DISTINCT ON (ct.device_name)
    ct.device_name,
    ct.task_result AS command_output,
    cj.job_name,
    ct.status
    FROM voyence.cm_task ct
    JOIN voyence.cm_job cj ON ct.job_id = cj.job_id
    WHERE cj.job_name = '<Insert JOB NAME>'
    AND ct.device_name IS NOT NULL
    ORDER BY ct.device_name, ct.task_number DESC;


    Example:
    SELECT DISTINCT ON (ct.device_name)
    ct.device_name,
    ct.task_result AS command_output,
    cj.job_name,
    ct.status
    FROM voyence.cm_task ct
    JOIN voyence.cm_job cj ON ct.job_id = cj.job_id
    WHERE cj.job_name = 'configlet'
    AND ct.device_name IS NOT NULL
    ORDER BY ct.device_name, ct.task_number DESC;

This will provide result for all devices that are added to single editor job.