Add name and cell to new_app.sh

pull/329/head
nathan haugo 2016-11-03 11:03:26 -07:00
parent e9573ad093
commit a212660084
3 changed files with 22 additions and 31 deletions

View File

@ -1,31 +1,18 @@
{
"id": "18aed9a7-dc83-406e-a4dc-40d53049541a",
"measurement": "disk",
"app": "User Facing Application Name",
"cells": [{
"x": 0,
"y": 0,
"w": 5,
"h": 5,
"i": "used_percent",
"name": "Used Percent",
"queries": [{
"query": "select used_percent from disk",
"db": "telegraf",
"rp": "autogen"
}]
},
{
"x": 5,
"y": 1,
"w": 5,
"h": 5,
"i": "cpu_usage",
"name": "CPU Usage",
"queries": [{
"query": "select 100 - usage_idle from cpu",
"db": "telegraf",
"rp": "autogen"
}]
}]
}
"id": "e72c2eb9-d09b-46ea-b5df-0a82769e314d",
"measurement": "mem",
"app": "docker",
"cells": [{
"x": 0,
"y": 0,
"w": 10,
"h": 10,
"i": "docker_test",
"name": "test",
"queries": [{
"query": "select used_percent from disk",
"db": "telegraf",
"rp": "autogen"
}]
}]
}

View File

@ -32,6 +32,8 @@ if [ -z "$measurement" ]; then
exit
fi
CELLID=$(uuidgen)
CELLID="$(tr [A-Z] [a-z] <<< "$CELLID")"
UUID=$(uuidgen)
UUID="$(tr [A-Z] [a-z] <<< "$UUID")"
@ -47,6 +49,8 @@ cat > $APP_FILE << EOF
"y": 0,
"w": 10,
"h": 10,
"i": "$CELLID",
"name": "User facing cell Name",
"queries": [{
"query": "select used_percent from disk",
"db": "telegraf",

View File

@ -29,7 +29,7 @@ func (h *Service) GetMappings(w http.ResponseWriter, r *http.Request) {
if seen[layout.Measurement+layout.ID] {
continue
}
mp.Mappings = append(mp.Mappings, mapping{layout.Measurement, layout.ID})
mp.Mappings = append(mp.Mappings, mapping{layout.Measurement, layout.Measurement})
seen[layout.Measurement+layout.ID] = true
}