Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

Influxdb troubleshooting using CLI

Khelil Sator edited this page Feb 10, 2019 · 1 revision

influxdb is an open source time series database written in GO.

Healthbot uses influxdb (docker container)
The data collected by Healthbot from network devices is stored in Influxdb

In the below demo, we will use Python to configure healthbot. It will collect data from the network and save the data collected in Influxdb. We will then use Influxdb CLI to query the database (this can be useful for troubleshooting purpose).

Configure healthbot to collect some data from network devices

  • edit the file python_input.yml to indicate healtbot ip address and credentials
$ vi  python_input.yml
  • Run this command to configure healthbot with the details described in the file python_input.yml
$ python ./configure_healthbot.py
  • so, healthbot is now configured with
    • devices vMX1 to vMX7
    • The rule check-bgp-state-using-netconf.
      • This rule uses an iagent sensor with the table and view bgp_sessions_state.yml
    • The rule check-bgp-state-using-snmp.
      • This rule uses an SNMP sensor.
    • The playbook bgp-using-netconf
      • This playbook uses the rule check-bgp-state-using-netconf
    • The playbook bgp-using-snmp
      • This playbook uses the rule check-bgp-state-using-snmp
    • The device group Group1 is configured with
      • devices vMX1 to vMX7
      • an instance of the playbook bgp-using-netconf
    • The device group Group2 is configured with
      • devices vMX3 and vMX4
      • an instance of the playbook bgp-using-snmp

Start a shell session in influxdb container

ssh to healthbot and run this command

$ docker ps | grep influxdb

Start a shell session in influxdb container

$ docker exec -it <container-id> bash

Example with the container_id b8897cfb9d8c

$ docker exec -it b8897cfb9d8c bash

influxdb CLI demo

Run the command influx

bash-4.3# influx
Connected to http://localhost:8086 version 1.5.2
InfluxDB shell version: 1.5.2
>

To list the databases, run this command.

> show databases
name: databases
name
----
_internal
Group1_vMX1
Group1_vMX2
Group1_vMX3
Group1_vMX4
Group1_vMX5
Group1_vMX6
Group1_vMX7
Group2_vMX3
Group2_vMX4
>

There is one database per device group/device pair.
To use the database related to the group Group1 and device vMX1, run this command

> use Group1_vMX1
Using database Group1_vMX1

Run this command to list measurements.

> show measurements
name: measurements
name
----
bgp/check-bgp-state-using-netconf
bgp/check-bgp-state-using-netconf/neighborship
>

bgp is a healthbot topic.
check-bgp-state-using-netconf is a healthbot rule.
neighborship is a trigger for the rule check-bgp-state-using-netconf

> select * from "bgp/check-bgp-state-using-netconf" order by desc limit 10
name: bgp/check-bgp-state-using-netconf
time                _instance-id                    _playbook-name    hostname    peer-address     state
----                ------------                    --------------    --------    ------------     -----
1542901602831757820 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.104+53942 Established
1542901602831757820 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.103+55504 Established
1542901602831757820 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.102+51849 Established
1542901585784530703 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.104+53942 Established
1542901585784530703 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.103+55504 Established
1542901585784530703 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.102+51849 Established
1542901569842932986 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.104+53942 Established
1542901569842932986 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.103+55504 Established
1542901569842932986 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.102+51849 Established
1542901553802708433 ["bgp_using_netconf_intance_1"] bgp-using-netconf 100.123.1.0 11.0.0.104+53942 Established
>

> select * from "bgp/check-bgp-state-using-netconf/neighborship" order by desc limit 10
name: bgp/check-bgp-state-using-netconf/neighborship
time                _instance-id                    _playbook-name    color hostname    message                                               peer-address     session_is_established_when_1 state
----                ------------                    --------------    ----- --------    -------                                               ------------     ----------------------------- -----
1542901645000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.104+53942 is in Established state 11.0.0.104+53942 true                          Established
1542901645000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.103+55504 is in Established state 11.0.0.103+55504 true                          Established
1542901645000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.102+51849 is in Established state 11.0.0.102+51849 true                          Established
1542901615000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.104+53942 is in Established state 11.0.0.104+53942 true                          Established
1542901615000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.103+55504 is in Established state 11.0.0.103+55504 true                          Established
1542901615000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.102+51849 is in Established state 11.0.0.102+51849 true                          Established
1542901585000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.104+53942 is in Established state 11.0.0.104+53942 true                          Established
1542901585000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.103+55504 is in Established state 11.0.0.103+55504 true                          Established
1542901585000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.102+51849 is in Established state 11.0.0.102+51849 true                          Established
1542901555000000000 ["bgp_using_netconf_intance_1"] bgp-using-netconf green 100.123.1.0 BGP neighbor 11.0.0.104+53942 is in Established state 11.0.0.104+53942 true                          Established
>

> use Group2_vMX3
Using database Group2_vMX3
> show measurements
name: measurements
name
----
bgp/check-bgp-state-using-snmp
bgp/check-bgp-state-using-snmp/state
>

bgp is a healthbot topic.
check-bgp-state-using-snmp is a healthbot rule.
state is a trigger for the rule check-bgp-state-using-snmp

> select * from "bgp/check-bgp-state-using-snmp" order by desc limit 6
name: bgp/check-bgp-state-using-snmp
time                _instance-id                 _playbook-name agent_host  bgpPeerRemoteAddr bgpPeerState host         index
----                ------------                 -------------- ----------  ----------------- ------------ ----         -----
1542901780000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.104        6            f82c006a29a1 11.0.0.104
1542901780000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.102        6            f82c006a29a1 11.0.0.102
1542901780000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.101        6            f82c006a29a1 11.0.0.101
1542901765000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.104        6            f82c006a29a1 11.0.0.104
1542901765000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.102        6            f82c006a29a1 11.0.0.102
1542901765000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.101        6            f82c006a29a1 11.0.0.101
>
> select * from "bgp/check-bgp-state-using-snmp/state" order by desc limit 6
name: bgp/check-bgp-state-using-snmp/state
time                _instance-id                 _playbook-name agent_host  bgpPeerRemoteAddr bgpPeerState color host         index      message                                         session_is_established_when_1
----                ------------                 -------------- ----------  ----------------- ------------ ----- ----         -----      -------                                         -----------------------------
1542901803000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.104        6            green f82c006a29a1 11.0.0.104 BGP neighbor 11.0.0.104 is in ESTABLISHED state true
1542901803000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.102        6            green f82c006a29a1 11.0.0.102 BGP neighbor 11.0.0.102 is in ESTABLISHED state true
1542901803000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.101        6            green f82c006a29a1 11.0.0.101 BGP neighbor 11.0.0.101 is in ESTABLISHED state true
1542901773000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.104        6            green f82c006a29a1 11.0.0.104 BGP neighbor 11.0.0.104 is in ESTABLISHED state true
1542901773000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.102        6            green f82c006a29a1 11.0.0.102 BGP neighbor 11.0.0.102 is in ESTABLISHED state true
1542901773000000000 ["bgp_using_snmp_intance_1"] bgp-using-snmp 100.123.1.2 11.0.0.101        6            green f82c006a29a1 11.0.0.101 BGP neighbor 11.0.0.101 is in ESTABLISHED state true
>


Clone this wiki locally