09. How to use this repository - ksator/junos_monitoring_with_a_TIG_stack GitHub Wiki
You can use of one these differents workflows:
- make workflow (it is the easiest workflow)
- docker compose workflow
- docker workflow (it is the most difficult workflow)
make workflow
clone the repository
$ git clone https://github.com/ksator/junos_monitoring_with_a_TIG_stack.git
$ cd junos_monitoring_with_a_TIG_stack
There is a Makefile at the root of the repository.
Update devices details
$ vi data.yml
Generate the Telegraf configuration files
$ make build-telegraf-conf
$ more configs/telegraf-openconfig.conf
$ more configs/telegraf-snmp.conf
Alternatively, create yourself your own telegraf configuration files telegraf-openconfig.conf and telegraf-snmp.conf
Create and start containers
run this command to:
- generate the file docker-compose.yml from the template docker-compose.j2 and variables data.yml
- use the file docker-compose.yml to
- create a docker network.
- pull the required docker images.
- instantiate 4 containers (telegraf-snmp, telegraf-openconfig, Influxdb, Grafana)
- connect the 4 containers to same docker network
$ make up
Use Grafana GUI
You can now use the Grafana GUI http://host_ip_address:3000
.
The default username and password are admin
/admin
, but we changed them to jcluser
/Juniper!1
You should see the dashboards from the directory dashboards
You can create your own dashboards.
containers cli
To start a shell session in a container, run one of these commands:
$ make telegraf-openconfig-cli
$ make telegraf-snmp-cli
$ make influxdb-cli
$ make grafana-cli
To exit the session, run the command exit
in the container shell session
Stop the containers
run this command to stop containers without removing them
$ make stop
Start the existing containers
Run this command to start existing containers
$ make start
restart containers
Run this command to stop running containers, and to restart them
$ make restart
stop and remove containers and networks
Run this command to stop and remove containers and networks
$ make down
Docker compose workflow
clone the repository
$ git clone https://github.com/ksator/junos_monitoring_with_a_TIG_stack.git
$ cd junos_monitoring_with_a_TIG_stack
Update the devices details
$ vi data.yml
Generate the Telegraf configuration files
Generate the Telegraf configuration file for Openconfig
$ python ./render.py --output 'configs/telegraf-openconfig.conf' --template 'templates/telegraf-openconfig.j2' --yaml 'data.yml'
$ more configs/telegraf-openconfig.conf
Generate the Telegraf configuration file for SNMP
$ python ./render.py --output 'configs/telegraf-snmp.conf' --template 'templates/telegraf-snmp.j2' --yaml 'data.yml'
$ more configs/telegraf-snmp.conf
Alternatively, create yourself your own telegraf configuration files telegraf-openconfig.conf and telegraf-snmp.conf
docker-compose.yml file
Generate therun this command to generate the file docker-compose.yml from the template docker-compose.j2 and variables data.yml
$ python ./render.py -o 'docker-compose.yml' -t 'templates/docker-compose.j2' -y 'data.yml'
Create and start containers
Run this command to create and start containers using the docker-compose.yml file:
- This will create a docker network.
- This will pull the required docker images
- This will instantiate 4 containers (telegraf-openconfig, telegraf-snmp, Influxdb, Grafana)
- The 4 containers will be connected to same docker network
A telegraf container will be instanciate with the openconfig telegraf configuration file telegraf-openconfig.conf
It will collect data from Junos according to the telegraf input plugin configuration in telegraf-openconfig.conf
It will create on the influxdb container the database juniper
and the user juniper
with a password juniper
It will store the data collected in the database juniper
of the influxdb container using the user juniper
A telegraf container will be instanciate with the snmp telegraf configuration file telegraf-snmp.conf
It will collect data from Junos according to the telegraf input plugin configuration in telegraf-snmp.conf
It will create on the influxdb container the database juniper
and the user juniper
with a password juniper
It will store the data collected in the database juniper
of the influxdb container using the user juniper
The grafana container will load all dashboards json files from the directory dashboards
It will use the influxdb container as indicated in the datasource.yaml config file.
$ docker-compose -f docker-compose.yml up -d
Use Grafana GUI
You can now use the Grafana GUI http://host_ip_address:3000
.
The default username and password are admin
/admin
, but we changed them to jcluser
/Juniper!1
You should see the dashboards from the directory dashboards
You can create your own dashboards.
stop containers
Run this command to stop containers without removing them
$ docker-compose -f docker-compose.yml stop
start containers
Run this command to start containers
$ docker-compose -f docker-compose.yml start
stop and remove containers and networks
Run this command to stop and remove containers and networks
$ docker-compose -f docker-compose.yml down
Docker workflow
clone the repository
$ git clone https://github.com/ksator/junos_monitoring_with_a_TIG_stack.git
$ cd junos_monitoring_with_a_TIG_stack
Update the devices details
$ vi data.yml
Generate the Telegraf configuration file
Generate the Telegraf configuration file for Openconfig
$ python ./render.py --output 'configs/telegraf-openconfig.conf' --template 'templates/telegraf-openconfig.j2' --yaml 'data.yml'
$ more configs/telegraf-openconfig.conf
Generate the Telegraf configuration file for SNMP
$ python ./render.py --output 'configs/telegraf-snmp.conf' --template 'templates/telegraf-snmp.j2' --yaml 'data.yml'
$ more configs/telegraf-snmp.conf
Alternatively, create yourself your own telegraf configuration files telegraf-openconfig.conf and telegraf-snmp.conf
pull docker images for influxdb, telegraf, grafana
$ docker pull influxdb:1.7.2
$ docker pull telegraf:1.9.1
$ docker pull ksator/telegraf_with_snmp_mib
$ docker pull grafana/grafana:5.4.2
Create a network
Run this command to create a docker network
$ docker network create tig
Run this command to list docker networks
$ docker network ls
Run this command to display detailed information on the tig network
$ docker network inspect tig
Instantiate containers
influxdb container
Run this command to instanciate an influxdb container The Influxdb container will be connected to the network tig.
$ docker run -d --name influxdb \
-p 8083:8083 -p 8086:8086 \
--network=tig \
influxdb:1.7.2
Telegraf container
Openconfig
Run this command to instanciate a telegraf container from the image telegraf:1.9.1
with the telegraf configuration file telegraf-openconfig.conf
The Telegraf container will be connected to the network tig.
This container will collect data from Junos according to the telegraf input plugin configuration in telegraf-openconfig.conf
It will create on the influxdb container the database juniper
and the user juniper
with a password juniper
It will store the data collected in the database juniper
of the influxdb container using the user juniper
$ docker run -d --name telegraf-openconfig \
-v $PWD/configs/telegraf-openconfig.conf:/etc/telegraf/telegraf.conf:ro \
--network=tig \
telegraf:1.9.1
snmp
Run this command to instanciate a telegraf container from the image ksator/telegraf_with_snmp_mib
with the telegraf configuration file telegraf-snmp.conf
The Telegraf container will be connected to the network tig.
This container will collect data from Junos according to the telegraf input plugin configuration in telegraf-snmp.conf
It will create on the influxdb container the database juniper
and the user juniper
with a password juniper
It will store the data collected in the database juniper
of the influxdb container using the user juniper
$ docker run -d --name telegraf-snmp \
-v $PWD/configs/telegraf-snmp.conf:/etc/telegraf/telegraf.conf:ro \
--network=tig \
ksator/telegraf_with_snmp_mib
Grafana container
Run this command to instanciate a Grafana container.
The Grafana container will be connected to the network tig.
The container will load all dashboards json files from the directory dashboards
The container will use the influxdb container as indicated in the datasource.yaml config file.
$ docker run -d --name grafana \
-p 3000:3000 \
-v $PWD/configs/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml:ro \
-v $PWD/configs/dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml:ro \
-v $PWD/dashboards:/var/tmp/dashboards \
--network=tig \
grafana/grafana:5.4.2
Verify
Run this command to list running containers
$ docker ps
Run this command to display detailed information on the tig network
$ docker network inspect tig
Use Grafana GUI
You can now use the Grafana GUI http://host_ip_address:3000
.
The default username and password are admin
/admin
You should see the dashboards from the directory dashboards
You can create your own dashboards.