-
Notifications
You must be signed in to change notification settings - Fork 20
Healthbot CLI
This is currently not supported. So, FYI only:
Healthbot uses MGD (management daemon)
So you can use commit
, compare
, rollback
, set
, delete
, show xxx | display xml
....
The data model is Healthbot specific. It is described in YANG.
This demo will monitor BGP sessions state using SNMP.
we will use Healthbot CLI to:
- create devices
- create a topic and a rule
- create a playbook
- create a device group
- instantiate the playbook
- commit the configuration
ssh to healthbot and start a shell session in the MGD container
$ docker ps | grep mgd
$ docker exec -it <container_id> bash
Example with container_id b0841c08522a
$ docker exec -it b0841c08522a bash
start cli
root@b0841c08522a:/# cli
run this command to get the configuration from postgres.
This will load the configuration from postgres to MGD
root@b0841c08522a> request iceberg load
edit candidate configuration
root@b0841c08522a> edit
copy and paste these lines to create the devices vMX3
and vMX4
set iceberg device vMX3 host 100.123.1.2
set iceberg device vMX3 system-id vMX3
set iceberg device vMX3 open-config port 32768
set iceberg device vMX3 iAgent port 830
set iceberg device vMX3 authentication password username jcluser
set iceberg device vMX3 authentication password password Juniper!1
set iceberg device vMX4 host 100.123.1.3
set iceberg device vMX4 system-id vMX4
set iceberg device vMX4 open-config port 32768
set iceberg device vMX4 iAgent port 830
set iceberg device vMX4 authentication password username jcluser
set iceberg device vMX4 authentication password password Juniper!1
copy and paste these lines to add the rule check-bgp-state-using-snmp
to the topic bgp
- the rule
check-bgp-state-using-snmp
uses SNMP to monitor bgp sessions state. -
bgpPeerRemoteAddr
is used as index in the healthbot database.
set iceberg topic bgp rule check-bgp-state-using-snmp keys bgpPeerRemoteAddr
set iceberg topic bgp rule check-bgp-state-using-snmp sensor bgpPeerTable snmp table 1.3.6.1.2.1.15.3
set iceberg topic bgp rule check-bgp-state-using-snmp sensor bgpPeerTable snmp frequency 15s
set iceberg topic bgp rule check-bgp-state-using-snmp field bgpPeerRemoteAddr sensor bgpPeerTable path bgpPeerRemoteAddr
set iceberg topic bgp rule check-bgp-state-using-snmp field bgpPeerRemoteAddr type string
set iceberg topic bgp rule check-bgp-state-using-snmp field bgpPeerRemoteAddr description bgpPeerRemoteAddr
set iceberg topic bgp rule check-bgp-state-using-snmp field bgpPeerState sensor bgpPeerTable path bgpPeerState
set iceberg topic bgp rule check-bgp-state-using-snmp field bgpPeerState type integer
set iceberg topic bgp rule check-bgp-state-using-snmp field bgpPeerState description bgpPeerState
set iceberg topic bgp rule check-bgp-state-using-snmp trigger state frequency 30s
set iceberg topic bgp rule check-bgp-state-using-snmp trigger state term session_is_established when equal-to "$bgpPeerState" 6
set iceberg topic bgp rule check-bgp-state-using-snmp trigger state term session_is_established then status color green
set iceberg topic bgp rule check-bgp-state-using-snmp trigger state term session_is_established then status message "BGP neighbor $bgpPeerRemoteAddr is in ESTABLISHED state"
set iceberg topic bgp rule check-bgp-state-using-snmp trigger state term session_is_not_established then status color red
set iceberg topic bgp rule check-bgp-state-using-snmp trigger state term session_is_not_established then status message "BGP neighbor $bgpPeerRemoteAddr is NOT in ESTABLISHED state"
copy and paste these lines to add the playbook bgp-using-snmp
- the playbook
bgp-using-snmp
uses the rulecheck-bgp-state-using-snmp
from the topicbgp
set iceberg playbook bgp-using-snmp rules bgp/check-bgp-state-using-snmp
set iceberg playbook bgp-using-snmp description "playbook to monitor bgp using snmp"
set iceberg playbook bgp-using-snmp synopsis "playbook to monitor bgp using snmp"
copy and paste these lines to add the group Group2
- this will create the
Group2
with the devicesvMX3
andvMX4
- This will also instanciate the playbook
bgp-using-snmp
for this group.
set iceberg device-group Group2 description Group2
set iceberg device-group Group2 devices vMX3
set iceberg device-group Group2 devices vMX4
set iceberg device-group Group2 playbooks bgp-using-snmp
set iceberg device-group Group2 variable bgp_using_snmp_intance_1 bgp-using-snmp bgp/check-bgp-state-using-snmp
compare the candidate configuration with the running configuration
root@b0841c08522a# show | compare
[edit iceberg]
+ topic bgp {
+ rule check-bgp-state-using-snmp {
+ keys bgpPeerRemoteAddr;
+ sensor bgpPeerTable {
+ snmp {
+ table 1.3.6.1.2.1.15.3;
+ frequency 15s;
+ }
+ }
+ field bgpPeerRemoteAddr {
+ sensor bgpPeerTable {
+ path bgpPeerRemoteAddr;
+ }
+ type string;
+ description bgpPeerRemoteAddr;
+ }
+ field bgpPeerState {
+ sensor bgpPeerTable {
+ path bgpPeerState;
+ }
+ type integer;
+ description bgpPeerState;
+ }
+ trigger state {
+ frequency 30s;
+ term session_is_established {
+ when {
+ equal-to "$bgpPeerState" 6;
+ }
+ then {
+ status {
+ color green;
+ message "BGP neighbor $bgpPeerRemoteAddr is in ESTABLISHED state";
+ }
+ }
+ }
+ term session_is_not_established {
+ then {
+ status {
+ color red;
+ message "BGP neighbor $bgpPeerRemoteAddr is NOT in ESTABLISHED state";
+ }
+ }
+ }
+ }
+ }
+ }
[edit iceberg]
+ playbook bgp-using-snmp {
+ rules bgp/check-bgp-state-using-snmp;
+ description "playbook to monitor bgp using snmp";
+ synopsis "playbook to monitor bgp using snmp";
+ }
[edit iceberg]
+ device vMX3 {
+ host 10.49.102.151;
+ system-id vMX3;
+ open-config {
+ port 32768;
+ }
+ iAgent {
+ port 830;
+ }
+ authentication {
+ password {
+ username root;
+ password Embe1mpls;
+ }
+ }
+ }
+ device vMX4 {
+ host 10.49.102.148;
+ system-id vMX4;
+ open-config {
+ port 32768;
+ }
+ iAgent {
+ port 830;
+ }
+ authentication {
+ password {
+ username root;
+ password Embe1mpls;
+ }
+ }
+ }
+ device-group Group2 {
+ description Group2;
+ devices [ vMX3 vMX4 ];
+ playbooks bgp-using-snmp;
+ variable bgp_using_snmp_intance_1 bgp-using-snmp bgp/check-bgp-state-using-snmp;
+ }
[edit]
root@b0841c08522a#
commit the candidate configuration
root@b0841c08522a# commit and-quit
display device vMX3
configuration in text format
root@b0841c08522a> show configuration iceberg device vMX3
host 10.49.102.151;
system-id vMX3;
open-config {
port 32768;
}
iAgent {
port 830;
}
authentication {
password {
username root;
password Embe1mpls;
}
}
Committing the configuration into mgd database does not store the config in postgres.
Run this command to read the configuration from mgd and commit it to postgres. So, this will deploy the change from mgd to heathbot
root@b0841c08522a> request iceberg deploy
Visit the healthbot GUI
Dashboard:
Health of vMX3:
Health of vMX4: