Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

jcluser@ubuntu:/var/local/healthbot/rules/juniper_official/Interfaces$ more interface-status.rule /* * Monitors interface link state and notifies when anomalies are found. * One input control detection * * 1) interface-name-variable, is a regular expression that matches the * interfaces that you would like to monitor. By default it's * '.*', which matches all interfaces. Use something like 'ge.*' to * match only gigabit ethernet interfaces. * */ iceberg { topic interface.statistics { description "Monitors and notify interface statistics i.e. link state, flaps, neighbor state, input & output traffic and errors"; synopsis "Interface statistics analyzer"; rule check-interface-status { synopsis "Tnterface state analyzer"; description "Collects interface link oper state periodically and notifies when neighbor sate is down"; /*

https://ssd-git.juniper.net/iceberg/customer-healthbot-rules/tree/master/Telefonica/2.1.0/Rules/Chassis


 topic interface.statistics
    rule check-interface-status
        keys interface-name
        sensor interfaces

       open-config
           sensor-name /interfaces/;
        field admin-state
        . . . .
        trigger link-state
        variable interface-name-variable
        rule-properties
            supported-devices
                juniper
                    operation-system junos
                    . . . . 
               other-vendor cisco-IOS-XR
                    operating-system IOS-XR



/var/local/healthbot/rules

telemetry sensor

interface-status.rule   file

Code Block
titleinterface-status
Code Block
titleinterface-status
jcluser@ubuntu:/var/local/healthbot/rules/juniper_official/Interfaces$ more interface-status.rule
/*
 * Monitors interface link state and notifies when anomalies are found.
 * One input control detection
 *
 *   1) interface-name-variable, is a regular expression that matches the
 *      interfaces that you would like to monitor.  By default it's
 *      '.*', which matches all interfaces. Use something like 'ge.*' to
 *      match only gigabit ethernet interfaces.
 *
 */
iceberg {
    topic interface.statistics {
        description "Monitors and notify interface statistics i.e. link state, flaps, neighbor state, input & output traffic and errors";
        synopsis "Interface 
*
statistics 
Monitors
analyzer";
the
 
interface
 
link
 
oper
 
state.
 
Notifies
 
via
 
the
 rule check-interface-status {
          
*
 
dashboard
 
colors
synopsis 
when
"Tnterface 
the *all* link oper state {{link-state}}
state analyzer";
            description "Collects interface link oper 
*
state 
is
periodically 
down (red). Otherwise the color
and notifies when neighbor sate is 
set
down";
to
 
green.
           
/*
             * 
Use
Monitors the interface 
name
link 
as key for rule
oper state. Notifies via the
          
*/
   * dashboard colors when the *all* link oper 
keys interface-name;
state {{link-state}}
             
/
* is down (red). Otherwise the color is set to green.
   
*
 
Sensor
 
configuration
 
to
 
get
 
data
 
from
 
network
 
devices.
  *
           
*/
  * Use interface name as key for rule.
   
sensor
  
interfaces
 
{
       */
         
synopsis
 
"Interface
 
open-config
 
sensor definition"
keys interface-name;
            /*
   
description
 
"Interfaces
 
open-config
 
sensor
 
to
 
collect
 
telemetry
 
data
 
from
 
network
 
device";
* Sensor configuration to get data from network devices.
        
open-config
 
{
    */
            sensor interfaces {
 
sensor-name
 
/interfaces/;
              synopsis "Interface open-config sensor definition";
  
frequency
 
60s;
             description "Interfaces open-config sensor 
}
to collect telemetry data from network device";
       
}
         open-config {
  
/*
              
*
 
Fields
 
defined
 
using
 sensor
path. Map the longer sensor names
-name /interfaces/;
                  
*
 
to
 
the
frequency 
shorter
60s;
field
 
names
 
used
 
in
 
the
 
rules.
           }
  
*/
          }
  
field
 
admin-state
 
{
        /*
        
sensor
 
interfaces
 
{
   * Fields defined using sensor path. Map the longer sensor names
       
path
 
/interfaces/interface/state/admin-status;
     * to the shorter field names used in the rules.
    
}
         */
       
type
 
string;
    field admin-state {
          
description
 
"Interface
 
admin
 
status";
   sensor interfaces {
       
}
             
field
path /interfaces/interface
-name {
/state/admin-status;
                }
sensor
 
interfaces
 
{
              type string;
     
where
 
"/interfaces/interface/@name
 
=~
 
/{{interface-name-variable}}/";
        description "Interface admin status";
         
path
 
"/interfaces/interface/@name";
  }
            field interface-name 
}
{
                
type
sensor 
string;
interfaces {
               
description
 
"Interfaces
 
to
 
be
 
monitored";
 where "/interfaces/interface/@name =~ /{{interface-name-variable}}/";
        
}
            
field link-state {
path "/interfaces/interface/@name";
                }
sensor
  
interfaces
 
{
             type string;
      
path
 
/interfaces/interface/state/oper-status;
         description "Interfaces to be monitored";
   
}
         }
       
type
 
string;
    field link-state {
          
description
 
"Interfaces
 
link
 
operator
 
status";
  sensor interfaces {
        
}
            path 
/*
/interfaces/interface/state/oper-status;
             
*
 
Anomaly
 
detection
 
logic.
}
             
*/
   type string;
        
trigger
 
link-state
 
{
      description "Interfaces link operator status";
       
synopsis
 
"link
 
state
 
kpi";
  }
            /*
 
description
 
"Sets
 
health
 
based
 
on
 
link
 
state";
      * Anomaly detection logic.
       
/*
      */
           
*
 
Skips
trigger 
evaluation
link-state 
for
{
admin
 
down
 
state
 
interfaces
             synopsis "link state kpi";
 
*/
               description "Sets 
frequency
health 
60s;
based on link state";
             
term
 
is-link-admin-down
 
{
 /*
                 * Skips 
when
evaluation 
{
for admin down state interfaces
                 */
  
matches-with
 
"$admin-state"
 
DOWN;
            frequency 60s;
       
}
         term is-link-admin-down {
      
}
              when {
 
/*
                   
*
 
Sets
 
color
 
to
 
red and sends out anomaly notification when
matches-with "$admin-state" DOWN;
                    }
*
 
the
 
interface
 
oper
 
state
 
($link-state)
 
is
 
down.
         }
        
*/
        /*
        
term
 
is-link-down
 
{
       * Sets color to red and sends out anomaly 
notification when
{
                 * the interface oper 
matches-with "$admin
state ($link-state
"
) 
UP;
is down.
                 */
     
matches-with
 
"$link-state"
 
DOWN;
         term is-link-down {
         
}
           when {
        
then
 
{
               matches-with "$admin-state" UP;
       
status {
                 matches-with "$link-state" DOWN;
                    }
                    then {
            
color
 
red;
           status {
                
message
 
"$interface-name
 
link
 
operator status is DOWN";
         color red;
                            message "$interface-name link operator status is DOWN";
                        }
                    }
                }
                /*
                 * Defaults color to green.
                 */
                term link-up {
                    then {
                        status {
                            color green;
                            message "$interface-name link operator status is UP";
                        }
                    }
                }
            }
            /*
             * Variables with default values. Default values can be changed
             * while deploying playbook instance.
             */
            variable interface-name-variable {
                value ".*";
                description "Interface names to monitor, regular expression, e.g. 'ge-.*'";
                type string;
            }
            rule-properties {
                version 2;
                contributor juniper;
                supported-healthbot-version 1.0.1;
                catalogue {
                    tier 1;
                }
                supported-devices {
                    juniper {
                        operating-system junos {
                            products MX {
                                releases 16.1R1 {
                                    release-support min-supported-release;
                                    platform [ MX240 MX480 MX960 MX2010 MX2020 ];
                                }
                                releases 17.3R1 {
                                    release-support min-supported-release;
                                    platform MX150;
                                }
                            }
                            products PTX {
                                releases 17.2R1 {
                                    release-support min-supported-release;
                                    platform [ PTX5000 PTX1000 PTX10000 ];
                                }
                            }
                            products QFX {
                                releases 17.2R1 {
                                    release-support min-supported-release;
                                    platform [ QFX10000 QFX5200 ];
                                }
                                releases 18.1R1 {
                                    release-support min-supported-release;
                                    platform QFX5100;
                                }
                                releases 18.3R1 {
                                    release-support min-supported-release;
                                    platform QFX5120-48Y;
                                }
                            }
                            products EX {
                                releases 17.3R1 {
                                    release-support min-supported-release;
                                    platform EX9200;
                                }
                                releases 18.3R1 {
                                    release-support min-supported-release;
                                    platform EX4650;
                                }
                                releases 18.4R1 {
                                    release-support min-supported-release;
                                    platform EX4600;
                                }
                            }
                        }
                    }
                    other-vendor cisco-IOS-XR {
                        vendor-name cisco;
                        operating-system IOS-XR;
                    }
                }
            }
        }
    }
}




SNMPhttps://github.com/Juniper/healthbot-rules/tree/5103e6af04130ac1c67c46e9031e8241bc1d707b/community_supplied/Interface



topic interface.statistics
    rule snmp-check-interface-flaps
        sensor interfaces
        snmp
        fields flaps
        fields index
        rule-properties
                juniper
                    operation-system junos
                    . . . . 

                

Code Block
titlecode1
iceberg { 
    topic interface.statistics {
        rule snmp-check-interface-flaps {
  	    
}
    description "Collects link flap count periodically";
           
}
 synopsis "Interface flaps analyzer";
            
}
keys index;
  	  
	    
/*

             
* 
Defaults
Collects 
color to green.
the link flap count on an interface 
       
*/
      * for every collected metric during a 60s time range (red).
term
 
link-up
 
{
           * Use snmp index of interface as key for rule.
then
 
{
           */
            sensor 
status
interfaces {
                    synopsis "Interface snmp sensor definition";
   
color
 
green;
                description "Interfaces snmp sensor to collect data from network device";			
  	 
message "$interface-name link operator status is UP";
 		snmp {
  	  		    table JUNIPER-IF-MIB::ifJnxTable;
                 
}
   frequency 290s;
                }
            }
  	 
}
 	    /*
       
}
      * Fields defined using sensor path. Map 
/*
the longer sensor names
          
*
 
Variables
 
with
 
default
* 
values.
to 
Default
the 
values
shorter 
can
field 
be
names 
changed
used in the rules.
          
*
 
while
 
deploying playbook instance.
*/
            field flaps 
*/
{
            
variable
 
interface-name-variable
 
{
  sensor interfaces {
            
value
 
".*";
       path ifJnxCarrierTrans;
        
description
 
"Interface
 
names
 
to
 
monitor,
 
regular
 
expression,
 
e.g. 'ge-.*'";
 }
                type 
string
integer;
            
}
    description "Number of interface flaps";
    
rule-properties
 
{
       }
         
version
 
2;
  field index {
            
contributor
 
juniper;
   sensor interfaces {
           
supported-healthbot-version
 
1.0.1;
        path index;
       
catalogue
 
{
        }
            
tier
 
1;
   type string;
            }
            rule-properties {
    
supported-devices
 
{
           version 2;
        
juniper
 
{
       contributor juniper;
                
operating
supported-healthbot-
system junos {
version 1.0.1;
                supported-devices {
           
products
 
MX
 
{
       juniper {
                        
releases 16.1R1
operating-system junos {
                            products EX {       
     
release-support
 
min-supported-release;
                          releases 17.3R1 {
        
platform
 
[
 
MX240
 
MX480
 
MX960
 
MX2010
 
MX2020
 
];
                     release-support min-supported-release;
          
}
                          platform EX9200;
     
releases
 
17.3R1
 
{
                         }
           
release-support
 
min-supported-release;
                    releases 18.3R1 {
              
platform
 
MX150;
                     release-support min-supported-release;
          
}
                          platform EX4650;
 
}
                             
products
 
PTX
 
{
}
                                releases 
17
18.
2R1
4R1 {
                                    release-support min-supported-release;
                                    platform 
[ PTX5000 PTX1000 PTX10000 ]
EX4600;
                                }
                            }
                            products 
QFX
MX {
                                releases 
17
14.
2R1
1R1 {
                                    release-support min-supported-release;
                                    platform [ 
QFX10000 QFX5200
MX2010 MX2020 MX240 MX480 MX960 ];
                                }
                                releases 
18
17.
1R1
3R1 {
                                    release-support min-supported-release;
                                    platform 
QFX5100
MX150;
                                }
                            }
   
releases
 
18.3R1
 
{
                       products PTX {
           
release-support
 
min-supported-release;
                    releases 17.2R1 
{
             
platform QFX5120-48Y;
                       
}
release-support min-supported-release;
                  
}
                  platform [ PTX1000 PTX10000 PTX5000 ];
     
products
 
EX
 
{
                         }
       
releases
 
17.3R1
 
{
                   }
                 
release-support
 
min-supported-release;
          products QFX {      
                  
platform
 
EX9200;
             releases 17.2R1 {
                 
}
                   release-support min-supported-release;
           
releases
 
18.3R1
 
{
                       platform [ QFX10000 QFX5200 ];
         
release-support
 
min-supported-release;
                      }
              
platform
 
EX4650;
                 releases 18.1R1 {
            
}
                        release-support min-supported-release;
       
releases
 
18.4R1
 
{
                           platform QFX5100;
        
release-support
 
min-supported-release;
                       }
             
platform
 
EX4600;
                  releases 18.3R1 {
            
}
                        release-support min-supported-release;
   
}
                         
}
        platform QFX5120-48Y;
           
}
                     
other-vendor cisco-IOS-XR {
}
                          
vendor-name
 
cisco;
 }
                       
operating-system IOS-XR;
 }
                    }
                }
            }
        }    
    }
}