opConfig API Description
Below are the parts of the perl level api that an opconfig plugin can make use of.
Note that it is also possible to make use of the OMK::Common api.
Module OMK::opConfig;
Publicly available opConfig methods.
list_policies()
Get compliance policies.
returns: A hash reference of policy+version and their meta info, or undef.
Logs warnings in case of errors.
get_node_names()
Returns known node names.
args:
only_first (optional, N nodes from set are considered).
limit_groups (optional, list of group names the node must belong to).
only_activated (optional, if given only license/activated nodes are returned).
all other args: are passed through to db
returns: List of matching nodes.
get_node()
Finds node record for given node.
args:
node (=name) or ip (=address), or other search/selection arguments
only_activated (optional, default is 0),
returns: hashref or undef
get_node_name()
args:
lookup (= ip address or hostname or node name, matched against _id)
optional: only_active_for (=appkey to check, ignores nodes not activated for that app)
returns: the node name attribute (called 'node' in the ip db), or the lookup if nothing works
get_node_addresses()
args: node (name)
returns: hash reference of address records (may be empty)
get_command_names()
Queries the db for the known command names, optionally restricted to those
for a single node.
args: node (optional, but note that without node this is VERY slow)
returns: list of known command names (may be empty)
get_command_revisions()
Finds revision numbers for given node + command combo.
args: node and command (both required)
returns: sorted array of revisions (highest first)
get_command_output()
This method queries the db for a single command revision and either returns
the raw command output, or detects and marks up changes as well. this does NOT use
the command/command diff objects.
args:
node, command, revision (revision is optional), or id,
highlight_changes (defaults to undef/off, inline, removed, added),
fields_hash (optional, ignored if highlight_changes is given;
if hashref then only these properties are retrieved)
returns:
undef if nonexistent, or hash ref
hash ref has key error if the operation failed, otherwise it's the requested
command output, possibly augmented with detect-change attrib.
get_ops_status()
Retrieves the ops status for a single node.
args: node (required), time_start and time_end (optional), limit (optional)
returns: hashref, keys ok,error, values are arrays of matching entries,
ordered by time (descending)