The end of life (EOL) date for this module is on 31 January, 2020.
CommandSets
What are CommandSets?
Many items in Gateway2 have commands associated with them. These allow for a myriad of actions to be performed, from accepting FKM triggers or SNMP traps to snoozing problematic items.
The first step in using commands with the Open Access API is to find out what commands are available on a given item.
In this example, we will find out what commands are available on our gateway. In the Active Console, you would right click on the Gateway icon as below:
The equivalent operation in the API is to submit a CommandSetQuery, passing in the XPath identifying the gateway:
This example will list all the commands it is possible to execute on gateways.
Note: If you are not seeing any commands or some are missing, see the advice in No commands are being returned from the API. How can I debug this?.
The code is included with the open access client which you can get from the Downloads Page.
CommandSet Example
The CommandSet returned contains all the commands that can be executed against the gateway itself. Different commands will be available against entities, views and other data items.
You should see output similar to below:
INFO: /SNOOZE:manual - Snooze until manually unsnoozed
Arguments:
User comment - STRING - User comment
Grouping: [Snooze, Manual]
/SNOOZE:severityTo - Snooze until severity changes to...
Arguments:
User comment - STRING - User comment
Target Severity - STRING - Target Severity - Choices: [1 2 3 0 ]
Grouping: [Snooze, Until Severity Changes to]
/SNOOZE:untilChanges - Snooze until severity changes
Arguments:
User comment - STRING - User comment
Grouping: [Snooze, Until Severity Changes]
/SNOOZE:time - Snooze for a specified time period
Arguments:
User comment - STRING - User comment
arg4 - STRING - - Choices: [3600 60 86400 ]
Duration - FLOAT - Duration
Grouping: [Snooze, For Time Period]
/SNOOZE:dateTime - Snooze until a specified time
Arguments:
User comment - STRING - User comment
Time - STRING - Time
Date (optional) - STRING - Date (optional)
Grouping: [Snooze, Until Date / Time]
/SNOOZE:severityToOrTime - Snooze until severity changes to.. OR time period expires
Arguments:
User comment - STRING - User comment
Duration - FLOAT - Duration
arg6 - STRING - - Choices: [3600 60 86400 ]
Target Severity - STRING - Target Severity - Choices: [1 2 3 0 ]
Grouping: [Snooze, Until Severity Change OR Time]
/SNOOZE:unsnoozeAbsentItems - Unsnooze absent items
Arguments:
Are you sure? This will unsnooze all missing but snoozed items on the gateway. - BOOLEAN - Are you sure? This will unsnooze all missing but snoozed items on the gateway.
Grouping: [Snooze, Unsnooze Absent Items]
/USERASSIGNMENT:assignToMe - Assign DataItem to a user
Arguments:
User comment - STRING - User comment
Grouping: [User Assignment, Assign To Me]
/USERASSIGNMENT:assign - Assign DataItem to a user
Arguments:
User comment - STRING - User comment
User - STRING - User
Grouping: [User Assignment, Assign]
/USERASSIGNMENT:assignUntilOk - Assign DataItem to a user until severity goes OK
Arguments:
User comment - STRING - User comment
User - STRING - User
Grouping: [User Assignment, Assign Until OK]
/USERASSIGNMENT::assignUntilSeverityChangesTo - Assign DataItem to a user until severity changes to a target severity
Arguments:
User comment - STRING - User comment
User - STRING - User
Target Severity - STRING - Target Severity - Choices: [1 2 3 0 ]
Grouping: [User Assignment, Assign Until Severity Changes To]
/USERASSIGNMENT::assignUntilSeverityChangesFrom - Assign DataItem to a user until severity changes from the current
Arguments:
User comment - STRING - User comment
User - STRING - User
Grouping: [User Assignment, Assign Until Severity Changes]
/USERASSIGNMENT::assignForTimePeriod - Assign DataItem to a user until time period expires
Arguments:
User comment - STRING - User comment
User - STRING - User
arg4 - STRING - - Choices: [3600 60 86400 ]
Duration - FLOAT - Duration
Grouping: [User Assignment, Assign For Time Period]
/USERASSIGNMENT::assignUntilDateTime - Assign DataItem to a user until a date / time
Arguments:
User comment - STRING - User comment
User - STRING - User
Time - STRING - Time
Date (optional) - STRING - Date (optional)
Grouping: [User Assignment, Assign Until Date / Time]
/USERASSIGNMENT::assignUntilSeverityChangeOrTimePeriod - Assign DataItem to a user until severity changes to a target severity or time period expires
Arguments:
arg5 - STRING - - Choices: [3600 60 86400 ]
User comment - STRING - User comment
User - STRING - User
Duration - FLOAT - Duration
Target Severity - STRING - Target Severity - Choices: [1 2 3 0 ]
Grouping: [User Assignment, Assign Until Severity Change or Time]
/USERASSIGNMENT::assignUntilValueChanges - Assign DataItem to a user until the value changes
Arguments:
User comment - STRING - User comment
User - STRING - User
Grouping: [User Assignment, Assign Until Value Changes]
/USERASSIGNMENT:unassignAbsentItems - UnAssign users
Arguments:
Are you sure? This will unassign users from missing items on the gateway. - BOOLEAN - Are you sure? This will unassign users from missing items on the gateway.
Grouping: [User Assignment, UnAssign Absent Items]
/RULES:showRules - Get information about the rules
Arguments:
Grouping: [Show Rules]
/GATEWAY:broadcastMessage - Sends a ticker event message to all users on this Gateway
Arguments:
Message - STRING - Message
Message Severity - STRING - Message Severity - Choices: [1 2 3 0 ]
Grouping: [Message Broadcaster]
/GATEWAY:reloadSetup - Reloads setup files on the Gateway
Arguments:
Setup file(s) - STRING - Setup file(s) - Choices: [ /opt/gateway2/config/gateway.setup.xml ]
Grouping: [Reload setup]
/GATEWAY:Database:suspend - Suspend database logging
Arguments:
Suspend database - BOOLEAN - Suspend database
Grouping: [Database, Suspend]
/LMSTATS:startLMStatsCollectionNow - Start Gateway Load monitoring statistics collection
Arguments:
Grouping: [Load Monitoring, Start Stats Collection, Now]
/LMSTATS:startLMStatsCollectionForTimePeriod - Start Gateway Load statistics collection for a specified time period
Arguments:
Write Stats to file after collection - BOOLEAN - Write Stats to file after collection
arg2 - STRING - - Choices: [3600 60 86400 ]
Reset Stats before collection - BOOLEAN - Reset Stats before collection
Duration - FLOAT - Duration
Reset Stats after collection - BOOLEAN - Reset Stats after collection
Grouping: [Load Monitoring, Start Stats Collection, For Time Period]
/LMSTATS:stopLMStatsCollection - Stop Gateway Load monitoring statistics collection
Arguments:
Grouping: [Load Monitoring, Stop Stats Collection]
/LMSTATS:resetLMStats - Reset the Load Monitoring statistics gathered by the gateway
Arguments:
Grouping: [Load Monitoring, Reset Stats]
/LMSTATS:writeLMStats - Write the stats gathered by the gateway to disk
Arguments:
Grouping: [Load Monitoring, Write Stats to File]
/LICENSING:licenceInfo - Get information about the licenses in use for this gateway
Arguments:
Grouping: [Licensing Information]
Each Command has a unique name, a description of what action it performs and any arguments that must be passed when executing the command.
Note: Passing in an xpath that does not specify a particular gateway will result in multiple events being received, one from each node in the cluster.
The CommandSet passed to the callback will contain the merged contents of each event received so far.