msh usage example

This page introduces examples of using msh to control SACM from the command line.

Service adaptor registration

This section explains how to link the Distribution ID and the SA code in order to enable the SACM management. Whether or not this task is required will vary depending on the OEM provider. Execute the show sa command and confirm the service adaptor status, then conduct Distribution ID registration.

Confirm licensed SA codes

Use the show sa command to confirm SA codes.

msh(tsa********)> show sa
---
- SA_0:
    SA Code: tss00000000
    SA Label: SA
    Description:
    Distribution ID: 0000-1111-2222-3333-4444-5555-6666-7777
    Preferred Push Method:
    Up: false
- SA_1:
    SA Code: tsw11111111
    SA Label: SA
    Description:
    Distribution ID:
    Preferred Push Method:
    Up: false
msh(tsa********)>
  • Confirm that the ‘Distribution ID’ column for the SA code you want to use is empty.

Distribution ID registration

Use the set sa command to register the Distribution ID. The format of the set sa command is as follows.

set sa <SA Code> [name <Name>] [description <Description>] [distributionid <Distribution ID>] [preferredpushmethod <Preferred Push Method>]

set sa command execution example

msh(tsa********)> set sa tsw11111111 distributionid 0000-0000-0000-0000-0000-0000-0000-0000 (Enterキー)
---
SA Code: tsw11111111
SA Label: SA
Description:
Distribution ID: 0000-0000-0000-0000-0000-0000-0000-0000
Preferred Push Method: none
Up: false
msh(tsa********)>

This completes the task of linking the service adaptor Distribution ID and the SA code.

Register/reflect config

This section explains procedures for inserting the config into the SACM service adaptor.

To reflect the config to the service adaptor, register the config as the working config in the SACM and then reflect that working config onto the running or startup config. This section introduces the procedure for editing working config module 0 and reflecting it onto the startup config.

The relationship between the parameters for config type specified in the set config command and the config types displayed in the control panel is as follows.

Command parameter

Control Panel display

working

Working config

running

Running config

startup

Startup config

Use the set config command to register a config. The set config command format is as follows.

msh(tsa********)> set config <SA Code> <Type> [module <Module ID> [config <Config PATH>]]

Register working config

msh(tsa********)> set config tsw11111111 working module 0 config /tmp/saw1_config
set config: Working Config was updated.
msh(tsa********)>

Confirm working config

msh(tsa********)> show config tsw11111111 type working module 0
interface.ge0.ipv4.address: dhcp
route.ipv4.0.destination: default
route.ipv4.0.gateway: dhcp
resolver.service: enable
resolver.1.address: dhcp
dns-forwarder.service: enable
dns-forwarder.1.address: dhcp
dns-forwarder.listen.ipv4.100.interface: ge0
msh(tsa********)>

Reflect to startup config

msh(tsa********)> set config tsw11111111 startup
set config: Startup Config was updated.
msh(tsa********)>

Confirm startup config

msh(tsa********)> show config tsw11111111 type startup module 0
interface.ge0.ipv4.address: dhcp
route.ipv4.0.destination: default
route.ipv4.0.gateway: dhcp
resolver.service: enable
resolver.1.address: dhcp
dns-forwarder.service: enable
dns-forwarder.1.address: dhcp
dns-forwarder.listen.ipv4.100.interface: ge0
msh(tsa********)>

Use the above procedure to register the config as the config used by the service adaptor at startup.

Script-based batch operations

This section shows examples of batch processes using scripts written in Ruby language.

  • Example of a script for executing a ping to a host from multiple service adaptors

sa = %w(tsw00000000 tss11111111 tsw22222222)

sa.each do |target|
  puts `msh ping #{target} ::1`
end
  • Example of a script for reading Md command results from all managed service adaptors (this example executes show tech-support)

require 'yaml'

YAML.load(`msh-rc show sa -v`)['results'].each do |sa|
  puts `msh-rc md-command #{sa['code']} 0 show tech-support`
end