Grafana: μ›Ή GUIλ₯Ό μ‚¬μš©ν•˜μ§€ μ•Šκ³  데이터 μ†ŒμŠ€ μΆ”κ°€

에 λ§Œλ“  2015λ…„ 04μ›” 15일  Β·  40μ½”λ©˜νŠΈ  Β·  좜처: grafana/grafana

μ•ˆλ…•ν•˜μ„Έμš”,
μ›Ή μΈν„°νŽ˜μ΄μŠ€ 'μ†ŒμŠ€ μΆ”κ°€' μ˜΅μ…˜μ„ μ‚¬μš©ν•˜λŠ” λŒ€μ‹  'λͺ…령쀄 λ˜λŠ” ꡬ성 νŒŒμΌμ—μ„œ' 데이터 μ†ŒμŠ€λ₯Ό μΆ”κ°€ν•  수 μžˆλŠ”μ§€ κΆκΈˆν•©λ‹ˆλ‹€...
influxdb μ„€μΉ˜ + grafana μ„€μΉ˜λ₯Ό μžλ™ν™”ν•˜κ³  grafana 내뢀에 'localhost' influxdb 데이터 μ†ŒμŠ€λ₯Ό μžλ™μœΌλ‘œ μƒμ„±ν•˜λŠ” μ„€μΉ˜ ν”„λ‘œμ„ΈμŠ€λ₯Ό λ§Œλ“€κ³  μ‹ΆμŠ΅λ‹ˆλ‹€. 이것이 κ°€λŠ₯ν•©λ‹ˆκΉŒ?
감사 ν•΄μš”

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

이 문제λ₯Ό λ‹€μ‹œ μ—΄ 수 μžˆμŠ΅λ‹ˆκΉŒ?
μ›ν•˜λŠ” 데이터 μ†ŒμŠ€λ₯Ό μ •μ˜ν•  수 μžˆλŠ” 디렉토리λ₯Ό κ°–κΈ° μœ„ν•΄ dashboards.json 와 μœ μ‚¬ν•œ μ˜΅μ…˜μ„ 맀우 μ›ν•©λ‹ˆλ‹€.

λͺ¨λ“  40 λŒ“κΈ€

μ›Ή APIλ₯Ό 톡해 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.

curl ' http://localhost :3000/api/datasources' -X PUT --data-binary '{"이름":"ν…ŒμŠ€νŠΈ","μœ ν˜•":"influxdb_08","url":" http://localhost :8086","μ•‘μ„ΈμŠ€":"ν”„λ‘μ‹œ","isDefault":true,"λ°μ΄ν„°λ² μ΄μŠ€":"asd","μ‚¬μš©μž":"asd","λΉ„λ°€λ²ˆν˜Έ":"asd"}'

λ¬Έμ œλŠ” μœ„μ˜ μž‘μ—…μ„ μˆ˜ν–‰ν•˜λ €λ©΄ API ν‚€κ°€ ν•„μš”ν•˜κ³  API ν‚€λ₯Ό μƒμ„±ν•˜λ €λ©΄ UIκ°€ ν•„μš”ν•˜λ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€. μ†”λ£¨μ…˜μ€ μ‚¬μš©μž 이름/λΉ„λ°€λ²ˆν˜Έ(예: κ΄€λ¦¬μž μ‚¬μš©μžμ˜ μ‚¬μš©μž 이름/λΉ„λ°€λ²ˆν˜Έ)와 ν•¨κ»˜ APIλ₯Ό μ‚¬μš©ν•  수 μžˆλ„λ‘ ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€.

κ³ λ§ˆμ›Œ, λ‚˜λŠ” 이것을 μ‹œλ„ν•˜κ³  λ³Ό 것이닀 :-)
μ£Όμš” λ¬Έμ œλŠ” μ›Ή API에 λŒ€ν•œ λ¬Έμ„œλ₯Ό 찾을 수 μ—†λ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€... μ•„λ§ˆλ„ μ œκ°€ λ­”κ°€λ₯Ό λ†“μΉ˜κ³  μžˆλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

λ‹€μŒμ€ http μš”μ²­μ„ 보고 νŒŒμƒλœ λͺ‡ 가지 파이썬 μ½”λ“œμž…λ‹ˆλ‹€.

import requests

[ provide credential variables etc ]

grafana_url = os.path.join('http://', '%s:%u' % (grafana_host, grafana_port))
session = requests.Session()
login_post = session.post(
   os.path.join(grafana_url, 'login'),
   data=json.dumps({
      'user': grafana_user,
      'email': '',
      'password': grafana_password }),
   headers={'content-type': 'application/json'})

# Get list of datasources
datasources_get = session.get(os.path.join(grafana_url, 'api', 'datasources'))
datasources = datasources_get.json()

# Add new datasource
datasources_put = session.put(
   os.path.join(grafana_url, 'api', 'datasources'),
   data=json.dumps({
      'access': 'direct',
      'database': ifdb_database,
      'name': datasource_name,
      'password': ifdb_password,
      'type': 'influxdb_08',
      'url': 'http://%s:%u' % (ifdb_host, ifdb_port),
      'user': ifdb_user}),
      headers={'content-type': 'application/json'})

감사 ν•΄μš”,
μ„€μΉ˜μ˜ 일뢀가 될 것이기 λ•Œλ¬Έμ— 'Curl' 방식이 μž½μ„ λ§Œλ“€ 것이라고 μƒκ°ν•©λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ νŒŒμ΄μ¬λ„ μœ μš©ν•  수 μžˆμœΌλ―€λ‘œ μ‹œλ„ν•΄ λ³Ό κ²ƒμž…λ‹ˆλ‹€. λ‹€μ‹œν•œλ²ˆ κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€:-)
μ‹ μž

2.1μ—μ„œ 이것을 더 μ‰½κ²Œ λ§Œλ“€κ³  Web api와 더 μ‰½κ²Œ μƒν˜Έ μž‘μš©ν•  수 μžˆλŠ” CLI 도ꡬ도 λ§Œλ“€λ €κ³  λ…Έλ ₯ν•  κ²ƒμž…λ‹ˆλ‹€.

μ•ˆλ…• 또 토케도
"λ¬Έμ œλŠ” μœ„μ˜ μž‘μ—…μ„ μˆ˜ν–‰ν•˜λ €λ©΄ API ν‚€κ°€ ν•„μš”ν•˜κ³  API ν‚€λ₯Ό μƒμ„±ν•˜λ €λ©΄ UIκ°€ ν•„μš”ν•˜λ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€."
그런 curl λͺ…령을 보내렀고 ν•˜λ©΄ 효과적으둜 {"message":"Access denied"}κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€.
"μ†”λ£¨μ…˜μ€ μ‚¬μš©μž 이름/λΉ„λ°€λ²ˆν˜Έ(예: κ΄€λ¦¬μž μ‚¬μš©μžμ˜ μ‚¬μš©μž 이름/λΉ„λ°€λ²ˆν˜Έ)와 ν•¨κ»˜ APIλ₯Ό μ‚¬μš©ν•  수 있게 ν•˜λŠ” 것"이 β€‹β€‹μ˜λ―Έν•˜λŠ” λ°”λ₯Ό μ„€λͺ…ν•΄ μ£Όμ‹œκ² μŠ΅λ‹ˆκΉŒ?
감사 ν•΄μš”...

μ•ˆλ…•ν•˜μ„Έμš” μ—¬λŸ¬λΆ„,
PRI-mcallen의 Python μ†”λ£¨μ…˜μ€ μ €μ—κ²Œ 잘 λ§žμ•˜μŠ΅λ‹ˆλ‹€ :-) μ €λŠ” κ·Έ 길을 갈 κ²ƒμž…λ‹ˆλ‹€.
λ‚˜λŠ” 주제λ₯Ό λ‹«μŠ΅λ‹ˆλ‹€.
감사 ν•΄μš”!!

@PRI-mcallen λ‚΄ ν™˜κ²½μ— 파이썬 인터프리터가 μ—†κΈ° λ•Œλ¬Έμ— λ‹€μŒμ„ 기반으둜 ν•˜λŠ” 파이썬 μŠ€ν¬λ¦½νŠΈμ— κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€ curl 이것을 μ‹€ν–‰ν•΄μ•Ό ν•˜λ©° λ‹€λ₯Έ μ‚¬λžŒμ—κ²Œ μœ μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

이것은 λ„μ»€μ—μ„œ grafanaλ₯Ό μ‹€ν–‰ν•˜λŠ” 데 μžˆμ–΄ 정말 번거둜운 μΌμž…λ‹ˆλ‹€. 도컀 μ˜€μΌ€μŠ€νŠΈλ ˆμ΄μ…˜ 도ꡬ(maestro-ng)λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€. grafana용 도컀 이미지가 있으며 흑연 데이터 μ†ŒμŠ€λ₯Ό μžλ™μœΌλ‘œ ꡬ성할 수 있기λ₯Ό μ›ν•©λ‹ˆλ‹€. μ˜€μΌ€μŠ€νŠΈλ ˆμ΄μ…˜ λ„κ΅¬λŠ” 흑연 μ»¨ν…Œμ΄λ„ˆλ₯Ό μƒμ„±ν•œ λ‹€μŒ 이에 μ˜μ‘΄ν•˜λŠ” κ·ΈλΌνŒŒλ‚˜ μ»¨ν…Œμ΄λ„ˆλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€. 이 λ„κ΅¬λŠ” 흑연 μ»¨ν…Œμ΄λ„ˆμ˜ μ£Όμ†Œλ₯Ό env λ³€μˆ˜λ‘œ grafana μ»¨ν…Œμ΄λ„ˆμ— μ£Όμž…ν•©λ‹ˆλ‹€. 그래파이트 데이터 μ†ŒμŠ€λ₯Ό μžλ™μœΌλ‘œ κ΅¬μ„±ν•˜κΈ° μœ„ν•΄ grafana μ»¨ν…Œμ΄λ„ˆμ—μ„œ μ‹€ν–‰λ˜λŠ” μ‹œμž‘ μŠ€ν¬λ¦½νŠΈκ°€ ν•„μš”ν•©λ‹ˆλ‹€. μš°λ¦¬λŠ” grafana 1.9μ—μ„œ config.jsλ₯Ό μ‚¬μš©ν•˜μ—¬ 이 μž‘μ—…μ„ μˆ˜ν–‰ν•  수 μžˆμ—ˆμ§€λ§Œ μ§€κΈˆμ€ 이λ₯Ό μˆ˜ν–‰ν•˜λŠ” HTTP API(λ¬Έμ„œν™”λ˜μ§€ μ•ŠμŒ)만 μžˆμŠ΅λ‹ˆλ‹€.

@iangkent , HTTP API(νŠΈλžœμž­μ…˜μ„ 보고 역섀계)λ₯Ό μ‚¬μš©ν•˜λŠ” 방법에 λŒ€ν•œ μ˜ˆλŠ” μœ„μ— κ²Œμ‹œν•œ python μŠ€λ‹ˆνŽ«μ„ μ°Έμ‘°ν•˜μ„Έμš”.

μ•ˆλ…•

@PRI-mcallen이 2.1.0-pre1에 κ²Œμ‹œν•œ python μŠ€λ‹ˆνŽ«μ„ ν…ŒμŠ€νŠΈν•˜κ³  μžˆλŠ”λ° λ­”κ°€ 깨진 것 κ°™μŠ΅λ‹ˆλ‹€(2.0.2 및 2.0.3-pre1μ—μ„œ μž‘λ™ν•˜κΈ° λ•Œλ¬Έμ—)

데이터 μ†ŒμŠ€λ₯Ό μΆ”κ°€ν•˜μ—¬ 얻은 응닡은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.

datasources_put.json()
{u'message': u'찾을 수 μ—†μŒ'}

그리고 grafana λ‘œκ·Έμ—μ„œ :

2015/07/13 11:27:49 [I] μ™„λ£Œ /api/datasources 404 Not Found in 1.169711ms

curl을 직접 μ‚¬μš©ν•˜μ—¬ λ™μΌν•œ λ™μž‘(μΏ ν‚€ 인증 λ˜λŠ” μ‚¬μš©μž/패슀 μ‚¬μš©)을 μ‹œλ„ν–ˆμŠ΅λ‹ˆλ‹€.

컬 --μ‚¬μš©μž κ΄€λ¦¬μž:κ΄€λ¦¬μž \
-X λ„£κΈ° \
-H 'μ½˜ν…μΈ  μœ ν˜•: application/json;charset=UTF-8' \
--data-binary "{\"이름\":\"test4\",\"isDefault\":\"true\",\"μœ ν˜•\":\"influxdb_08\",\"url\":\ " http://localhost :8086\",\"μ•‘μ„ΈμŠ€\":\"ν”„λ‘μ‹œ\",\"λ°μ΄ν„°λ² μ΄μŠ€\":\"ν…ŒμŠ€νŠΈ4\",\"μ‚¬μš©μž\":\"ν…ŒμŠ€νŠΈ4\",\"λΉ„λ°€λ²ˆν˜Έ \":\"ν…ŒμŠ€νŠΈ4\"}" \
" http://172.16.149.149 :3000/api/datasources ".

{"λ©”μ‹œμ§€λ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€"}

λˆ„κ΅¬λ“ μ§€ 문제λ₯Ό ν•΄κ²°ν•˜κ±°λ‚˜ μˆ˜μ •ν•˜λŠ” 방법에 λŒ€ν•œ 아이디어가 μžˆμŠ΅λ‹ˆκΉŒ?

미리 κ°μ‚¬λ“œλ¦½λ‹ˆλ‹€
μ—ν”„λž­

@ 3fr61n 2.1의 HTTP API에 μž‘μ€ μ£Όμš” λ³€κ²½ 사항이 μžˆμŠ΅λ‹ˆλ‹€(λ³€κ²½ λ‘œκ·Έμ— 있음).

데이터 μ†ŒμŠ€ HTTP API μ£Όμš” λ³€κ²½, ADD 데이터 μ†ŒμŠ€λŠ” 이제 POST /api/datasources/, μ—…λ°μ΄νŠΈλŠ” 이제 PUT /api/datasources/:idμž…λ‹ˆλ‹€.

감사 ν•΄μš”!!! μ§€κΈˆ μž‘λ™ν•©λ‹ˆλ‹€

grafana 2.1μ—μ„œλŠ” 이제 κΈ°λ³Έ 인증을 μ‚¬μš©ν•˜μ—¬ API에 λŒ€ν•΄ 인증할 수 μžˆμœΌλ―€λ‘œ λ‘œκ·ΈμΈν•˜κ³  μΏ ν‚€λ₯Ό μ‚¬μš©ν•˜μ—¬ API ν‚€λ₯Ό μƒμ„±ν•˜κ±°λ‚˜ 데이터 μ†ŒμŠ€λ₯Ό μΆ”κ°€ν•  ν•„μš”κ°€ μ—†μŠ΅λ‹ˆλ‹€.
https://github.com/grafana/grafana/issues/2218#issuecomment -117041541

curl -i -XPOST ' http://admin:admin@hostname :3000/api/datasources' --data-binary '{\"이름\":\"influxdb_09x\",\"μœ ν˜•\":\"influxdb \",\"μ•‘μ„ΈμŠ€\":\"ν”„λ‘μ‹œ\",\"url\":\" http://hostname :8086\",\"λΉ„λ°€λ²ˆν˜Έ\":\"루트\",\"μ‚¬μš©μž\" :\"루트\",\"λ°μ΄ν„°λ² μ΄μŠ€\":\"cadvisor\",\"basicAuth\":true,\"basicAuthUser\":\"admin\",\"basicAuthPassword\":\"admin\" ,\"isDefault\":true,\"jsonData\":null}'

"[{"fieldNames":["Name"],"classification":"RequiredError","message":"Required"},{"fieldNames":["Type"],"classification":"이 ν‘œμ‹œλ©λ‹ˆλ‹€. RequiredError","message":"ν•„μˆ˜"},{"fieldNames":["μ•‘μ„ΈμŠ€"],"classification":"RequiredError","message":"ν•„μˆ˜"}]"

헀더 ContentType application/json이 ν•„μš”ν•©λ‹ˆλ‹€.

curl -i -XPOST ' http://admin:admin@hostname :3000/api/datasources' --header "ContentType μ‘μš© ν”„λ‘œκ·Έλž¨/json" --data-binary '{\"이름\":\"influxdb2\", \"μœ ν˜•\":\"influxdb_09x\",\"μ•‘μ„ΈμŠ€\":\"ν”„λ‘μ‹œ\",\"url\":\" http://호슀트 이름 :8086\",\"λΉ„λ°€λ²ˆν˜Έ\":\" root\",\"user\":\"root\",\"database\":\"cadvisor\",\"basicAuth\":true,\"basicAuthUser\":\"admin\",\" basicAuthPassword\":\"admin\",\"isDefault\":true,\"jsonData\":null}'

μ—¬μ „νžˆ μœ„μ˜ 였λ₯˜λ₯Ό λ°˜ν™˜ν•©λ‹ˆλ‹€.

콜둠이 λˆ„λ½λ˜μ—ˆμŠ΅λ‹ˆλ‹€. -H 'Content-Type: application/json;charset=UTF-8' \

곡식 도컀 흑연(hopsoft/graphite-statsd) 및 grafana(grafana/grafana) 이미지λ₯Ό μ‚¬μš©ν•˜κ³  있으며 λ‹€μŒ λͺ…령이 νš¨κ³Όμ μ΄μ—ˆμŠ΅λ‹ˆλ‹€.

curl 'http://admin:[email protected]:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"localGraphite","type":"graphite","url":"http://192.168.99.100","access":"proxy","isDefault":true,"database":"asd"}'

grafana 2.6 및 influxdb 0.10μ—μ„œ λ‹€μŒ 컬이 μ˜¬λ°”λ₯΄κ²Œ μž‘λ™ν•©λ‹ˆλ‹€.

curl 'http://admin:[email protected]:3000/api/datasources' -X POST -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"name":"influx","type":"influxdb","url":"http://localhost:8086","access":"proxy","isDefault":true,"database":"mydb","user":"admin","password":"admin"}'

λ‹€μŒμ„ μ‚¬μš©ν•˜μ—¬ 데이터 μ†ŒμŠ€ ꡬ성을 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.
curl 'http://admin:[email protected]:3000/api/datasources'

이 λ¬Έμ œλŠ” 3월에 μ’…λ£Œλ˜μ—ˆμ§€λ§Œ Dockerμ—μ„œ μ‚¬μš©ν•˜κΈ° μœ„ν•΄ 더 κΉ¨λ—ν•œ λ°©μ‹μœΌλ‘œ 이λ₯Ό μžλ™ν™”ν•  수 μžˆλŠ” 방법이 μžˆμŠ΅λ‹ˆκΉŒ?

이 λ¬Έμ œλŠ” 3월에 μ’…λ£Œλ˜μ—ˆμ§€λ§Œ Dockerμ—μ„œ μ‚¬μš©ν•˜κΈ° μœ„ν•΄ 더 κΉ¨λ—ν•œ λ°©μ‹μœΌλ‘œ 이λ₯Ό μžλ™ν™”ν•  수 μžˆλŠ” 방법이 μžˆμŠ΅λ‹ˆκΉŒ?

run2.sh Dockerμ—μ„œ μˆ˜ν–‰ν•˜λŠ” μž‘μ—…( run.sh 에 grafana/grafana run.sh 이 이미 있음):

echo 'Starting Grafana...'
/run.sh "$@" &
AddDataSource() {
  curl 'http://localhost:3000/api/datasources' \
    -X POST \
    -H 'Content-Type: application/json;charset=UTF-8' \
    --data-binary \
    '{"name":"Prometheus","type":"prometheus","url":"http://prometheus:9090","access":"proxy","isDefault":true}'
}
until AddDataSource; do
  echo 'Configuring Grafana...'
  sleep 1
done
echo 'Done!'
wait

κ·ΈλŸ¬λ‚˜ λ‚˜λŠ” 이것이 맀우 μŠ¬ν”ˆ λ””μžμΈμ΄λΌλŠ” 데 λ™μ˜ν•©λ‹ˆλ‹€. λ‹€λ₯Έ μ‘μš© ν”„λ‘œκ·Έλž¨μ€ μ‹œμž‘ν•˜κΈ° 전에 ꡬ성할 수 μžˆμŠ΅λ‹ˆλ‹€. Grafanaλ₯Ό λ¨Όμ € μ‹œμž‘ν•œ λ‹€μŒ ꡬ성해야 ν•©λ‹ˆλ‹€. 기이 ν•œ.

@torkeloλ‹˜ , Grafana 도ꡬλ₯Ό 잘 μ‚¬μš©ν•˜μ…¨μŠ΅λ‹ˆλ‹€!
λ‹€μŒ λͺ…령을 μ‚¬μš©ν•˜μ—¬ Grafana APIλ₯Ό μ‚¬μš©ν•˜μ—¬ 쑰직에 μ‚¬μš©μžλ₯Ό μΆ”κ°€ν•˜λ €κ³  ν•˜λ©΄ "μ‚¬μš©μžλ₯Ό 찾을 수 μ—†μŒ" 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.

curl 'http://:@:3000/api/orgs/6/users' -X POST -H 'μ½˜ν…μΈ  μœ ν˜•: application/json;charset=UTF-8' --data-binary '{"loginOrEmail": "user1","role":"λ·°μ–΄"}'

μ˜¬λ°”λ₯Έ κΈ°λ³Έ 인증 자격 증λͺ…을 μž…λ ₯ν–ˆμŠ΅λ‹ˆλ‹€. 이 λ¬Έμ œμ— λŒ€ν•œ 해결책이 μžˆμŠ΅λ‹ˆκΉŒ?
감사 ν•΄μš”!

μ‚¬μš©μžλŠ” ν•΄λ‹Ή API 호좜과 ν•¨κ»˜ μ‘΄μž¬ν•΄μ•Ό ν•˜λ©°, μ΄ˆλŒ€ APIλ₯Ό μ‚¬μš©ν•˜μ—¬ μ‚¬μš©μž μ΄ˆλŒ€λ₯Ό 생성할 수 μžˆμŠ΅λ‹ˆλ‹€.

λ˜λŠ” κ°€λŠ₯을 톡해:

# Check that a page returns a status 200 and fail if the word AWESOME is not
# in the page contents.
- uri:
    url: http://localhost:3000/api/datasources/name/Prometheus
    user: admin
    password: changeme
    force_basic_auth: yes
  register: grafana_prometheus
  failed_when: false
  changed_when: false

- name: Enable Prometheus Datasource
  uri:
    url: http://localhost:3000/api/datasources
    method: POST
    user: admin
    password: changeme
    body:
      name: "Prometheus"
      type: "prometheus"
      url: "http://prometheus:9090"
      access: "proxy"
      isDefault: true
    force_basic_auth: yes
    status_code: 201
    body_format: json
  when: grafana_prometheus.status == 404

또 λ‹€λ₯Έ κ°€λŠ₯ν•œ μ‘°μΉ˜λŠ” Grafana의 λ°μ΄ν„°λ² μ΄μŠ€μ— 직접 μž‘μ„±ν•˜λŠ” κ²ƒμž…λ‹ˆλ‹€. λ‚˜λŠ” 일반적으둜 λ°μ΄ν„°λ² μ΄μŠ€λ₯Ό μƒμ„±ν•˜κΈ° μœ„ν•΄ Grafanaλ₯Ό μ‹œμž‘ν•˜κ³  μ€‘μ§€ν•˜κ³  sqliteλ₯Ό μ‚¬μš©ν•˜μ—¬ λ°μ΄ν„°λ² μ΄μŠ€μ— μ†ŒμŠ€λ₯Ό μΆ”κ°€ν•©λ‹ˆλ‹€.

Grafana 4.0.2의 경우 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.

cat <<EOF | sqlite3 grafana.db || echo "Failed to add data source."
INSERT INTO data_source VALUES (2,1,0,'prometheus','prometheus','proxy','http://address',NULL,NULL,NULL,0,NULL,NULL,0,'{}','2017-01-15 20:00:00','2017-01-15 20:00:00',0,'{}');
EOF

CLIλ₯Ό μ‚¬μš©ν•˜μ—¬ 이 μž‘μ—…μ„ μˆ˜ν–‰ν•©λ‹ˆλ‹€. λ‚΄κ°€ Grafanaλ₯Ό μœ„ν•΄ μž‘μ„±ν•œ 도ꡬ - wizzy https://github.com/utkarshcmu/wizzy

이 문제λ₯Ό λ‹€μ‹œ μ—΄ 수 μžˆμŠ΅λ‹ˆκΉŒ?
μ›ν•˜λŠ” 데이터 μ†ŒμŠ€λ₯Ό μ •μ˜ν•  수 μžˆλŠ” 디렉토리λ₯Ό κ°–κΈ° μœ„ν•΄ dashboards.json 와 μœ μ‚¬ν•œ μ˜΅μ…˜μ„ 맀우 μ›ν•©λ‹ˆλ‹€.

여기에도 μ†”νŠΈμŠ€νƒ μƒνƒœμ˜ 덩어리가 μžˆμŠ΅λ‹ˆλ‹€(μœ„μ˜ κ°€λŠ₯ν•œ μ½”λ“œμ™€ 맀우 μœ μ‚¬ν•¨). 그것은 κ½€ μΆ”μ•…ν•˜μ§€λ§Œ μΌμ„ν•˜λŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

  http.query:
    - name: http://localhost:3000/api/datasources
    - method: POST
    - username: admin
    - password: admin
    - data: |
        {"name": "Prometheus",
        "type": "prometheus",
        "url": "http://localhost:9090",
        "access": "proxy",
        "isDefault": true}
    - header_list:
      - 'Content-Type: application/json'
    - status: 200
    - unless:
      - curl -f http://admin:admin<strong i="6">@localhost</strong>:3000/api/datasources/name/Prometheus

이것을 λ‹€μ‹œ μ—΄λ©΄ 컬과 sqliteλ₯Ό μ–΄μ§€λŸ½νžˆλŠ” 것이 λ„μ»€μ—μ„œ 더 μ§œμ¦λ‚©λ‹ˆλ‹€. Dashboard.jsonκ³Ό 같은 κΉ¨λ—ν•œ μ†”λ£¨μ…˜μ€ ꡉμž₯ν•  κ²ƒμž…λ‹ˆλ‹€!

+1 정적 κ΅¬μ„±μ—μ„œ ꡬ성할 수 μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€(예: influxdb 데이터 μ†ŒμŠ€λ₯Ό μ‚¬μš©ν•˜μ—¬ grafanaλ₯Ό μžλ™μœΌλ‘œ μ„€μ •ν•˜κΈ° μœ„ν•΄ docker-composeλ₯Ό μ‚¬μš©ν•  λ•Œ).

+1 json νŒŒμΌμ„ μ‚¬μš©ν•˜λ©΄ μ‚¬μ΄λ“œ 슀크립트λ₯Ό μ‹€ν–‰ν•˜λŠ” λŒ€μ‹  κΌ­λ‘κ°μ‹œμ—μ„œ λ°”λ‘œ 각 ES μΈλ±μŠ€μ— λŒ€ν•œ 데이터 μ†ŒμŠ€λ₯Ό μ‰½κ²Œ 생성할 수 μžˆμŠ΅λ‹ˆλ‹€.

+1

2017λ…„ 5μ›” 25일 λͺ©μš”일 μ˜€ν›„ 5μ‹œ 36λΆ„, Anton Timofieviev [email protected]
썼닀:

json 파일둜 +1 각 ES μΈλ±μŠ€μ— λŒ€ν•œ 데이터 μ†ŒμŠ€λ₯Ό μ‰½κ²Œ 생성할 수 있음
μ‚¬μ΄λ“œ 슀크립트λ₯Ό μ‹€ν–‰ν•˜λŠ” λŒ€μ‹  κΌ­λ‘κ°μ‹œμ—μ„œ λ°”λ‘œ

β€”
이 μŠ€λ ˆλ“œμ— κ°€μž…ν–ˆκΈ° λ•Œλ¬Έμ— 이 λ©”μ‹œμ§€λ₯Ό λ°›κ³  μžˆμŠ΅λ‹ˆλ‹€.
이 이메일에 직접 λ‹΅μž₯ν•˜κ³  GitHubμ—μ„œ ν™•μΈν•˜μ„Έμš”.
https://github.com/grafana/grafana/issues/1789#issuecomment-304026003 ,
λ˜λŠ” μŠ€λ ˆλ“œ μŒμ†Œκ±°
https://github.com/notifications/unsubscribe-auth/AFrnv_CDln7rDTlqZK6r_stAFiek7jaHks5r9ZHfgaJpZM4EBJaL
.

πŸ‘ 데이터 μ†ŒμŠ€μ— λŒ€ν•΄ μ˜μ‚¬λ₯Ό 쿼리할 수 있음(이미 jsonμž„)

HTTP API λ˜λŠ” conf νŒŒμΌμ„ 톡해 탄λ ₯적 검색 μ„ΈλΆ€ 정보(예: 인덱슀 이름, μ‹œκ°„ ν•„λ“œ 이름 및 버전)λ₯Ό κ΅¬μ„±ν•˜λŠ” 방법이 κΆκΈˆν•©λ‹ˆλ‹€. ν•΄λ‹Ή ꡬ성에 λŒ€ν•œ ν‚€λ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€. κΈ°λ³Έ λ™μž‘μ€ λ¬΄μ—‡μž…λ‹ˆκΉŒ? @timtofan이 λ§ν•œ κ²ƒμ²˜λŸΌ 각 μΈλ±μŠ€μ— λŒ€ν•œ 데이터 μ†ŒμŠ€λ₯Ό μƒμ„±ν•©λ‹ˆκΉŒ?

curl --user admin:admin ' http://IPADDR :3000/api/datasources' -X POST -H 'μ½˜ν…μΈ  μœ ν˜•: application/json;charset=UTF-8' --data-binary '{"이름" :"test","type":"prometheus","url":" http://localhost :9090","access":"proxy","basicAuth":false}'

"isDefault": 데이터 μ†ŒμŠ€λ₯Ό κΈ°λ³Έκ°’μœΌλ‘œ λ§Œλ“€λ €λ©΄ true

prometheus 데이터 μ†ŒμŠ€λ₯Ό μΆ”κ°€ν•˜λŠ” 방법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.
curl --user admin:admin ' http://IPADDR :3000/api/datasources' -X POST -H 'μ½˜ν…μΈ  μœ ν˜•: application/json;charset=UTF-8' --data-binary '{"이름" :"test","isDefault":true,"type":"prometheus","url":" http://localhost :9090","access":"proxy","basicAuth":false}'

ꡬ성 파일의 데이터 μ†ŒμŠ€λ₯Ό λͺ¨λ“  쑰직에 μΆ”κ°€ν•  수 μžˆμŠ΅λ‹ˆκΉŒ?
맀우 νŽΈλ¦¬ν•  κ²ƒμž…λ‹ˆλ‹€.

μ’‹μ•„, 이것이 이미 λ‹«ν˜€ μžˆλ‹€λŠ” 것을 μ•Œκ³  μžˆμ§€λ§Œ Grafana 5κ°€ μ½”λ“œμ—μ„œ Dashboardλ₯Ό μ •μ˜ν•  수 μžˆλ‹€λŠ” 것을 κ³΅μœ ν•˜κ³  μ‹Άμ—ˆμŠ΅λ‹ˆλ‹€. μΆ”κ°€ 정보: http://docs.grafana.org/administration/provisioning/#datasources

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰