mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Update codebox (#9430)
* updated the codeboxes in docs * codebox change from json to http
This commit is contained in:
parent
19b5d91b75
commit
81be4e2612
@ -41,7 +41,7 @@ then there are two flags that can be used to set homepath and the config file pa
|
||||
|
||||
If you have not lost the admin password then it is better to set in the Grafana UI. If you need to set the password in a script then the [Grafana API](http://docs.grafana.org/http_api/user/#change-password) can be used. Here is an example with curl using basic auth:
|
||||
|
||||
```
|
||||
```bash
|
||||
curl -X PUT -H "Content-Type: application/json" -d '{
|
||||
"oldPassword": "admin",
|
||||
"newPassword": "newpass",
|
||||
|
@ -50,11 +50,12 @@ Create a file at `~/.aws/credentials`. That is the `HOME` path for user running
|
||||
|
||||
Example content:
|
||||
|
||||
```bash
|
||||
[default]
|
||||
aws_access_key_id = asdsadasdasdasd
|
||||
aws_secret_access_key = dasdasdsadasdasdasdsa
|
||||
region = us-west-2
|
||||
|
||||
```
|
||||
|
||||
## Metric Query Editor
|
||||
|
||||
@ -117,7 +118,9 @@ Filters syntax:
|
||||
|
||||
Example `ec2_instance_attribute()` query
|
||||
|
||||
```javascript
|
||||
ec2_instance_attribute(us-east-1, InstanceId, { "tag:Environment": [ "production" ] })
|
||||
```
|
||||
|
||||
### Selecting Attributes
|
||||
|
||||
@ -156,7 +159,9 @@ Tags can be selected by prepending the tag name with `Tags.`
|
||||
|
||||
Example `ec2_instance_attribute()` query
|
||||
|
||||
```javascript
|
||||
ec2_instance_attribute(us-east-1, Tags.Name, { "tag:Team": [ "sysops" ] })
|
||||
```
|
||||
|
||||
## Cost
|
||||
|
||||
|
@ -38,8 +38,10 @@ Proxy access means that the Grafana backend will proxy all requests from the bro
|
||||
If you select direct access you must update your Elasticsearch configuration to allow other domains to access
|
||||
Elasticsearch from the browser. You do this by specifying these to options in your **elasticsearch.yml** config file.
|
||||
|
||||
```bash
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
```
|
||||
|
||||
### Index settings
|
||||
|
||||
|
@ -23,12 +23,15 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```bash
|
||||
GET /api/admin/settings
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```bash
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -166,7 +169,8 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
"key_file":"",
|
||||
"password":"************",
|
||||
"skip_verify":"false",
|
||||
"user":""},
|
||||
"user":""
|
||||
},
|
||||
"users":{
|
||||
"allow_org_create":"true",
|
||||
"allow_sign_up":"false",
|
||||
@ -174,7 +178,7 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
"auto_assign_org_role":"Viewer"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Grafana Stats
|
||||
|
||||
`GET /api/admin/stats`
|
||||
@ -183,12 +187,15 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```bash
|
||||
GET /api/admin/stats
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -203,6 +210,7 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
"starred_db_count":2,
|
||||
"grafana_admin_count":2
|
||||
}
|
||||
```
|
||||
|
||||
## Global Users
|
||||
|
||||
@ -211,6 +219,7 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
Create new user. Only works with Basic Authentication (username and password). See [introduction](http://docs.grafana.org/http_api/admin/#admin-api) for an explanation.
|
||||
|
||||
**Example Request**:
|
||||
```json
|
||||
|
||||
POST /api/admin/users HTTP/1.1
|
||||
Accept: application/json
|
||||
@ -222,13 +231,16 @@ Create new user. Only works with Basic Authentication (username and password). S
|
||||
"login":"user",
|
||||
"password":"userpassword"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"id":5,"message":"User created"}
|
||||
```
|
||||
|
||||
## Password for User
|
||||
|
||||
@ -239,18 +251,22 @@ Change password for a specific user.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```json
|
||||
PUT /api/admin/users/2/password HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{"password":"userpassword"}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message": "User password updated"}
|
||||
```
|
||||
|
||||
## Permissions
|
||||
|
||||
@ -260,18 +276,22 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```json
|
||||
PUT /api/admin/users/2/permissions HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
|
||||
{"isGrafanaAdmin": true}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{message: "User permissions updated"}
|
||||
```
|
||||
|
||||
## Delete global User
|
||||
|
||||
@ -281,16 +301,20 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```json
|
||||
DELETE /api/admin/users/2 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{message: "User deleted"}
|
||||
```
|
||||
|
||||
## Pause all alerts
|
||||
|
||||
@ -300,6 +324,7 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```json
|
||||
POST /api/admin/pause-all-alerts HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -307,6 +332,7 @@ Only works with Basic Authentication (username and password). See [introduction]
|
||||
{
|
||||
"paused": true
|
||||
}
|
||||
```
|
||||
|
||||
JSON Body schema:
|
||||
|
||||
@ -314,7 +340,9 @@ JSON Body schema:
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```json
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{state: "new state", message: "alerts pause/un paused", "alertsAffected": 100}
|
||||
```
|
@ -23,11 +23,12 @@ This API can also be used to create, update and delete alert notifications.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/alerts HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
Querystring Parameters:
|
||||
|
||||
These parameters are used as querystring parameters. For example:
|
||||
@ -41,6 +42,7 @@ This API can also be used to create, update and delete alert notifications.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
[
|
||||
@ -63,6 +65,7 @@ This API can also be used to create, update and delete alert notifications.
|
||||
"dashboardUri": "http://grafana.com/dashboard/db/sensors"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Get one alert
|
||||
|
||||
@ -70,13 +73,16 @@ This API can also be used to create, update and delete alert notifications.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/alerts/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
@ -90,6 +96,7 @@ This API can also be used to create, update and delete alert notifications.
|
||||
"executionError": "",
|
||||
"dashboardUri": "http://grafana.com/dashboard/db/sensors"
|
||||
}
|
||||
```
|
||||
|
||||
## Pause alert
|
||||
|
||||
@ -97,6 +104,7 @@ This API can also be used to create, update and delete alert notifications.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/alerts/1/pause HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -105,6 +113,7 @@ This API can also be used to create, update and delete alert notifications.
|
||||
{
|
||||
"paused": true
|
||||
}
|
||||
```
|
||||
|
||||
The :id query parameter is the id of the alert to be paused or unpaused.
|
||||
|
||||
@ -114,6 +123,7 @@ JSON Body Schema:
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
@ -121,6 +131,7 @@ JSON Body Schema:
|
||||
"state": "Paused",
|
||||
"message": "alert paused"
|
||||
}
|
||||
```
|
||||
|
||||
## Get alert notifications
|
||||
|
||||
@ -128,15 +139,17 @@ JSON Body Schema:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/alert-notifications HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -148,6 +161,7 @@ JSON Body Schema:
|
||||
"created": "2017-01-01 12:45",
|
||||
"updated": "2017-01-01 12:45"
|
||||
}
|
||||
```
|
||||
|
||||
## Create alert notification
|
||||
|
||||
@ -155,6 +169,7 @@ JSON Body Schema:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/alert-notifications HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -168,10 +183,11 @@ JSON Body Schema:
|
||||
"addresses": "carl@grafana.com;dev@grafana.com"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
@ -183,6 +199,7 @@ JSON Body Schema:
|
||||
"created": "2017-01-01 12:34",
|
||||
"updated": "2017-01-01 12:34"
|
||||
}
|
||||
```
|
||||
|
||||
## Update alert notification
|
||||
|
||||
@ -190,6 +207,7 @@ JSON Body Schema:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/alert-notifications/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -204,10 +222,11 @@ JSON Body Schema:
|
||||
"addresses: "carl@grafana.com;dev@grafana.com"
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
@ -219,6 +238,7 @@ JSON Body Schema:
|
||||
"created": "2017-01-01 12:34",
|
||||
"updated": "2017-01-01 12:34"
|
||||
}
|
||||
```
|
||||
|
||||
## Delete alert notification
|
||||
|
||||
@ -226,15 +246,19 @@ JSON Body Schema:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/alert-notifications/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
"message": "Notification deleted"
|
||||
}
|
||||
```
|
@ -21,7 +21,7 @@ If basic auth is enabled (it is enabled by default) you can authenticate your HT
|
||||
standard basic auth. Basic auth will also authenticate LDAP users.
|
||||
|
||||
curl example:
|
||||
```
|
||||
```bash
|
||||
?curl http://admin:admin@localhost:3000/api/org
|
||||
{"id":1,"name":"Main Org."}
|
||||
```
|
||||
@ -36,9 +36,11 @@ You use the token in all requests in the `Authorization` header, like this:
|
||||
|
||||
**Example**:
|
||||
|
||||
```http
|
||||
GET http://your.grafana.com/api/dashboards/db/mydash HTTP/1.1
|
||||
Accept: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
The `Authorization` header value should be `Bearer <your api key>`.
|
||||
|
||||
@ -50,13 +52,16 @@ The `Authorization` header value should be `Bearer <your api key>`.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/auth/keys HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -72,6 +77,7 @@ The `Authorization` header value should be `Bearer <your api key>`.
|
||||
"role": "Admin"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Create API Key
|
||||
|
||||
@ -79,6 +85,7 @@ The `Authorization` header value should be `Bearer <your api key>`.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/auth/keys HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -88,6 +95,7 @@ The `Authorization` header value should be `Bearer <your api key>`.
|
||||
"name": "mykey",
|
||||
"role": "Admin"
|
||||
}
|
||||
```
|
||||
|
||||
JSON Body schema:
|
||||
|
||||
@ -96,10 +104,12 @@ JSON Body schema:
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"name":"mykey","key":"eyJrIjoiWHZiSWd3NzdCYUZnNUtibE9obUpESmE3bzJYNDRIc0UiLCJuIjoibXlrZXkiLCJpZCI6MX1="}
|
||||
```
|
||||
|
||||
## Delete API Key
|
||||
|
||||
@ -107,14 +117,17 @@ JSON Body schema:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/auth/keys/3 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
```
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"API key deleted"}
|
||||
```
|
@ -158,13 +158,16 @@ Will return the home dashboard.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/dashboards/home HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -205,6 +208,7 @@ Will return the home dashboard.
|
||||
"version":5
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Tags for Dashboard
|
||||
|
||||
@ -215,13 +219,16 @@ Get all tags of dashboards
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/dashboards/tags HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -235,6 +242,7 @@ Get all tags of dashboards
|
||||
"count":4
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Search Dashboards
|
||||
|
||||
@ -249,13 +257,16 @@ Query parameters:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/search?query=MyDashboard&starred=true&tag=prod HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -269,3 +280,4 @@ Query parameters:
|
||||
"isStarred":false
|
||||
}
|
||||
]
|
||||
```
|
@ -18,13 +18,16 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/datasources HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -46,6 +49,7 @@ parent = "http_api"
|
||||
"jsonData":null
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Get a single data sources by Id
|
||||
|
||||
@ -53,13 +57,16 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/datasources/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -79,6 +86,7 @@ parent = "http_api"
|
||||
"isDefault":false,
|
||||
"jsonData":null
|
||||
}
|
||||
```
|
||||
|
||||
## Get a single data source by Name
|
||||
|
||||
@ -86,13 +94,16 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/datasources/name/test_datasource HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -112,6 +123,7 @@ parent = "http_api"
|
||||
"isDefault":false,
|
||||
"jsonData":null
|
||||
}
|
||||
```
|
||||
|
||||
## Get data source Id by Name
|
||||
|
||||
@ -119,19 +131,23 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/datasources/id/test_datasource HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"id":1
|
||||
}
|
||||
```
|
||||
|
||||
## Create data source
|
||||
|
||||
@ -139,6 +155,7 @@ parent = "http_api"
|
||||
|
||||
**Example Graphite Request**:
|
||||
|
||||
```http
|
||||
POST /api/datasources HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -151,9 +168,11 @@ parent = "http_api"
|
||||
"access":"proxy",
|
||||
"basicAuth":false
|
||||
}
|
||||
```
|
||||
|
||||
**Example CloudWatch Request**:
|
||||
```
|
||||
|
||||
```http
|
||||
POST /api/datasources HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -177,10 +196,12 @@ parent = "http_api"
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"id":1,"message":"Datasource added", "name": "test_datasource"}
|
||||
```
|
||||
|
||||
## Update an existing data source
|
||||
|
||||
@ -188,6 +209,7 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/datasources/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -209,13 +231,16 @@ parent = "http_api"
|
||||
"isDefault":false,
|
||||
"jsonData":null
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Datasource updated", "id": 1, "name": "test_datasource"}
|
||||
```
|
||||
|
||||
## Delete an existing data source by id
|
||||
|
||||
@ -223,17 +248,21 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/datasources/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Data source deleted"}
|
||||
```
|
||||
|
||||
## Delete an existing data source by name
|
||||
|
||||
@ -241,17 +270,21 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/datasources/name/test_datasource HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Data source deleted"}
|
||||
```
|
||||
|
||||
## Data source proxy calls
|
||||
|
||||
|
@ -18,13 +18,16 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/org HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -32,6 +35,7 @@ parent = "http_api"
|
||||
"id":1,
|
||||
"name":"Main Org."
|
||||
}
|
||||
```
|
||||
|
||||
## Get Organisation by Id
|
||||
|
||||
@ -39,13 +43,16 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/orgs/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -61,20 +68,23 @@ parent = "http_api"
|
||||
"country":""
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
## Get Organisation by Name
|
||||
|
||||
`GET /api/orgs/name/:orgName`
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/orgs/name/Main%20Org%2E HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -90,6 +100,7 @@ parent = "http_api"
|
||||
"country":""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Create Organisation
|
||||
|
||||
@ -97,6 +108,7 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/orgs HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -105,10 +117,11 @@ parent = "http_api"
|
||||
{
|
||||
"name":"New Org."
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -116,7 +129,7 @@ parent = "http_api"
|
||||
"orgId":"1",
|
||||
"message":"Organization created"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Update current Organisation
|
||||
@ -125,6 +138,7 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/org HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -133,15 +147,16 @@ parent = "http_api"
|
||||
{
|
||||
"name":"Main Org."
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Organization updated"}
|
||||
|
||||
```
|
||||
|
||||
## Get all users within the actual organisation
|
||||
|
||||
@ -149,13 +164,16 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/org/users HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -168,6 +186,7 @@ parent = "http_api"
|
||||
"role":"Admin"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Add a new user to the actual organisation
|
||||
|
||||
@ -177,6 +196,7 @@ Adds a global user to the actual organisation.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/org/users HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -186,14 +206,16 @@ Adds a global user to the actual organisation.
|
||||
"role": "Admin",
|
||||
"loginOrEmail": "admin"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"User added to organization"}
|
||||
```
|
||||
|
||||
## Updates the given user
|
||||
|
||||
@ -201,6 +223,7 @@ Adds a global user to the actual organisation.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PATCH /api/org/users/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -209,15 +232,16 @@ Adds a global user to the actual organisation.
|
||||
{
|
||||
"role": "Viewer",
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Organization user updated"}
|
||||
|
||||
```
|
||||
|
||||
## Delete user in actual organisation
|
||||
|
||||
@ -225,18 +249,21 @@ Adds a global user to the actual organisation.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/org/users/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"User removed from organization"}
|
||||
|
||||
```
|
||||
|
||||
# Organisations
|
||||
|
||||
@ -246,13 +273,16 @@ Adds a global user to the actual organisation.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/orgs HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -262,6 +292,7 @@ Adds a global user to the actual organisation.
|
||||
"name":"Main Org."
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Update Organisation
|
||||
|
||||
@ -271,6 +302,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/orgs/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -279,14 +311,16 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
{
|
||||
"name":"Main Org 2."
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Organization updated"}
|
||||
```
|
||||
|
||||
## Get Users in Organisation
|
||||
|
||||
@ -294,13 +328,16 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/orgs/1/users HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
[
|
||||
@ -312,6 +349,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
"role":"Admin"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Add User in Organisation
|
||||
|
||||
@ -319,6 +357,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/orgs/1/users HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -328,13 +367,16 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
"loginOrEmail":"user",
|
||||
"role":"Viewer"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"User added to organization"}
|
||||
```
|
||||
|
||||
## Update Users in Organisation
|
||||
|
||||
@ -342,6 +384,7 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PATCH /api/orgs/1/users/2 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -350,13 +393,16 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
{
|
||||
"role":"Admin"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Organization user updated"}
|
||||
```
|
||||
|
||||
## Delete User in Organisation
|
||||
|
||||
@ -364,14 +410,18 @@ Update Organisation, fields *Adress 1*, *Adress 2*, *City* are not implemented y
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/orgs/1/users/2 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"User removed from organization"}
|
||||
```
|
@ -18,13 +18,16 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/frontend/settings HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -55,6 +58,7 @@ parent = "http_api"
|
||||
},
|
||||
"defaultDatasource": "Grafana"
|
||||
}
|
||||
```
|
||||
|
||||
# Login API
|
||||
|
||||
@ -64,14 +68,18 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/login/ping HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message": "Logged in"}
|
||||
```
|
@ -26,17 +26,21 @@ system default value.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/user/preferences HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"theme":"","homeDashboardId":0,"timezone":""}
|
||||
```
|
||||
|
||||
## Update Current User Prefs
|
||||
|
||||
@ -44,6 +48,7 @@ system default value.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/user/preferences HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -54,13 +59,16 @@ system default value.
|
||||
"homeDashboardId":0,
|
||||
"timezone":"utc"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
{"message":"Preferences updated"}
|
||||
```
|
||||
|
||||
## Get Current Org Prefs
|
||||
|
||||
@ -68,17 +76,21 @@ system default value.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/org/preferences HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"theme":"","homeDashboardId":0,"timezone":""}
|
||||
```
|
||||
|
||||
## Update Current Org Prefs
|
||||
|
||||
@ -86,6 +98,7 @@ system default value.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/org/preferences HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -96,10 +109,13 @@ system default value.
|
||||
"homeDashboardId":0,
|
||||
"timezone":"utc"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
|
||||
{"message":"Preferences updated"}
|
||||
```
|
@ -17,6 +17,7 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/snapshots HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -51,6 +52,7 @@ parent = "http_api"
|
||||
},
|
||||
"expires": 3600
|
||||
}
|
||||
```
|
||||
|
||||
JSON Body schema:
|
||||
|
||||
@ -63,6 +65,7 @@ JSON Body schema:
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
@ -71,6 +74,7 @@ JSON Body schema:
|
||||
"key":"YYYYYYY",
|
||||
"url":"myurl/dashboard/snapshot/YYYYYYY"
|
||||
}
|
||||
```
|
||||
|
||||
Keys:
|
||||
|
||||
@ -83,13 +87,16 @@ Keys:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/snapshots/YYYYYYY HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -131,6 +138,7 @@ Keys:
|
||||
"version":5
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Delete Snapshot by Id
|
||||
|
||||
@ -138,14 +146,18 @@ Keys:
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/snapshots/YYYYYYY HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Snapshot deleted. It might take an hour before it's cleared from a CDN cache."}
|
||||
```
|
@ -17,15 +17,18 @@ parent = "http_api"
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/users HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Basic YWRtaW46YWRtaW4=
|
||||
```
|
||||
|
||||
Default value for the `perpage` parameter is `1000` and for the `page` parameter is `1`. Requires basic authentication and that the authenticated user is a Grafana Admin.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -45,6 +48,7 @@ Default value for the `perpage` parameter is `1000` and for the `page` parameter
|
||||
"isAdmin": false
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Search Users with Paging
|
||||
|
||||
@ -52,10 +56,12 @@ Default value for the `perpage` parameter is `1000` and for the `page` parameter
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/users/search?perpage=10&page=1&query=mygraf HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Basic YWRtaW46YWRtaW4=
|
||||
```
|
||||
|
||||
Default value for the `perpage` parameter is `1000` and for the `page` parameter is `1`. The `totalCount` field in the response can be used for pagination of the user list E.g. if `totalCount` is equal to 100 users and the `perpage` parameter is set to 10 then there are 10 pages of users. The `query` parameter is optional and it will return results where the query value is contained in one of the `name`, `login` or `email` fields. Query values with spaces need to be url encoded e.g. `query=Jane%20Doe`.
|
||||
|
||||
@ -63,6 +69,7 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
{
|
||||
@ -86,6 +93,7 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
"page": 1,
|
||||
"perPage": 10
|
||||
}
|
||||
```
|
||||
|
||||
## Get single user by Id
|
||||
|
||||
@ -93,15 +101,17 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/users/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Basic YWRtaW46YWRtaW4=
|
||||
|
||||
```
|
||||
Requires basic authentication and that the authenticated user is a Grafana Admin.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -113,6 +123,7 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
"orgId": 1,
|
||||
"isGrafanaAdmin": true
|
||||
}
|
||||
```
|
||||
|
||||
## Get single user by Username(login) or Email
|
||||
|
||||
@ -120,22 +131,27 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
|
||||
**Example Request using the email as option**:
|
||||
|
||||
```http
|
||||
GET /api/users/lookup?loginOrEmail=user@mygraf.com HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Request using the username as option**:
|
||||
|
||||
```http
|
||||
GET /api/users/lookup?loginOrEmail=admin HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Basic YWRtaW46YWRtaW4=
|
||||
```
|
||||
|
||||
Requires basic authentication and that the authenticated user is a Grafana Admin.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -147,7 +163,7 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
"orgId": 1,
|
||||
"isGrafanaAdmin": true
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## User Update
|
||||
|
||||
@ -155,6 +171,7 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/users/2 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -166,16 +183,18 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
"login":"user",
|
||||
"theme":"light"
|
||||
}
|
||||
```
|
||||
|
||||
Requires basic authentication and that the authenticated user is a Grafana Admin.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"User updated"}
|
||||
|
||||
```
|
||||
|
||||
## Get Organisations for user
|
||||
|
||||
@ -183,15 +202,18 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/users/1/orgs HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Basic YWRtaW46YWRtaW4=
|
||||
```
|
||||
|
||||
Requires basic authentication and that the authenticated user is a Grafana Admin.
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -202,6 +224,7 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
"role":"Admin"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## User
|
||||
|
||||
@ -211,13 +234,16 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/user HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -229,6 +255,7 @@ Requires basic authentication and that the authenticated user is a Grafana Admin
|
||||
"orgId":1,
|
||||
"isGrafanaAdmin":true
|
||||
}
|
||||
```
|
||||
|
||||
## Change Password
|
||||
|
||||
@ -238,6 +265,7 @@ Changes the password for the user
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
PUT /api/user/password HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
@ -248,13 +276,16 @@ Changes the password for the user
|
||||
"newPassword": "new_password",
|
||||
"confirmNew": "confirm_new_password"
|
||||
}
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"User password changed"}
|
||||
```
|
||||
|
||||
## Switch user context for a specified user
|
||||
|
||||
@ -264,15 +295,19 @@ Switch user context to the given organization. Requires basic authentication and
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/users/7/using/2 HTTP/1.1
|
||||
Authorization: Basic YWRtaW46YWRtaW4=
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Active organization changed"}
|
||||
```
|
||||
|
||||
## Switch user context for signed in user
|
||||
|
||||
@ -282,17 +317,21 @@ Switch user context to the given organization.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/user/using/2 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Active organization changed"}
|
||||
```
|
||||
|
||||
## Organisations of the actual User
|
||||
|
||||
@ -302,13 +341,16 @@ Return a list of all organisations of the current user.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
GET /api/user/orgs HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
@ -319,6 +361,7 @@ Return a list of all organisations of the current user.
|
||||
"role":"Admin"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## Star a dashboard
|
||||
|
||||
@ -328,17 +371,21 @@ Stars the given Dashboard for the actual user.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
POST /api/user/stars/dashboard/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Dashboard starred!"}
|
||||
```
|
||||
|
||||
## Unstar a dashboard
|
||||
|
||||
@ -348,14 +395,18 @@ Deletes the starring of the given Dashboard for the actual user.
|
||||
|
||||
**Example Request**:
|
||||
|
||||
```http
|
||||
DELETE /api/user/stars/dashboard/1 HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"message":"Dashboard unstarred"}
|
||||
```
|
@ -15,7 +15,7 @@ weight = 1
|
||||
It should be straight forward to get Grafana up and running behind a reverse proxy. But here are some things that you might run into.
|
||||
|
||||
Links and redirects will not be rendered correctly unless you set the server.domain setting.
|
||||
```
|
||||
```bash
|
||||
[server]
|
||||
domain = foo.bar
|
||||
```
|
||||
@ -28,14 +28,14 @@ Here are some example configurations for running Grafana behind a reverse proxy.
|
||||
|
||||
### Grafana configuration (ex http://foo.bar.com)
|
||||
|
||||
```
|
||||
```bash
|
||||
[server]
|
||||
domain = foo.bar
|
||||
```
|
||||
|
||||
### Nginx configuration
|
||||
|
||||
```
|
||||
```bash
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/www;
|
||||
@ -50,14 +50,14 @@ server {
|
||||
### Examples with **sub path** (ex http://foo.bar.com/grafana)
|
||||
|
||||
#### Grafana configuration with sub path
|
||||
```
|
||||
```bash
|
||||
[server]
|
||||
domain = foo.bar
|
||||
root_url = %(protocol)s://%(domain)s:/grafana
|
||||
```
|
||||
|
||||
#### Nginx configuration with sub path
|
||||
```
|
||||
```bash
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/www;
|
||||
|
@ -37,11 +37,14 @@ A common problem is forgetting to uncomment a line in the `custom.ini` (or `graf
|
||||
All options in the configuration file (listed below) can be overridden
|
||||
using environment variables using the syntax:
|
||||
|
||||
```bash
|
||||
GF_<SectionName>_<KeyName>
|
||||
```
|
||||
|
||||
Where the section name is the text within the brackets. Everything
|
||||
should be upper case, `.` should be replaced by `_`. For example, given these configuration settings:
|
||||
|
||||
```bash
|
||||
# default section
|
||||
instance_name = ${HOSTNAME}
|
||||
|
||||
@ -50,13 +53,15 @@ should be upper case, `.` should be replaced by `_`. For example, given these co
|
||||
|
||||
[auth.google]
|
||||
client_secret = 0ldS3cretKey
|
||||
|
||||
```
|
||||
|
||||
Then you can override them using:
|
||||
|
||||
```bash
|
||||
export GF_DEFAULT_INSTANCE_NAME=my-instance
|
||||
export GF_SECURITY_ADMIN_USER=true
|
||||
export GF_AUTH_GOOGLE_CLIENT_SECRET=newS3cretKey
|
||||
```
|
||||
|
||||
<hr />
|
||||
|
||||
@ -93,11 +98,15 @@ The IP address to bind to. If empty will bind to all interfaces
|
||||
The port to bind to, defaults to `3000`. To use port 80 you need to
|
||||
either give the Grafana binary permission for example:
|
||||
|
||||
```bash
|
||||
$ sudo setcap 'cap_net_bind_service=+ep' /usr/sbin/grafana-server
|
||||
```
|
||||
|
||||
Or redirect port 80 to the Grafana port using:
|
||||
|
||||
```bash
|
||||
$ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000
|
||||
```
|
||||
|
||||
Another way is put a webserver like Nginx or Apache in front of Grafana and have them proxy requests to Grafana.
|
||||
|
||||
@ -312,7 +321,9 @@ You need to create a GitHub OAuth application (you find this under the GitHub
|
||||
settings page). When you create the application you will need to specify
|
||||
a callback URL. Specify this as callback:
|
||||
|
||||
```bash
|
||||
http://<my_grafana_server_name_or_ip>:<grafana_server_port>/login/github
|
||||
```
|
||||
|
||||
This callback URL must match the full HTTP address that you use in your
|
||||
browser to access Grafana, but with the prefix path of `/login/github`.
|
||||
@ -320,6 +331,7 @@ When the GitHub OAuth application is created you will get a Client ID and a
|
||||
Client Secret. Specify these in the Grafana configuration file. For
|
||||
example:
|
||||
|
||||
```bash
|
||||
[auth.github]
|
||||
enabled = true
|
||||
allow_sign_up = true
|
||||
@ -331,6 +343,7 @@ example:
|
||||
api_url = https://api.github.com/user
|
||||
team_ids =
|
||||
allowed_organizations =
|
||||
```
|
||||
|
||||
Restart the Grafana back-end. You should now see a GitHub login button
|
||||
on the login page. You can now login or sign up with your GitHub
|
||||
@ -348,6 +361,7 @@ GitHub. If the authenticated user isn't a member of at least one of the
|
||||
teams they will not be able to register or authenticate with your
|
||||
Grafana instance. For example:
|
||||
|
||||
```bash
|
||||
[auth.github]
|
||||
enabled = true
|
||||
client_id = YOUR_GITHUB_APP_CLIENT_ID
|
||||
@ -357,6 +371,7 @@ Grafana instance. For example:
|
||||
auth_url = https://github.com/login/oauth/authorize
|
||||
token_url = https://github.com/login/oauth/access_token
|
||||
allow_sign_up = true
|
||||
```
|
||||
|
||||
### allowed_organizations
|
||||
|
||||
@ -365,6 +380,7 @@ organizations on GitHub. If the authenticated user isn't a member of at least
|
||||
one of the organizations they will not be able to register or authenticate with
|
||||
your Grafana instance. For example
|
||||
|
||||
```bash
|
||||
[auth.github]
|
||||
enabled = true
|
||||
client_id = YOUR_GITHUB_APP_CLIENT_ID
|
||||
@ -375,6 +391,7 @@ your Grafana instance. For example
|
||||
allow_sign_up = true
|
||||
# space-delimited organization names
|
||||
allowed_organizations = github google
|
||||
```
|
||||
|
||||
<hr>
|
||||
|
||||
@ -385,13 +402,16 @@ Developer Console](https://console.developers.google.com/project). When
|
||||
you create the project you will need to specify a callback URL. Specify
|
||||
this as callback:
|
||||
|
||||
```bash
|
||||
http://<my_grafana_server_name_or_ip>:<grafana_server_port>/login/google
|
||||
```
|
||||
|
||||
This callback URL must match the full HTTP address that you use in your
|
||||
browser to access Grafana, but with the prefix path of `/login/google`.
|
||||
When the Google project is created you will get a Client ID and a Client
|
||||
Secret. Specify these in the Grafana configuration file. For example:
|
||||
|
||||
```bash
|
||||
[auth.google]
|
||||
enabled = true
|
||||
client_id = YOUR_GOOGLE_APP_CLIENT_ID
|
||||
@ -401,6 +421,7 @@ Secret. Specify these in the Grafana configuration file. For example:
|
||||
token_url = https://accounts.google.com/o/oauth2/token
|
||||
allowed_domains = mycompany.com mycompany.org
|
||||
allow_sign_up = true
|
||||
```
|
||||
|
||||
Restart the Grafana back-end. You should now see a Google login button
|
||||
on the login page. You can now login or sign up with your Google
|
||||
@ -418,6 +439,7 @@ This option could be used if have your own oauth service.
|
||||
This callback URL must match the full HTTP address that you use in your
|
||||
browser to access Grafana, but with the prefix path of `/login/generic_oauth`.
|
||||
|
||||
```bash
|
||||
[auth.generic_oauth]
|
||||
enabled = true
|
||||
client_id = YOUR_APP_CLIENT_ID
|
||||
@ -428,6 +450,7 @@ browser to access Grafana, but with the prefix path of `/login/generic_oauth`.
|
||||
api_url =
|
||||
allowed_domains = mycompany.com mycompany.org
|
||||
allow_sign_up = true
|
||||
```
|
||||
|
||||
Set api_url to the resource that returns [OpenID UserInfo](https://connect2id.com/products/server/docs/api/userinfo) compatible information.
|
||||
|
||||
@ -503,21 +526,25 @@ session table manually.
|
||||
|
||||
Mysql Example:
|
||||
|
||||
```bash
|
||||
CREATE TABLE `session` (
|
||||
`key` CHAR(16) NOT NULL,
|
||||
`data` BLOB,
|
||||
`expiry` INT(11) UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`key`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
```
|
||||
|
||||
Postgres Example:
|
||||
|
||||
```bash
|
||||
CREATE TABLE session (
|
||||
key CHAR(16) NOT NULL,
|
||||
data BYTEA,
|
||||
expiry INTEGER NOT NULL,
|
||||
PRIMARY KEY (key)
|
||||
);
|
||||
```
|
||||
|
||||
Postgres valid `sslmode` are `disable`, `require` (default), `verify-ca`, and `verify-full`.
|
||||
|
||||
|
@ -45,13 +45,17 @@ sudo dpkg -i grafana_4.5.2-beta1_amd64.deb
|
||||
|
||||
Add the following line to your `/etc/apt/sources.list` file.
|
||||
|
||||
```bash
|
||||
deb https://packagecloud.io/grafana/stable/debian/ jessie main
|
||||
```
|
||||
|
||||
Use the above line even if you are on Ubuntu or another Debian version.
|
||||
There is also a testing repository if you want beta or release
|
||||
candidates.
|
||||
|
||||
```bash
|
||||
deb https://packagecloud.io/grafana/testing/debian/ jessie main
|
||||
```
|
||||
|
||||
Then add the [Package Cloud](https://packagecloud.io/grafana) key. This
|
||||
allows you to install signed packages.
|
||||
|
@ -14,7 +14,9 @@ weight = 4
|
||||
|
||||
Grafana is very easy to install and run using the offical docker container.
|
||||
|
||||
```bash
|
||||
$ docker run -d -p 3000:3000 grafana/grafana
|
||||
```
|
||||
|
||||
All Grafana configuration settings can be defined using environment
|
||||
variables, this is especially useful when using the above container.
|
||||
@ -26,10 +28,12 @@ folder `/var/lib/grafana` and configuration files is in `/etc/grafana/`
|
||||
folder. You can map these volumes to host folders when you start the
|
||||
container:
|
||||
|
||||
```bash
|
||||
$ docker run -d -p 3000:3000 \
|
||||
-v /var/lib/grafana:/var/lib/grafana \
|
||||
-e "GF_SECURITY_ADMIN_PASSWORD=secret" \
|
||||
grafana/grafana
|
||||
```
|
||||
|
||||
In the above example I map the data folder and sets a configuration option via
|
||||
an `ENV` instruction.
|
||||
|
@ -92,7 +92,7 @@ org_role = "Viewer"
|
||||
By default the configuration expects you to specify a bind DN and bind password. This should be a read only user that can perform LDAP searches.
|
||||
When the user DN is found a second bind is performed with the user provided username & password (in the normal Grafana login form).
|
||||
|
||||
```
|
||||
```bash
|
||||
bind_dn = "cn=admin,dc=grafana,dc=org"
|
||||
bind_password = "grafana"
|
||||
```
|
||||
@ -102,7 +102,7 @@ bind_password = "grafana"
|
||||
If you can provide a single bind expression that matches all possible users, you can skip the second bind and bind against the user DN directly.
|
||||
This allows you to not specify a bind_password in the configuration file.
|
||||
|
||||
```
|
||||
```bash
|
||||
bind_dn = "cn=%s,o=users,dc=grafana,dc=org"
|
||||
```
|
||||
|
||||
|
@ -15,7 +15,7 @@ Installation can be done using [homebrew](http://brew.sh/)
|
||||
|
||||
Install latest stable:
|
||||
|
||||
```
|
||||
```bash
|
||||
brew update
|
||||
brew install grafana
|
||||
```
|
||||
@ -24,7 +24,7 @@ To start grafana look at the command printed after the homebrew install complete
|
||||
|
||||
To upgrade use the reinstall command
|
||||
|
||||
```
|
||||
```bash
|
||||
brew update
|
||||
brew reinstall grafana
|
||||
```
|
||||
@ -34,13 +34,13 @@ brew reinstall grafana
|
||||
You can also install the latest unstable grafana from git:
|
||||
|
||||
|
||||
```
|
||||
```bash
|
||||
brew install --HEAD grafana/grafana/grafana
|
||||
```
|
||||
|
||||
To upgrade grafana if you've installed from HEAD:
|
||||
|
||||
```
|
||||
```bash
|
||||
brew reinstall --HEAD grafana/grafana/grafana
|
||||
```
|
||||
|
||||
@ -48,13 +48,13 @@ brew reinstall --HEAD grafana/grafana/grafana
|
||||
|
||||
To start Grafana using homebrew services first make sure homebrew/services is installed.
|
||||
|
||||
```
|
||||
```bash
|
||||
brew tap homebrew/services
|
||||
```
|
||||
|
||||
Then start Grafana using:
|
||||
|
||||
```
|
||||
```bash
|
||||
brew services start grafana
|
||||
```
|
||||
|
||||
|
@ -26,41 +26,54 @@ installation.
|
||||
|
||||
You can install Grafana using Yum directly.
|
||||
|
||||
```bash
|
||||
$ sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.2-1.x86_64.rpm
|
||||
```
|
||||
|
||||
Or install manually using `rpm`.
|
||||
|
||||
#### On CentOS / Fedora / Redhat:
|
||||
|
||||
```bash
|
||||
$ wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.2-1.x86_64.rpm
|
||||
$ sudo yum install initscripts fontconfig
|
||||
$ sudo rpm -Uvh grafana-4.5.2-1.x86_64.rpm
|
||||
```
|
||||
|
||||
#### On OpenSuse:
|
||||
|
||||
```bash
|
||||
$ sudo rpm -i --nodeps grafana-4.5.2-1.x86_64.rpm
|
||||
```
|
||||
|
||||
## Install via YUM Repository
|
||||
|
||||
Add the following to a new file at `/etc/yum.repos.d/grafana.repo`
|
||||
|
||||
```bash
|
||||
[grafana]
|
||||
name=grafana
|
||||
baseurl=https://packagecloud.io/grafana/stable/el/6/$basearch
|
||||
repo_gpgcheck=1
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://packagecloud.io/gpg.key https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
|
||||
gpgkey=https://packagecloud.io/gpg.key
|
||||
https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
|
||||
sslverify=1
|
||||
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
|
||||
```
|
||||
|
||||
There is also a testing repository if you want beta or release candidates.
|
||||
|
||||
```bash
|
||||
baseurl=https://packagecloud.io/grafana/testing/el/6/$basearch
|
||||
```
|
||||
|
||||
Then install Grafana via the `yum` command.
|
||||
|
||||
```bash
|
||||
$ sudo yum install grafana
|
||||
```
|
||||
|
||||
### RPM GPG Key
|
||||
|
||||
@ -81,7 +94,9 @@ key](https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana).
|
||||
|
||||
You can start Grafana by running:
|
||||
|
||||
```bash
|
||||
$ sudo service grafana-server start
|
||||
```
|
||||
|
||||
This will start the `grafana-server` process as the `grafana` user,
|
||||
which is created during package installation. The default HTTP port is
|
||||
@ -89,17 +104,23 @@ which is created during package installation. The default HTTP port is
|
||||
|
||||
To configure the Grafana server to start at boot time:
|
||||
|
||||
```bash
|
||||
$ sudo /sbin/chkconfig --add grafana-server
|
||||
```
|
||||
|
||||
## Start the server (via systemd)
|
||||
|
||||
```bash
|
||||
$ systemctl daemon-reload
|
||||
$ systemctl start grafana-server
|
||||
$ systemctl status grafana-server
|
||||
```
|
||||
|
||||
### Enable the systemd service to start at boot
|
||||
|
||||
```bash
|
||||
sudo systemctl enable grafana-server.service
|
||||
```
|
||||
|
||||
## Environment file
|
||||
|
||||
@ -138,7 +159,7 @@ for example in alert notifications.
|
||||
|
||||
If the image is missing text make sure you have font packages installed.
|
||||
|
||||
```
|
||||
```bash
|
||||
yum install fontconfig
|
||||
yum install freetype*
|
||||
yum install urw-fonts
|
||||
|
@ -29,7 +29,7 @@ installed grafana to custom location using a binary tar/zip it is usally in `<gr
|
||||
|
||||
#### mysql
|
||||
|
||||
```
|
||||
```bash
|
||||
backup:
|
||||
> mysqldump -u root -p[root_password] [grafana] > grafana_backup.sql
|
||||
|
||||
@ -39,7 +39,7 @@ restore:
|
||||
|
||||
#### postgres
|
||||
|
||||
```
|
||||
```bash
|
||||
backup:
|
||||
> pg_dump grafana > grafana_backup
|
||||
|
||||
@ -54,7 +54,7 @@ and execute the same `dpkg -i` command but with the new package. It will upgrade
|
||||
|
||||
If you used our APT repository:
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install grafana
|
||||
```
|
||||
@ -73,14 +73,14 @@ and execute the same `yum install` or `rpm -i` command but with the new package.
|
||||
|
||||
If you used our YUM repository:
|
||||
|
||||
```
|
||||
```bash
|
||||
sudo yum update grafana
|
||||
```
|
||||
|
||||
### Docker
|
||||
|
||||
This just an example, details depend on how you configured your grafana container.
|
||||
```
|
||||
```bash
|
||||
docker pull grafana
|
||||
docker stop my-grafana-container
|
||||
docker rm my-grafana-container
|
||||
|
@ -23,7 +23,7 @@ The most important fields are the first three, especially the id. The convention
|
||||
|
||||
Examples:
|
||||
|
||||
```
|
||||
```bash
|
||||
raintank-worldping-app
|
||||
grafana-simple-json-datasource
|
||||
grafana-piechart-panel
|
||||
@ -66,7 +66,7 @@ The README.md file is rendered both on Grafana.net and in the plugins section in
|
||||
|
||||
Here is a typical directory structure for a plugin.
|
||||
|
||||
```
|
||||
```bash
|
||||
johnnyb-awesome-datasource
|
||||
|-- dist
|
||||
|-- spec
|
||||
|
@ -45,7 +45,7 @@ The javascript object that communicates with the database and transforms data to
|
||||
|
||||
The Datasource should contain the following functions:
|
||||
|
||||
```
|
||||
```javascript
|
||||
query(options) //used by panels to get data
|
||||
testDatasource() //used by datasource configuration page to make sure the connection is working
|
||||
annotationQuery(options) // used by dashboards to get annotations
|
||||
|
@ -30,37 +30,37 @@ On Linux systems the grafana-cli will assume that the grafana plugin directory i
|
||||
### Grafana-cli Commands
|
||||
|
||||
List available plugins
|
||||
```
|
||||
```bash
|
||||
grafana-cli plugins list-remote
|
||||
```
|
||||
|
||||
Install the latest version of a plugin
|
||||
```
|
||||
```bash
|
||||
grafana-cli plugins install <plugin-id>
|
||||
```
|
||||
|
||||
Install a specific version of a plugin
|
||||
```
|
||||
```bash
|
||||
grafana-cli plugins install <plugin-id> <version>
|
||||
```
|
||||
|
||||
List installed plugins
|
||||
```
|
||||
```bash
|
||||
grafana-cli plugins ls
|
||||
```
|
||||
|
||||
Update all installed plugins
|
||||
```
|
||||
```bash
|
||||
grafana-cli plugins update-all
|
||||
```
|
||||
|
||||
Update one plugin
|
||||
```
|
||||
```bash
|
||||
grafana-cli plugins update <plugin-id>
|
||||
```
|
||||
|
||||
Remove one plugin
|
||||
```
|
||||
```bash
|
||||
grafana-cli plugins remove <plugin-id>
|
||||
```
|
||||
|
||||
@ -73,7 +73,7 @@ The Download URL from Grafana.com API is in this form:
|
||||
`https://grafana.com/api/plugins/<plugin id>/versions/<version number>/download`
|
||||
|
||||
You can specify a local URL by using the `--pluginUrl` option.
|
||||
```
|
||||
```bash
|
||||
grafana-cli --pluginUrl https://nexus.company.com/grafana/plugins/<plugin-id>-<plugin-version>.zip plugins install <plugin-id>
|
||||
```
|
||||
|
||||
@ -84,7 +84,7 @@ To manually install a Plugin via the Grafana.com API:
|
||||
{{< imgbox img="/img/docs/installation-tab.png" caption="Installation Tab" >}}
|
||||
|
||||
2. Use the Grafana API to find the plugin using this url `https://grafana.com/api/plugins/<plugin id from step 1>`. For example: https://grafana.com/api/plugins/jdbranham-diagram-panel should return:
|
||||
```
|
||||
```bash
|
||||
{
|
||||
"id": 145,
|
||||
"typeId": 3,
|
||||
@ -97,7 +97,7 @@ To manually install a Plugin via the Grafana.com API:
|
||||
```
|
||||
|
||||
3. Find the download link:
|
||||
```
|
||||
```bash
|
||||
{
|
||||
"rel": "download",
|
||||
"href": "/plugins/jdbranham-diagram-panel/versions/1.4.0/download"
|
||||
|
@ -20,20 +20,20 @@ dev environment. Grafana ships with its own required backend server; also comple
|
||||
## Get Code
|
||||
Create a directory for the project and set your path accordingly (or use the [default Go workspace directory](https://golang.org/doc/code.html#GOPATH)). Then download and install Grafana into your $GOPATH directory:
|
||||
|
||||
```
|
||||
```bash
|
||||
export GOPATH=`pwd`
|
||||
go get github.com/grafana/grafana
|
||||
```
|
||||
|
||||
On Windows use setx instead of export and then restart your command prompt:
|
||||
```
|
||||
```bash
|
||||
setx GOPATH %cd%
|
||||
```
|
||||
|
||||
You may see an error such as: `package github.com/grafana/grafana: no buildable Go source files`. This is just a warning, and you can proceed with the directions.
|
||||
|
||||
## Building the backend
|
||||
```
|
||||
```bash
|
||||
cd $GOPATH/src/github.com/grafana/grafana
|
||||
go run build.go setup
|
||||
go run build.go build # (or 'go build ./pkg/cmd/grafana-server')
|
||||
@ -45,7 +45,7 @@ to install GCC. We recommend [TDM-GCC](http://tdm-gcc.tdragon.net/download).
|
||||
|
||||
[node-gyp](https://github.com/nodejs/node-gyp#installation) is the Node.js native addon build tool and it requires extra dependencies to be installed on Windows. In a command prompt which is run as administrator, run:
|
||||
|
||||
```
|
||||
```bash
|
||||
npm --add-python-to-path='true' --debug install --global windows-build-tools
|
||||
```
|
||||
|
||||
@ -53,7 +53,7 @@ npm --add-python-to-path='true' --debug install --global windows-build-tools
|
||||
|
||||
For this you need nodejs (v.6+).
|
||||
|
||||
```
|
||||
```bash
|
||||
npm install -g yarn
|
||||
yarn install --pure-lockfile
|
||||
npm run build
|
||||
@ -62,7 +62,7 @@ npm run build
|
||||
## Running Grafana Locally
|
||||
You can run a local instance of Grafana by running:
|
||||
|
||||
```
|
||||
```bash
|
||||
./bin/grafana-server
|
||||
```
|
||||
If you built the binary with `go run build.go build`, run `./bin/grafana-server`
|
||||
@ -76,7 +76,7 @@ Open grafana in your browser (default [http://localhost:3000](http://localhost:3
|
||||
To add features, customize your config, etc, you'll need to rebuild the backend when you change the source code. We use a tool named `bra` that
|
||||
does this.
|
||||
|
||||
```
|
||||
```bash
|
||||
go get github.com/Unknwon/bra
|
||||
|
||||
bra run
|
||||
@ -88,7 +88,7 @@ You'll also need to run `npm run watch` to watch for changes to the front-end (t
|
||||
|
||||
This step builds linux packages and requires that fpm is installed. Install fpm via `gem install fpm`.
|
||||
|
||||
```
|
||||
```bash
|
||||
go run build.go build package
|
||||
```
|
||||
|
||||
|
@ -24,7 +24,7 @@ When a user creates a new dashboard, a new dashboard JSON object is initialized
|
||||
|
||||
> Note: In the following JSON, id is shown as null which is the default value assigned to it until a dashboard is saved. Once a dashboard is saved, an integer value is assigned to the `id` field.
|
||||
|
||||
```
|
||||
```json
|
||||
{
|
||||
"id": null,
|
||||
"title": "New dashboard",
|
||||
|
@ -43,7 +43,7 @@ You also get a link to service side rendered PNG of the panel. Useful if you wan
|
||||
|
||||
Example of a link to a server-side rendered PNG:
|
||||
|
||||
```
|
||||
```bash
|
||||
http://play.grafana.org/render/dashboard-solo/db/grafana-play-home?orgId=1&panelId=4&from=1499272191563&to=1499279391563&width=1000&height=500&tz=UTC%2B02%3A00&timeout=5000
|
||||
```
|
||||
|
||||
|
@ -22,24 +22,24 @@ Some parts of the API are only available through basic authentication and these
|
||||
The task is to create a new organization and then add a Token that can be used by other users. In the examples below which use basic auth, the user is `admin` and the password is `admin`.
|
||||
|
||||
1. [Create the org](http://docs.grafana.org/http_api/org/#create-organisation). Here is an example using curl:
|
||||
```
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" -d '{"name":"apiorg"}' http://admin:admin@localhost:3000/api/orgs
|
||||
```
|
||||
|
||||
This should return a response: `{"message":"Organization created","orgId":6}`. Use the orgId for the next steps.
|
||||
|
||||
2. Optional step. If the org was created previously and/or step 3 fails then first [add your Admin user to the org](http://docs.grafana.org/http_api/org/#add-user-in-organisation):
|
||||
```
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" -d '{"loginOrEmail":"admin", "role": "Admin"}' http://admin:admin@localhost:3000/api/orgs/<org id of new org>/users
|
||||
```
|
||||
|
||||
3. [Switch the org context for the Admin user to the new org](http://docs.grafana.org/http_api/user/#switch-user-context):
|
||||
```
|
||||
```bash
|
||||
curl -X POST http://admin:admin@localhost:3000/api/user/using/<id of new org>
|
||||
```
|
||||
|
||||
4. [Create the API token](http://docs.grafana.org/http_api/auth/#create-api-key):
|
||||
```
|
||||
```bash
|
||||
curl -X POST -H "Content-Type: application/json" -d '{"name":"apikeycurl", "role": "Admin"}' http://admin:admin@localhost:3000/api/auth/keys
|
||||
```
|
||||
|
||||
@ -53,7 +53,7 @@ Using the Token that was created in the previous step, you can create a dashboar
|
||||
|
||||
1. [Add a dashboard](http://docs.grafana.org/http_api/dashboard/#create-update-dashboard) using the key (or bearer token as it is also called):
|
||||
|
||||
```
|
||||
```bash
|
||||
curl -X POST --insecure -H "Authorization: Bearer eyJrIjoiR0ZXZmt1UFc0OEpIOGN5RWdUalBJTllUTk83VlhtVGwiLCJuIjoiYXBpa2V5Y3VybCIsImlkIjo2fQ==" -H "Content-Type: application/json" -d '{
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
|
@ -39,9 +39,9 @@ read the official [Getting Started With Hubot](https://hubot.github.com/docs/) g
|
||||
## Install Hubot-Grafana script
|
||||
|
||||
In your Hubot project repo install the Grafana plugin using `npm`:
|
||||
|
||||
```bash
|
||||
npm install hubot-grafana --save
|
||||
|
||||
```
|
||||
Edit the file external-scripts.json, and add hubot-grafana to the list of plugins.
|
||||
|
||||
```json
|
||||
@ -56,6 +56,7 @@ Edit the file external-scripts.json, and add hubot-grafana to the list of plugin
|
||||
|
||||
The `hubot-grafana` plugin requires a number of environment variables to be set in order to work properly.
|
||||
|
||||
```bash
|
||||
export HUBOT_GRAFANA_HOST=http://play.grafana.org
|
||||
export HUBOT_GRAFANA_API_KEY=abcd01234deadbeef01234
|
||||
export HUBOT_GRAFANA_S3_BUCKET=mybucket
|
||||
@ -63,6 +64,7 @@ The `hubot-grafana` plugin requires a number of environment variables to be set
|
||||
export HUBOT_GRAFANA_S3_SECRET_ACCESS_KEY=aBcD01234dEaDbEef01234
|
||||
export HUBOT_GRAFANA_S3_PREFIX=graphs
|
||||
export HUBOT_GRAFANA_S3_REGION=us-standard
|
||||
```
|
||||
|
||||
### Grafana server side rendering
|
||||
|
||||
@ -112,7 +114,9 @@ can create hubot command aliases with the hubot script `hubot-alias`.
|
||||
|
||||
Install it:
|
||||
|
||||
```bash
|
||||
npm i --save hubot-alias
|
||||
```
|
||||
|
||||
Now add `hubot-alias` to the list of plugins in `external-scripts.json` and restart hubot.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user