Test environment for Intel Snap and agents using Grafana and ElasticSearch
The test enviroment depends on having a docker enviroment running. If you need to install docker on OSX you can learn from here https://docs.docker.com/docker-for-mac/install/
To build test enviroment run the following command:
docker-compose build
To run the test enviroment run the following command:
docker-compose up
This command starts the following docker containers:
-
Snap container:
- Runs Intel Snap Agent
-
Grafana container:
- Runs the following services:
- ElasticSearch
- Grafana
- Kibana
- Ngix
- Carbon
- Graphite
- Runs the following services:
Each collector Snap agent sends metrics to ElasticSearch at http://grafana:9200. The data stored inside ElasticSearch is displayed using Grafana which connects to ElasticSearch at http://localhost:9200.
Open a browser and navigate to Grafana website http://localhost:3000. Login as user 'admin' with password 'admin'. Navigate to Data Sources, open each data source Snap/ and click Save and Test. Navigate to Dashboards, open Snap/ dashboards to see metrics generated by each agent.
NOTE: Please note that not all metrics generated by agents are displayed in dashboards.
Log files are generated under grafana/supervisor directory.
- Url: http://localhost:3000
- Install directory: /www/data/grafana
- Configuration: grafana/config.js
- Setup script: grafana/add_data_sources.py
- adds data sources
- adds dashboards
- Dashboard templates:
- Snap - grafana/snap-metrics.json
-
- grafana/-metrics.json
- Install directory: /opt/elasticsearch
- Install directory: /opt/graphite
- Configuration: graphite/carbon.conf
- Install directory: /www/data/kibana
- Configuration: kibana/carbon.conf
- Configuration: nginx/nginx.conf
- Install directory: /opt/snap
- Configuration: snap/config.yaml
- Install directory: /opt/
- Configuration: /.conf
In order to see data generated inside indices you can use the below queries.
These commands can be executed from grafana_grafana_1
docker container.
NOTE
: Please note that indices are created for each day. Update the date
from indices name for the desired date.
Display all indices inside Elastic Search
curl -XGET 'localhost:9200/_cat/indices?v&pretty'
Display first 10 entries from index
curl -XPOST 'localhost:9200/-2017.06.16/_search?pretty' -d '
{
"query": { "match_all": {} },
"size": 10
}'
Display first 10 entries from Snap index.
curl -XPOST 'localhost:9200/snap-log-2017.06.16/_search?pretty' -d '
{
"query": { "match_all": {} },
"size": 10
}'
Display first 10 entries that corespond to metrics cpu
curl -XPOST 'localhost:9200/-2017.06.16/_search?pretty' -d '
{
"query": { "match": { "measurement_name": "cpu" } },
"size": 10
}'
Display first 10 entries metric that corespond to metrics cpu
and for tag.path '/'
curl -XPOST 'localhost:9200/-2017.06.16/_search?pretty' -d '
{
"query": {
"bool": {
"must": [
{ "match": { "measurement_name": "disk" } },
{ "match": { "tag.path": "/" } }
]
}
},
"size": 10
}'
Read more about Elastic Search queries [https://www.elastic.co/guide/en/elasticsearch/reference/1.4/query-dsl-match-query.html]