Last active
April 20, 2017 22:14
-
-
Save nanliu/69d20eb96a62b968201346fe1bc816c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git clone https://github.com/nanliu/snap-labs.git | |
cd snap-labs/intro-to-snap | |
./setup.sh | |
wget https://s3-us-west-2.amazonaws.com/snap.ci.snap-telemetry.io/snap/1.1.0/linux/x86_64/snaptel -O /usr/local/bin/snaptel | |
chmod 755 /usr/local/bin/snaptel | |
echo "waiting to configure grafana" | |
until $(curl --output /dev/null --silent --head --fail http://admin:admin@localhost:3000/api/org); do | |
echo -n '.' | |
sleep 5 | |
done | |
echo | |
curl 'http://admin:admin@localhost:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"influxdb","type":"influxdb","access":"proxy","url":"http://influxdb:8086","password":"admin","user":"admin","database":"test","isDefault":true}' | |
curl 'http://admin:admin@localhost:3000/api/dashboards/db' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"dashboard":{"__inputs":[{"name":"influxdb","label":"influxdb","description":"","type":"datasource","pluginId":"influxdb","pluginName":"InfluxDB"}],"__requires":[{"type":"grafana","id":"grafana","name":"Grafana","version":"4.1.2"},{"type":"panel","id":"graph","name":"Graph","version":""},{"type":"datasource","id":"influxdb","name":"InfluxDB","version":"1.0.0"}],"annotations":{"list":[]},"editable":true,"gnetId":null,"graphTooltip":0,"hideControls":false,"id":null,"links":[],"rows":[{"collapse":false,"height":"250px","panels":[{"aliasColors":{},"bars":false,"datasource":"influxdb","fill":1,"id":1,"legend":{"avg":false,"current":false,"max":false,"min":false,"show":true,"total":false,"values":false},"lines":true,"linewidth":1,"links":[],"nullPointMode":"null","percentage":false,"pointradius":5,"points":false,"renderer":"flot","seriesOverrides":[],"span":12,"stack":false,"steppedLine":false,"targets":[{"dsType":"influxdb","groupBy":[{"params":["$interval"],"type":"time"},{"params":["null"],"type":"fill"}],"measurement":"intel/psutil/load","policy":"default","refId":"A","resultFormat":"time_series","select":[[{"params":["*"],"type":"field"},{"params":[],"type":"mean"}]],"tags":[]}],"thresholds":[],"timeFrom":null,"timeShift":null,"title":"psutil metrics","tooltip":{"shared":true,"sort":0,"value_type":"individual"},"type":"graph","xaxis":{"mode":"time","name":null,"show":true,"values":[]},"yaxes":[{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true},{"format":"short","label":null,"logBase":1,"max":null,"min":null,"show":true}]}],"repeat":null,"repeatIteration":null,"repeatRowId":null,"showTitle":false,"title":"Dashboard Row","titleSize":"h6"}],"schemaVersion":14,"style":"dark","tags":[],"templating":{"list":[]},"time":{"from":"now-6h","to":"now"},"timepicker":{"refresh_intervals":["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],"time_options":["5m","15m","1h","6h","12h","24h","2d","7d","30d"]},"timezone":"browser","title":"Snap Metrics","version":0},"overwrite":true,"inputs":[{}]}' | |
echo | |
echo "Try the following command:" | |
echo "snaptel plugin list" | |
echo "snaptel task list" | |
echo "snaptel task watch \$(snaptel task list | tail -1 | cut -f1)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
snaptel() { | |
cd ~/snap-labs/intro-to-snap | |
docker-compose exec snap snaptel $* | |
} | |
snaptel $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment