...
Code Block |
---|
package ReportConditions; our $VERSION = "0.0.0"; use strict; sub process_configuration { my (%args) = @_; my ($node, $node_info, $command, $configuration_data, $derived, $alerts, $conditions, $logger, $opconfig) = @args{qw(node node_info command configuration_data derived_info alerts conditions logger opconfig)}; # ...insert logic that looks at context of command, configuration_data, node etc # to determine what conditions and states these imply return { success => 1, conditions => { "ReportConditions" => { "node is lacking something" => 0, "command implies something is in good shape" => 1, "something unexpectedly couldn't be analysed" => undef, }, }, }; } 1; |
New Report Condition Elements in opConfig 4.2.1
Showing Urls
Code Block | ||
---|---|---|
| ||
push(@foundConditions, {
message=> "Interface $interface has HIGH percentage of INPUT packets being switched by the processor.",
url => "http://example.com/knowlege",
url_label => "Knowledge Base",
condition => 1,
}); |
Tooltips
Code Block | ||
---|---|---|
| ||
push(@foundConditions, {
message=>"Interface $interface has HIGH percentage of OUTPUT packets being switched by the processor.",
tooltip => "This is a bad thing, you should release the monkeys",
condition => 0,
}); |
Tagging
Code Block | ||
---|---|---|
| ||
push(@foundConditions,{
message=>"Interface $interface has HIGH percentage of input errors.",
ts_tag=>'interface_errors',
condition => 1
}); |
How to use a plugin to prepare derived information (or knowledge) for opConfig
...
Code Block |
---|
package DerivedInfo; our $VERSION = "0.0.0"; use strict; sub process_configuration { my (%args) = @_; my ($node, $node_info, $command, $configuration_data, $derived, $alerts, $conditions, $logger, $opconfig) = @args{qw(node node_info command configuration_data derived_info alerts conditions logger opconfig)}; # ...insert logic that derives knowledge from the context return { success => 1, derived_info => { some_reportable_thing => { type => "table", title => "Reported by ".__PACKAGE__, labels => [ 'one col', 'another col', ], rows => [ [ 'maybe key', 'maybe value', ], [ 'maybe key2', 'maybe value', ], [ 'last row', 'last value', ], ], }, my_filtered_table => { type => 'table', labels => [ 'first col', 'second', undef, 'and at long last' ], rows => [ [ 'note that', 'there is', 'a gap', 'something that you were not meant to see' ], [ 1, 2, 3, 4, ], ], }, ours_but_not_displayed => { doesnt_display => "whatever", stored => [ 4, 7, 29 ], deep_is_ok => { other => { thing => [ 1..10 ], } }, }, }, }; } 1; |
opConfig
Plugin Input Argument Structures
...