Within the dynamic code editor it is possible to read additional command outputs for supported network switches using the SSH support functions.

  • Ensure that the agent plugin is configured to run after agent scan in the plugin properties.

  • Cast the item as a network switch.

  • Execute the required command and store the response as a NetworkSwitchCommandOutput object.

  • Assign a new unique identifier in GUID format for the command output, this ensure consistency when comparing items.



/// <summary>

/// Reads additional command outputs for network switches.

/// </summary>

public override void Execute()

{        

       if (!Ssh.IsConnected){ return; }

       NetworkSwitch networkSwitch = (NetworkSwitch)Item;        

       String response = Ssh.ExecuteManualCommand("show version");

       NetworkSwitchCommandOutput output = new NetworkSwitchCommandOutput();

       output.CommandText = "show version";

       output.DisplayName = "Switch Version Information";

       output.Identifier = new Guid("ec797b2c-5d39-415f-8294-98ab3410cb96");

       output.OutputText = response;

       networkSwitch.CommandOutputs.Items.Add(output);

}