...
Code Block |
---|
%hash = ( 'DF_Test' => { 'os_info' => { 'os' => '/(Linux|CentOS|Ubuntu)/' }, 'scheduling_info' => { 'run_commands_on_separate_connection' => 'false', }, 'commands' => [ { 'privileged' => 'false', 'command' => 'df', 'exec' => 'df', 'tags' => ['Linux','DF','operations'], }, ], }, ); |
Defining which nodes a command set applies to
This is normally done by filtering by OS info, but not necessarily limited to OS info only:
Code Block |
---|
#filter using both regular expression and string equality checks:
'os_info' => {
'version' => '/12.2|12.4|15.0/',
'os' => 'IOS'
},
# or just the specific os family/type and that's all:
'os_info' => {
'os' => '/(Linux|CentOS|Ubuntu)/'
}, |
The examples above specify that the node in question must have an os_info property set, with sub-properties os and version in the first example and just os in the second.
Plain string values indicate string comparison, but regular expressions can be given too. A node is only considered for this particular command set if all filtering expressions match. You can filter on any node property, not just properties from os_info (but the default command sets only use os_info).
Prior to version 3.1.1, opConfig considered command sets without filter blocks as disabled; for these versions you may want a 'wildcard' filter matching anything whatsoever, which can be achieved by adding an os_info
filter block with a 'match-everything' regular expression for os,
e.g 'os' => '/.*/'
.
From opConfig 3.1.1 onwards a command set without filter is interpreted as to apply to all nodes without any restriction.
Quick Actions
Quick actions are templates for new Virtual Operator jobs, we have shipped four sample jobs but you can create your own. Clicking the quick action button will take you too a new virtual operator screen and fill out the specified fields. The default four jobs are defined in the file: /usr/local/omk/lib/json/opConfig/table_schemas/opConfig_action-elements.json
...
name | string | Name which is shown at the top of the quick action element |
description | string | Text shown under the quick action name, useful to describe what the action does |
command_sets | array of strings | Command set keys which you wish to be run |
nodes | array of strings | Names of nodes which you wish the command sets to be run against |
buttonLabel | string | Text of the run button |
buttonClass | string | Css class applied to the button to colour it.
|
Here is an excerpt from the default command set that ships with opConfig:
...
'IOS_HOURLY'
=> {
'os_info'
=> {
'version'
=>
'/12.2|12.4|15.\d+/'
,
'os'
=>
'IOS'
},
'purging_policy'
=> {
'keep_last'
=> 1000,
'purge_older_than'
=> 2592000,
# 30 days
'autoprotect_first_revision'
=>
'true'
,
},
'scheduling_info'
=> {
'run_commands_on_separate_connection'
=>
'false'
,
},
'commands'
=> [
{
'multipage'
=>
'true'
,
'privileged'
=>
'false'
,
'command'
=>
'show interfaces'
,
'tags'
=> [
'HOURLY'
,
'performance'
,
'interfaces'
],
},
{
'multipage'
=>
'true'
,
'privileged'
=>
'false'
,
'command'
=>
'show ip interface'
,
'tags'
=> [
'HOURLY'
,
'detect-change'
,
'configuration'
],
},
... and lots more
Defining which nodes a command set applies to
This is normally done by filtering by OS info, but not necssarily limited to OS info only:
...
#filter using both regular expression and string equality checks:
'os_info'
=> {
'version'
=>
'/12.2|12.4|15.0/'
,
'os'
=>
'IOS'
},
# or just the specific os family/type and that's all:
'os_info'
=> {
'os'
=>
'/(Linux|CentOS|Ubuntu)/'
},
The examples above specify that the node in question must have an os_info property set, with sub-properties os and version in the first example and just os in the second.
Plain string values indicate string comparison, but regular expressions can be given too. A node is only considered for this particular command set if all filtering expressions match. You can filter on any node property, not just properties from os_info (but the default command sets only use os_info).
Prior to version 3.1.1, opConfig considered command sets without filter blocks as disabled; for these versions you may want a 'wildcard' filter matching anything whatsoever, which can be achieved by adding an os_info
filter block with a 'match-everything' regular expression for os,
e.g 'os' => '/.*/'
.
From opConfig 3.1.1 onwards a command set without filter is interpreted as to apply to all nodes without any restriction.
...
By default opConfig stores all command outputs in its MongoDB database, and only there.
In recent versions two new options let you fine-tune the behaviour and make use of on-disk storage where desired:
...