Skip to content

Commit

Permalink
Merge pull request #392 from Juniper/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
gvarao authored Sep 23, 2020
2 parents 546c52b + 225e2e3 commit 9c30213
Show file tree
Hide file tree
Showing 10 changed files with 609 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
CiscoNexusEnvironmentFanTable:
command: show environment fan
key: FAN
platform: cisco_nxos
use_textfsm: True
view: CiscoNexusEnvironmentFanView

CiscoNexusEnvironmentFanView:
fields:
status: FAN_STATUS
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
CiscoNexusEnvironmentTemperatureTable:
command: show environment temperature
key:
- MODULE
- SENSOR
platform: cisco_nxos
use_textfsm: True
view: CiscoNexusEnvironmentTemperatureView

CiscoNexusEnvironmentTemperatureView:
fields:
major-threshold: MAJOR_THRESHOLD
minor-threshold: MINOR_THRESHOLD
temperature: CURRENT_VALUE
status: STATUS
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
CiscoNexusInterfaceTable:
command: show interface
key: INTERFACE
platform: cisco_nxos
use_textfsm: True
view: NexusInterfaceView

CiscoNexusInterfaceView:
fields:
interface-name: INTERFACE
admin-status: ADMIN_STATE
link-status: LINK_STATUS
in-errors: INPUT_ERRORS
in-packets: INPUT_PACKETS
out-errors: OUTPUT_ERRORS
out-packets: OUTPUT_PACKETS
63 changes: 63 additions & 0 deletions community_supplied/VendorSpecific/Cisco/Nexus/check-nexus-fan.rule
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Monitors chassis fan health status and notifies when anomalies are found.
*/
healthbot {
topic chassis.statistics {
rule check-nexus-fan {
keys fan-name;
synopsis "Chassis environment analyzer\"";
description "Monitors the chassis fan status and notifies anomalies";
sensor environment {
iAgent {
file CiscoNexusEnvironmentFanTable.yml;
table CiscoNexusEnvironmentFanTable;
frequency 3m;
}
}
field fan-name {
sensor environment {
path FAN;
}
type string;
description "Fan module name";
}
field fan-status {
sensor environment {
path status;
}
type string;
description "Fan running status";
}
trigger fan-status {
frequency 1o;
term is-fan-ok {
when {
matches-with "$fan-status" Ok;
}
then {
status {
color green;
message "Fan($fan-name) status is $fan-status";
}
}
}
term fan-status-nok {
then {
status {
color red;
message "Fan($fan-name) status is $fan-status";
}
}
}
}
rule-properties {
supported-devices {
other-vendor cisco {
vendor-name cisco;
operating-system nexus;
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
/*
* Monitors interface link status and also detects interface errors and
* notifies when anomalies are found.
*
* Two input control detection
*
* 1) input-interface, is a regular expression that matches the
* interfaces that you would like to monitor. By default it '.*',
* which matches all interfaces. Use something like 'ge.*' to
* match only gigabit ethernet interfaces.
*
* 2) error-threshold, is the threshold that causes the rule to report
* an anomaly. By default it's 1. This rule will set a dashboard
* color to red when *all* the error increases are greater than
* 'errors-threshold' for 9m. If it sees any errors increase for a
* period of less than 9m, it'll turn the color to yellow,
* otherwise color is set to green.
*/
healthbot {
topic interface.statistics {
rule check-nexus-interface-stats {
keys interface-name;
synopsis "Interface statistics analyzer";
description "Monitors and notify interface statistics i.e. link state, input errors and output errors";
sensor interface {
iAgent {
file CiscoNexusInterfaceTable.yml;
table CiscoNexusInterfaceTable;
frequency 3m;
}
}
field admin-status {
sensor interface {
path admin-status;
}
type string;
description "Interface admin status";
}
field error-threshold {
constant {
value "{{error-threshold}}";
}
type integer;
description "Interface error threshold";
}
field in-errors {
sensor interface {
path in-errors;
data-if-missing {
value 0;
}
}
type integer;
description "Interface input errors";
}
field in-packets {
sensor interface {
path in-packets;
data-if-missing {
value 0;
}
}
type integer;
description "Interface input packets";
}
field interface-name {
sensor interface {
where "admin-status =~ /up/";
where "interface-name =~ /{{input-interface}}/";
path interface-name;
}
type string;
description "Interface name";
}
field link-status {
sensor interface {
path link-status;
}
type string;
description "Interface link status";
}
field out-errors {
sensor interface {
path out-errors;
data-if-missing {
value 0;
}
}
type integer;
description "Interface output errors";
}
field out-packets {
sensor interface {
path out-packets;
data-if-missing {
value 0;
}
}
type integer;
description "Interface output packets";
}
trigger in-errors {
frequency 1o;
term is-error-count-increasing {
when {
increasing-at-least-by-value "$in-errors" {
value "$error-threshold";
time-range 3o;
}
}
then {
status {
color red;
message "In-error count $in-errors continuously increasing on $interface-name";
}
}
}
term is-error-count-intermittent {
when {
increasing-at-least-by-value "$in-errors" {
value "$error-threshold";
time-range 3m;
any;
}
}
then {
status {
color yellow;
message "In-error count $in-errors is intermittent on $interface-name";
}
}
}
term no-errors {
then {
status {
color green;
message "In-error count $in-errors is normal on $interface-name";
}
}
}
}
trigger interface-status {
frequency 1o;
term is-interface-up {
when {
matches-with "$link-status" up;
}
then {
status {
color green;
message "$interface-name link status is $link-status";
}
}
}
term interface-down {
then {
status {
color red;
message "$interface-name link status is $link-status";
}
}
}
}
trigger out-errors {
frequency 1o;
term is-error-count-increasing {
when {
increasing-at-least-by-value "$out-errors" {
value "$error-threshold";
time-range 3o;
}
}
then {
status {
color red;
message "Out-error count $out-errors continuously increasing on $interface-name";
}
}
}
term is-error-count-intermittent {
when {
increasing-at-least-by-value "$out-errors" {
value "$error-threshold";
}
}
then {
status {
color yellow;
message "Out-error count $out-errors is intermittent on $interface-name";
}
}
}
term no-errors {
then {
status {
color green;
message "Out-error count $out-errors is normal on $interface-name";
}
}
}
}
variable error-threshold {
value 1;
description "Static error threshold value for input and output errors";
type int;
}
variable input-interface {
value .*;
description "Enter interface name in regex i.e. ge-.*";
type string;
}
rule-properties {
supported-devices {
other-vendor cisco {
vendor-name cisco;
operating-system nexus;
}
}
}
}
}
}
Loading

0 comments on commit 9c30213

Please sign in to comment.