opConfig has some features only available through the command line tool, located at <omk_dir>/bin/opconfig-cli.exe.
CLI examples
...
Information on what commands are supported is printed when no options are specified. All options support debug=true for debug output and debug=9 for verbose output.
opConfig cli has to be run as root.
Listed below are the possible options for the act=X
argument:
Discover
Tests a single given node (argument node=nodeX) and attempts to determine its Transport and Credential Set configuration. The node must already have a Personality set.
Code Block |
---|
./opconfig-cli.pl act=discover node=NAME debug=1 |
Test_connect
opconfig-cli can be used to test connections to help debug situations that don't make any sense.
An example of how it can be used:
|
...
|
The options for transport and personality are given above.
It is also possible to test an existing connection from the connections.nmis file by specifying node=node_name , if any options are specified on the command line along with the node they will override the settings loaded from the connections.nmis file.
command="some command" can also be specified to test the output of a specific command.
run_command_sets, Running commands on devices
This command will run all applicable command sets for all nodes (by default).
Options:
- nodes=node1,node2,etc -- only command sets that apply to the specified nodes will be run.
- names=command_set1,command_set2,etc – only run the specified command sets (and of course only for nodes matching the command sets' criteria)
- tags=tag1,tag2,etc – The candidate commands are filtered by the tags specified. If one or more tags given on the command line is present in the list of a command's tags, then the command will be run.
Code Block |
---|
./opconfig-cli.pl act=run_command_sets node= |
...
NODE_NAME debug=9 names=Check_Disk_Usage_home |
...
get_command_output, Get the last output from a command for a node
Requries node=node
...
_name command="command name" and returns output collected from the last run of this command
Code Block |
---|
./opconfig-cli.pl act= |
...
get_command_ |
...
output node= |
...
NODE_NAME |
find_command_
...
revisions, Get the revisions of a command
Code Block |
---|
./opconfig-cli.pl act=find_command_revisions node= |
...
NODENAME |
diff_command_outputs, Diff two revisions
Shows the diff from the output of 2 revisions of stored output (does not run them, only queries). The command line would look similar to get_command_output with the edition of revision_1= and revision_2=
Code Block |
---|
./opconfig-cli.pl act=diff_command_outputs node= |
...
NODENAME command="disk usage /home" revision_1=2 revision_2=3 |
purge options
Code Block |
---|
./opconfig-cli.pl act=purge_revisions node= |
...
NODE_NAME debug=9 |
...
./opconfig-cli.pl act=purge_indices |
Config sets
Code Block |
---|
./opconfig-cli. |
...
pl act= |
...
list_configsets ./opconfig-cli. |
...
pl act=import_ |
...
configset file=/tmp/ |
...
configset_test1.json ./opconfig-cli.pl act= |
...
export_configset name=test1 ./opconfig-cli.pl act= |
...
disable_configset name=test1 ./opconfig-cli.pl act= |
...
enable_configset name=test1 revision=1 ./opconfig-cli.pl act= |
...
push_ |
...
configset name= |
...
test1 node=deb-n-burn |
...
Queue
Code Block |
---|
./opconfig-cli.pl act=list |
...
_queue with_ids=1 ./opconfig-cli.pl act=remove_queued id=5e42a04b2b181345a5069093 |
list_policies, import
...
_policy, export_policy; update_config_status, export_config_status and check_compliance
These operations are documented on the separate page about Compliance Management.
Code Block |
---|
./opconfig-cli. |
...
pl act=export_ |
...
policy name=cisco file=/tmp/policies2.txt ./opconfig-cli. |
...
pl act= |
...
import_ |
...
policy name=cisco file=/tmp/policies2.txt ./opconfig-cli.pl act= |
...
list_policies ./opconfig-cli.pl act= |
...
export_config_status node=NODENAME file=/tmp/configstatus.txt ./opconfig-cli.pl act= |
...
update_ |
...
config_status node=NODENAME force=1 ./opconfig-cli.pl act= |
...
check_compliance name=cisco node=NODENAME debug=1 |