Near real-time monitoring of SQL Server Linux/containers using Telegraf-InfluxDB and Grafana

Published Aug 06 2021 09:36 AM 3,483 Views
Microsoft

Introduction: 

In this blog, we will look at how we configure near real-time monitoring of SQL Server on Linux and containers with the Telegraf-InfluxDB and Grafana stack. This is built on similar lines to Azure SQLDB and Managed Instance solutions already published by my colleague Denzil Ribeiro. You can refer to the above blogs to know more about Telegraf, InfluxDB and Grafana. 

 

A quick rundown of all the tasks we'll be carrying out to complete the setup:

  1. We will first install the Telegraf, InfluxDB, and Grafana containers on the monitoring host machine. You may be wondering why containers are used? because they are simple to set up and also provide isolation. 
  2. Then, we will prepare the target SQL Server instances that we will monitor by creating the login on all of the target SQL Server instances (SQL Server on Linux/containers/Windows) that telegraf will use to connect to SQL Server instances for data collection.
  3. As this is a demo, I am running all three containers on a single host machine, but depending on the instances you monitor and data that is collected, you may decide to run the containers on different nodes.
  4. The data retention policies of InfluxDB will then be configured. The retention policy ensures that Influxdb does not grow out of bounds. 
  5. Finally, we will configure and set up Grafana to create our dashboard with graphs and charts.

 

Let's Build:

For this demonstration, the host on which I deploy the containers is an Azure VM running Ubuntu 20.04. I'm collecting data from the four SQL Server instances listed below:

  1. A SQL Server instance running on RHEL.
  2. Two SQL Server container instances, one deployed using the Ubuntu image and the other using the RHEL image.
  3. A SQL Server running on Windows.

Let's start deploying containers:

  1. Install docker on the Ubuntu 20.04 host, which is our monitoring VM. To install Docker on Ubuntu 20.04 VM, refer to this article.
  2. Run the command below to create a docker network. This is the common network on which all three containers (Telegraf, InfluxDB, and Grafana) will be deployed.
    docker network create --driver bridge influxdb-telegraf-net 
    #You can change the name of the network from “influxdb-telegraf-net” to whatever you want.​
    you can list the network using the command
    docker network ls​
    amvin87_0-1628258795694.png
  3. We will now create the SQL Server login that telegraf will use to connect to the target SQL Server instances. This login must be created on all target SQL Server instances that you intend to monitor. You can change the login name from telegraf to any other name of your choice, but the same also needs to be changed in the telegraf.conf file as well.

    USE master; 
    CREATE LOGIN telegraf WITH PASSWORD = N'StrongPassword1!', CHECK_POLICY = ON; 
    GO 
    GRANT VIEW SERVER STATE TO telegraf; 
    GO 
    GRANT VIEW ANY DEFINITION TO telegraf; 
    GO 
  4. Run the following command to deploy the telegraf container

    docker run -d --name=telegraf -v /home/amvin/monitor/sqltelegraf/telegraf.conf:/etc/telegraf/telegraf.conf --net=influxdb-telegraf-net telegraf 
    # where:/home/amvin/monitor/sqltelegraf/telegraf.conf is a telegraf configuration file placed on my host machine, please update the path as per your environment.
    # please ensure that you change the IP addresses and port numbers to your target SQL Server instances in the telegraf.conf file that you create in your environment. 

    Note: You can download the sample telegraf.conf from here. Please remember to change the IP address to your target SQL Server instance IP addresses.

  5.  Run the following command to deploy the InfluxDB container
    docker run --detach --net=influxdb-telegraf-net -v /home/amvin/monitor/data/influx:/var/lib/influxdb:rw --hostname influxdb --restart=always -p 8086:8086 --name influxdb influxdb:1.8 
    
    # where: /home/amvin/monitor/data/influx is a folder on the host that I am mounting inside the container, you can create this folder in any location.
    # please ensure you set the right permissions so files can be written inside this folder by the container.  ​
  6. Deploy the Grafana container using the following command
    docker run --detach -p 3001:3000 --net=influxdb-telegraf-net --restart=always -v /home/amvin/monitor/data/grafana:/var/lib/grafana -e "GF_INSTALL_PLUGINS=grafana-azure-monitor-datasource,grafana-piechart-panel,savantly-heatmap-panel" --name grafana grafana/Grafana 
    
    # where: home/amvin/monitor/data/grafana is a folder on the host that I am mounting inside the container, you can create this folder in any location.
    # please ensure you set the right permissions so files can be written inside this folder. 

With the containers now deployed, use "docker ps -a" to list them, and you should see something like this:

amvin87_0-1628260115106.png

 

Note: Please ensure that you open the ports on the host to which Grafana and InfluxDB containers are mapped to, in this case they are 3000 and 8086 respectively. 

 

Let's now setup retention policy on InfluxDB to ensure that there is limited growth of the database. I am setting this for 30 days, you can configure it as per your requirement.

 

 

sudo docker exec -it influxdb bash
#then run beow commands inside the container
influx
use telegraf; 
show retention policies; 
create retention policy retain30days on telegraf duration 30d replication 1 default; 
quit

 

 

 

Setting up Grafana: 

We are now ready to create the dashboard, before that we need to setup Grafana and to do that follow the below steps: 

  • Browse to your Grafana instance - http://[GRAFANA_IP_ADDRESS_OR_SERVERNAME]:3000 
  • First time you login into Grafana, login and password are set to: admin. Also take a look at the Getting Started Grafana documentation. 
  • Add a data source for InfluxDB. Detailed instructions are at in the grafana data source docs 
    • Type: InfluxDB
    • Name: InfluxDB (this is also the default) 
    • URL: http://[INFLUXDB_HOSTNAME_OR_IP_ADDRESS]:8086. (The default of http://localhost:8086 works if Grafana and InfluxDB are on the same machine; make sure to explicitly enter this URL in the field. ) 
    • Database: telegraf 
    • Click "Save & Test". You should see the message "Data source is working". 
  • Download Grafana dashboard JSON definitions from the repo from here and then import them into Grafana. 

You are ready and this is how the dashboard should look, feel free to modify the graphs as per your requirement.

 

amvin87_0-1628261239658.png

amvin87_1-1628261266254.png

amvin87_2-1628261285192.png

 

 

 

 

 

 

%3CLINGO-SUB%20id%3D%22lingo-sub-2620050%22%20slang%3D%22en-US%22%3ENear%20real-time%20monitoring%20of%20SQL%20Server%20Linux%2Fcontainers%20using%20Telegraf-InfluxDB%20and%20Grafana%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2620050%22%20slang%3D%22en-US%22%3E%3CH3%20aria-level%3D%222%22%20id%3D%22toc-hId-2114052913%22%20id%3D%22toc-hId-2114052913%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EIntroduction%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A40%2C%26quot%3B335559739%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FH3%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EIn%20this%20blog%2C%20we%20will%20look%20at%20how%20we%20configure%20near%20real-time%20monitoring%20of%20SQL%20Server%20on%20Linux%20and%20containers%20with%20the%20Telegraf-InfluxDB%26nbsp%3Band%20Grafana%20stack.%20This%20is%20built%20on%20similar%20lines%20to%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-sql%2Fmonitoring-azure-sql-database-with-telegraf%2Fba-p%2F882790%22%20target%3D%22_blank%22%3EAzure%26nbsp%3BSQLDB%26nbsp%3B%3C%2FA%3Eand%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fdenzilribeiro%2Fsqlmimonitoring%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EManaged%20Instance%3C%2FA%3E%20solutions%20already%20published%20by%20my%20colleague%20Denzil%20Ribeiro.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3BYou%20can%20refer%20to%20the%20above%20blogs%20to%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bknow%20more%20about%20Telegraf%2C%26nbsp%3BInfluxDB%26nbsp%3Band%20Grafana.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20quick%20rundown%20of%20all%20the%20tasks%20we'll%20be%20carrying%20out%20to%20complete%20the%20setup%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EWe%20will%20first%20install%20the%20Telegraf%2C%20InfluxDB%2C%20and%20Grafana%20containers%20on%20the%20monitoring%20host%20machine.%20You%20may%20be%20wondering%20why%20containers%20are%20used%3F%20because%20they%20are%20simple%20to%20set%20up%20and%20also%20provide%20isolation.%26nbsp%3B%3C%2FLI%3E%0A%3CLI%3EThen%2C%20we%20will%20prepare%20the%20target%20SQL%20Server%20instances%20that%20we%20will%20monitor%20by%20creating%20the%20login%20on%20all%20of%20the%20target%20SQL%20Server%20instances%20(SQL%20Server%20on%20Linux%2Fcontainers%2FWindows)%20that%20telegraf%20will%20use%20to%20connect%20to%20SQL%20Server%20instances%20for%20data%20collection.%3C%2FLI%3E%0A%3CLI%3EAs%20this%20is%20a%20demo%2C%20I%20am%20running%20all%20three%20containers%20on%20a%20single%20host%20machine%2C%20but%20depending%20on%20the%20instances%20you%20monitor%20and%20data%20that%20is%20collected%2C%20you%20may%20decide%20to%20run%20the%20containers%20on%20different%20nodes.%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20data-contrast%3D%22auto%22%3EThe%20data%20retention%20policies%20of%20InfluxDB%20will%20then%20be%20configured.%20The%20retention%20policy%20ensures%20that%20Influxdb%20does%20not%20grow%20out%20of%20bounds.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3EFinally%2C%20we%20will%20configure%20and%20set%20up%20Grafana%20to%20create%20our%20dashboard%20with%20graphs%20and%20charts.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-306598450%22%20id%3D%22toc-hId-306598450%22%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3ELet's%20Build%3A%3C%2FSPAN%3E%3C%2FH3%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3EFor%20this%20demonstration%2C%20the%20host%20on%20which%20I%20deploy%20the%20containers%20is%20an%20Azure%20VM%20running%20Ubuntu%2020.04.%26nbsp%3BI'm%20collecting%20data%20from%20the%20four%20SQL%20Server%20instances%20listed%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3EA%20SQL%20Server%20instance%20running%20on%20RHEL.%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3ETwo%20SQL%20Server%20container%20instances%2C%20one%20deployed%20using%20the%20Ubuntu%20image%20and%20the%20other%20using%20the%20RHEL%20image.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3EA%20SQL%20Server%20running%20on%20Windows.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW223661243%20BCX8%22%20data-ccp-parastyle%3D%22heading%202%22%3ELet's%20start%20deploying%20containers%3A%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW223661243%20BCX8%22%20data-ccp-parastyle%3D%22heading%202%22%3EInstall%20docker%20on%20the%20Ubuntu%2020.04%20host%2C%20which%20is%20our%20monitoring%20VM.%20To%20install%20Docker%20on%20Ubuntu%2020.04%20VM%2C%20refer%20to%20this%20%3CA%20href%3D%22https%3A%2F%2Fdocs.docker.com%2Fengine%2Finstall%2Fubuntu%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Earticle.%3C%2FA%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3ERun%20the%20command%20below%20to%20create%20a%20docker%20network.%20This%20is%20the%20common%26nbsp%3Bnetwork%20on%20which%20all%20three%20containers%20(Telegraf%2C%20InfluxDB%2C%20and%20Grafana)%20will%20be%20deployed.%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20network%20create%20--driver%20bridge%20influxdb-telegraf-net%20%0A%23You%20can%20change%20the%20name%20of%20the%20network%20from%20%E2%80%9Cinfluxdb-telegraf-net%E2%80%9D%20to%20whatever%20you%20want.%E2%80%8B%3C%2FCODE%3E%3C%2FPRE%3Eyou%20can%20list%20the%20network%20using%20the%20command%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20network%20ls%E2%80%8B%3C%2FCODE%3E%3C%2FPRE%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22amvin87_0-1628258795694.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301075iA6A3DB04D4AD8D2F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22amvin87_0-1628258795694.png%22%20alt%3D%22amvin87_0-1628258795694.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3EWe%20will%20now%20create%20the%20SQL%20Server%20login%20that%20telegraf%20will%20use%20to%20connect%20to%20the%20target%20SQL%20Server%20instances.%20This%20login%20must%20be%20created%20on%20all%20target%20SQL%20Server%20instances%20that%20you%20intend%20to%20monitor.%26nbsp%3B%3CSPAN%20data-contrast%3D%22auto%22%3EYou%20can%20change%20the%20login%20name%20from%20telegraf%20to%20any%20other%20name%20of%20your%20choice%2C%20but%20the%20same%20also%20needs%20to%20be%20changed%20in%20the%26nbsp%3Btelegraf.conf%26nbsp%3Bfile%20as%20well.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-sql%22%3E%3CCODE%3EUSE%20master%3B%20%0ACREATE%20LOGIN%20telegraf%20WITH%20PASSWORD%20%3D%20N'StrongPassword1!'%2C%20CHECK_POLICY%20%3D%20ON%3B%20%0AGO%20%0AGRANT%20VIEW%20SERVER%20STATE%20TO%20telegraf%3B%20%0AGO%20%0AGRANT%20VIEW%20ANY%20DEFINITION%20TO%20telegraf%3B%20%0AGO%20%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CP%3ERun%20the%20following%20command%20to%20deploy%20the%20telegraf%20container%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20run%20-d%20--name%3Dtelegraf%20-v%20%2Fhome%2Famvin%2Fmonitor%2Fsqltelegraf%2Ftelegraf.conf%3A%2Fetc%2Ftelegraf%2Ftelegraf.conf%20--net%3Dinfluxdb-telegraf-net%20telegraf%20%0A%23%20where%3A%2Fhome%2Famvin%2Fmonitor%2Fsqltelegraf%2Ftelegraf.conf%20is%20a%20telegraf%20configuration%20file%20placed%20on%20my%20host%20machine%2C%20please%20update%20the%20path%20as%20per%20your%20environment.%0A%23%20please%20ensure%20that%20you%20change%20the%20IP%20addresses%20and%20port%20numbers%20to%20your%20target%20SQL%20Server%20instances%20in%20the%20telegraf.conf%20file%20that%20you%20create%20in%20your%20environment.%20%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%3CU%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3C%2FU%3E%3A%20%3CEM%3EYou%20can%20download%20the%20sample%20telegraf.conf%20from%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fmssql-docker%2Fblob%2Fmaster%2Flinux%2Fmonitor%2Ftelegraf.conf%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20Please%20remember%20to%20change%20the%20IP%20address%20to%20your%20target%20SQL%20Server%20instance%20IP%20addresses.%3C%2FEM%3E%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%26nbsp%3BRun%20the%20following%20command%20to%20deploy%20the%20InfluxDB%20container%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20run%20--detach%20--net%3Dinfluxdb-telegraf-net%20-v%20%2Fhome%2Famvin%2Fmonitor%2Fdata%2Finflux%3A%2Fvar%2Flib%2Finfluxdb%3Arw%20--hostname%20influxdb%20--restart%3Dalways%20-p%208086%3A8086%20--name%20influxdb%20influxdb%3A1.8%20%0A%0A%23%20where%3A%20%2Fhome%2Famvin%2Fmonitor%2Fdata%2Finflux%20is%20a%20folder%20on%20the%20host%20that%20I%20am%20mounting%20inside%20the%20container%2C%20you%20can%20create%20this%20folder%20in%20any%20location.%0A%23%20please%20ensure%20you%20set%20the%20right%20permissions%20so%20files%20can%20be%20written%20inside%20this%20folder%20by%20the%20container.%20%20%E2%80%8B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%20class%3D%22TextRun%20SCXW233098785%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22TextRun%20SCXW233098785%20BCX8%22%20data-contrast%3D%22auto%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW233098785%20BCX8%22%3EDeploy%20the%20Grafana%20container%20using%20the%20following%20command%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Edocker%20run%20--detach%20-p%203001%3A3000%20--net%3Dinfluxdb-telegraf-net%20--restart%3Dalways%20-v%20%2Fhome%2Famvin%2Fmonitor%2Fdata%2Fgrafana%3A%2Fvar%2Flib%2Fgrafana%20-e%20%22GF_INSTALL_PLUGINS%3Dgrafana-azure-monitor-datasource%2Cgrafana-piechart-panel%2Csavantly-heatmap-panel%22%20--name%20grafana%20grafana%2FGrafana%20%0A%0A%23%20where%3A%20home%2Famvin%2Fmonitor%2Fdata%2Fgrafana%20is%20a%20folder%20on%20the%20host%20that%20I%20am%20mounting%20inside%20the%20container%2C%20you%20can%20create%20this%20folder%20in%20any%20location.%0A%23%20please%20ensure%20you%20set%20the%20right%20permissions%20so%20files%20can%20be%20written%20inside%20this%20folder.%20%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EWith%20the%20containers%20now%20deployed%2C%20use%20%22docker%20ps%20-a%22%20to%20list%20them%2C%20and%20you%20should%20see%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22amvin87_0-1628260115106.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301081i7C4F3FDBB900701D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22amvin87_0-1628260115106.png%22%20alt%3D%22amvin87_0-1628260115106.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CU%3E%3CSTRONG%3ENote%3C%2FSTRONG%3E%3C%2FU%3E%3A%20%3CEM%3EPlease%20ensure%20that%20you%20open%20the%20ports%20on%20the%20host%20to%20which%20Grafana%20and%20InfluxDB%20containers%20are%20mapped%20to%2C%20in%20this%20case%20they%20are%203000%20and%208086%20respectively.%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A1080%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%3CSPAN%20class%3D%22NormalTextRun%20%20BCX8%20SCXW67914622%22%3ELet's%20now%20setup%20retention%20policy%20on%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22NormalTextRun%20SpellingErrorV2%20%20BCX8%20SCXW67914622%22%3EInfluxDB%3C%2FSPAN%3E%3CSPAN%20class%3D%22NormalTextRun%20%20BCX8%20SCXW67914622%22%3E%26nbsp%3Bto%20ensure%20that%20there%20is%20limited%20growth%20of%20the%20database.%20I%20am%20setting%20this%20for%2030%20days%2C%20you%20can%20configure%20it%20as%20per%20your%20requirement.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-bash%22%3E%3CCODE%3Esudo%20docker%20exec%20-it%20influxdb%20bash%0A%23then%20run%20beow%20commands%20inside%20the%20container%0Ainflux%0Ause%20telegraf%3B%20%0Ashow%20retention%20policies%3B%20%0Acreate%20retention%20policy%20retain30days%20on%20telegraf%20duration%2030d%20replication%201%20default%3B%20%0Aquit%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-296095346%22%20id%3D%22toc-hId-296095346%22%3E%3CSPAN%20class%3D%22TextRun%20SCXW51886287%20BCX8%22%20data-contrast%3D%22none%22%3E%3CSPAN%20class%3D%22NormalTextRun%20SCXW51886287%20BCX8%22%20data-ccp-charstyle%3D%22HTML%20Code%22%3ESetting%20up%20Grafana%3A%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22EOP%20SCXW51886287%20BCX8%22%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A240%2C%26quot%3B469777462%26quot%3B%3A%5B916%2C1832%2C2748%2C3664%2C4580%2C5496%2C6412%2C7328%2C8244%2C9160%2C10076%2C10992%2C11908%2C12824%2C13740%2C14656%5D%2C%26quot%3B469777927%26quot%3B%3A%5B0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%5D%2C%26quot%3B469777928%26quot%3B%3A%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%5D%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22none%22%3EWe%20are%20now%20ready%20to%20create%20the%20dashboard%2C%20before%20that%20we%20need%20to%20setup%20Grafana%20and%20to%20do%20that%20follow%20the%20below%20steps%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A240%2C%26quot%3B469777462%26quot%3B%3A%5B916%2C1832%2C2748%2C3664%2C4580%2C5496%2C6412%2C7328%2C8244%2C9160%2C10076%2C10992%2C11908%2C12824%2C13740%2C14656%5D%2C%26quot%3B469777927%26quot%3B%3A%5B0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%2C0%5D%2C%26quot%3B469777928%26quot%3B%3A%5B1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%2C1%5D%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%221%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EBrowse%20to%20your%20Grafana%20instance%20-%20http%3A%2F%2F%5BGRAFANA_IP_ADDRESS_OR_SERVERNAME%5D%3A3000%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233117%26quot%3B%3Atrue%2C%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A240%2C%26quot%3B335559739%26quot%3B%3A240%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%222%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EFirst%20time%20you%20login%20into%20Grafana%2C%20login%20and%20password%20are%20set%20to%3A%E2%80%AF%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eadmin%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E.%20Also%26nbsp%3Btake%20a%20look%26nbsp%3Bat%20the%E2%80%AF%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgrafana.com%2Fdocs%2Fgrafana%2Flatest%2Fguides%2Fgetting_started%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EGetting%20Started%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%AFGrafana%20documentation.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233117%26quot%3B%3Atrue%2C%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAdd%20a%20data%20source%20for%26nbsp%3BInfluxDB.%20Detailed%20instructions%20are%20at%20in%20the%E2%80%AF%3C%2FSPAN%3E%3CA%20href%3D%22http%3A%2F%2Fdocs.grafana.org%2Ffeatures%2Fdatasources%2Finfluxdb%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSPAN%3Egrafana%26nbsp%3Bdata%20source%20docs%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233117%26quot%3B%3Atrue%2C%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A240%2C%26quot%3B335559739%26quot%3B%3A240%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CUL%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EType%3A%E2%80%AF%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EInfluxDB%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EName%3A%E2%80%AF%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EInfluxDB%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%AF(this%20is%20also%20the%20default)%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EURL%3A%20http%3A%2F%2F%5BINFLUXDB_HOSTNAME_OR_IP_ADDRESS%5D%3A8086.%20(The%20default%20of%E2%80%AF%3C%2FSPAN%3E%3CA%20href%3D%22http%3A%2F%2Flocalhost%3A8086%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ehttp%3A%2F%2Flocalhost%3A8086%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%AFworks%20if%20Grafana%20and%26nbsp%3BInfluxDB%26nbsp%3Bare%20on%20the%20same%20machine%3B%20make%20sure%20to%20explicitly%20enter%20this%20URL%20in%20the%20field.%20)%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A60%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EDatabase%3A%E2%80%AF%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Etelegraf%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EClick%20%22Save%20%26amp%3B%20Test%22.%20You%20should%20see%20the%20message%20%22Data%20source%20is%20working%22.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A60%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%227%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EDownload%20Grafana%20dashboard%20JSON%20definitions%20from%20the%20repo%26nbsp%3Bfrom%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fmssql-docker%2Fblob%2Fmaster%2Flinux%2Fmonitor%2Fdashboard%2Fdashboard.json%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%26nbsp%3B%3C%2FA%3Eand%20then%E2%80%AF%3C%2FSPAN%3E%3CA%20href%3D%22http%3A%2F%2Fdocs.grafana.org%2Freference%2Fexport_import%2F%23importing-a-dashboard%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eimport%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%AFthem%20into%20Grafana.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233117%26quot%3B%3Atrue%2C%26quot%3B134233118%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A240%2C%26quot%3B335559739%26quot%3B%3A240%2C%26quot%3B335559740%26quot%3B%3A240%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22none%22%3EYou%20are%20ready%20and%20this%20is%20how%20the%20dashboard%20should%20look%2C%20feel%20free%20to%20modify%20the%20graphs%20as%20per%20your%20requirement.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22amvin87_0-1628261239658.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301085iA330CB2144A546D0%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22amvin87_0-1628261239658.png%22%20alt%3D%22amvin87_0-1628261239658.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22amvin87_1-1628261266254.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301086i79535B0223686148%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22amvin87_1-1628261266254.png%22%20alt%3D%22amvin87_1-1628261266254.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22amvin87_2-1628261285192.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F301087iF980D00B64E1CB62%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22amvin87_2-1628261285192.png%22%20alt%3D%22amvin87_2-1628261285192.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2620050%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ESQLServerTiger%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Co-Authors
Version history
Last update:
‎Aug 06 2021 09:41 AM
Updated by: