mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 10:24:54 -06:00
docs: added bash and http syntax highlighting
This commit is contained in:
parent
e2f0b42d90
commit
823b40a360
@ -19,26 +19,28 @@ Creates a new dashboard or updates an existing dashboard.
|
||||
|
||||
**Example Request for new dashboard**:
|
||||
|
||||
POST /api/dashboards/db HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```http
|
||||
POST /api/dashboards/db HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
|
||||
{
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"title": "Production Overview",
|
||||
"tags": [ "templated" ],
|
||||
"timezone": "browser",
|
||||
"rows": [
|
||||
{
|
||||
}
|
||||
],
|
||||
"schemaVersion": 6,
|
||||
"version": 0
|
||||
},
|
||||
"overwrite": false
|
||||
}
|
||||
{
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"title": "Production Overview",
|
||||
"tags": [ "templated" ],
|
||||
"timezone": "browser",
|
||||
"rows": [
|
||||
{
|
||||
}
|
||||
],
|
||||
"schemaVersion": 6,
|
||||
"version": 0
|
||||
},
|
||||
"overwrite": false
|
||||
}
|
||||
```
|
||||
|
||||
JSON Body schema:
|
||||
|
||||
@ -47,15 +49,17 @@ JSON Body schema:
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 78
|
||||
```http
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 78
|
||||
|
||||
{
|
||||
"slug": "production-overview",
|
||||
"status": "success",
|
||||
"version": 1
|
||||
}
|
||||
{
|
||||
"slug": "production-overview",
|
||||
"status": "success",
|
||||
"version": 1
|
||||
}
|
||||
```
|
||||
|
||||
Status Codes:
|
||||
|
||||
@ -67,14 +71,16 @@ Status Codes:
|
||||
The **412** status code is used when a newer dashboard already exists (newer, its version is greater than the version that was sent). The
|
||||
same status code is also used if another dashboard exists with the same title. The response body will look like this:
|
||||
|
||||
HTTP/1.1 412 Precondition Failed
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 97
|
||||
```http
|
||||
HTTP/1.1 412 Precondition Failed
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
Content-Length: 97
|
||||
|
||||
{
|
||||
"message": "The dashboard has been changed by someone else",
|
||||
"status": "version-mismatch"
|
||||
}
|
||||
{
|
||||
"message": "The dashboard has been changed by someone else",
|
||||
"status": "version-mismatch"
|
||||
}
|
||||
```
|
||||
|
||||
In in case of title already exists the `status` property will be `name-exists`.
|
||||
|
||||
@ -86,34 +92,38 @@ Will return the dashboard given the dashboard slug. Slug is the url friendly ver
|
||||
|
||||
**Example Request**:
|
||||
|
||||
GET /api/dashboards/db/production-overview HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```http
|
||||
GET /api/dashboards/db/production-overview HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"meta": {
|
||||
"isStarred": false,
|
||||
"slug": "production-overview"
|
||||
},
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"title": "Production Overview",
|
||||
"tags": [ "templated" ],
|
||||
"timezone": "browser",
|
||||
"rows": [
|
||||
{
|
||||
}
|
||||
],
|
||||
"schemaVersion": 6,
|
||||
"version": 0
|
||||
{
|
||||
"meta": {
|
||||
"isStarred": false,
|
||||
"slug": "production-overview"
|
||||
},
|
||||
"dashboard": {
|
||||
"id": null,
|
||||
"title": "Production Overview",
|
||||
"tags": [ "templated" ],
|
||||
"timezone": "browser",
|
||||
"rows": [
|
||||
{
|
||||
}
|
||||
}
|
||||
],
|
||||
"schemaVersion": 6,
|
||||
"version": 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Delete dashboard
|
||||
|
||||
@ -123,17 +133,21 @@ The above will delete the dashboard with the specified slug. The slug is the url
|
||||
|
||||
**Example Request**:
|
||||
|
||||
DELETE /api/dashboards/db/test HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```http
|
||||
DELETE /api/dashboards/db/test HTTP/1.1
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
|
||||
```
|
||||
|
||||
**Example Response**:
|
||||
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
```http
|
||||
HTTP/1.1 200
|
||||
Content-Type: application/json
|
||||
|
||||
{"title": "Test"}
|
||||
{"title": "Test"}
|
||||
```
|
||||
|
||||
## Gets the home dashboard
|
||||
|
||||
|
@ -22,10 +22,10 @@ installation.
|
||||
|
||||
## Install Stable
|
||||
|
||||
```
|
||||
$ wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_4.2.0_amd64.deb
|
||||
$ sudo apt-get install -y adduser libfontconfig
|
||||
$ sudo dpkg -i grafana_4.2.0_amd64.deb
|
||||
```bash
|
||||
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana_4.2.0_amd64.deb
|
||||
sudo apt-get install -y adduser libfontconfig
|
||||
sudo dpkg -i grafana_4.2.0_amd64.deb
|
||||
```
|
||||
|
||||
## APT Repository
|
||||
@ -43,18 +43,24 @@ candidates.
|
||||
Then add the [Package Cloud](https://packagecloud.io/grafana) key. This
|
||||
allows you to install signed packages.
|
||||
|
||||
$ curl https://packagecloud.io/gpg.key | sudo apt-key add -
|
||||
```bash
|
||||
curl https://packagecloud.io/gpg.key | sudo apt-key add -
|
||||
```
|
||||
|
||||
Update your Apt repositories and install Grafana
|
||||
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install grafana
|
||||
```bash
|
||||
sudo apt-get update
|
||||
sudo apt-get install grafana
|
||||
```
|
||||
|
||||
On some older versions of Ubuntu and Debian you may need to install the
|
||||
`apt-transport-https` package which is needed to fetch packages over
|
||||
HTTPS.
|
||||
|
||||
$ sudo apt-get install -y apt-transport-https
|
||||
```bash
|
||||
sudo apt-get install -y apt-transport-https
|
||||
```
|
||||
|
||||
## Package details
|
||||
|
||||
@ -70,7 +76,9 @@ HTTPS.
|
||||
|
||||
Start Grafana by running:
|
||||
|
||||
$ sudo service grafana-server start
|
||||
```bash
|
||||
sudo service grafana-server start
|
||||
```
|
||||
|
||||
This will start the `grafana-server` process as the `grafana` user,
|
||||
which was created during the package installation. The default HTTP port
|
||||
@ -78,19 +86,25 @@ is `3000` and default user and group is `admin`.
|
||||
|
||||
To configure the Grafana server to start at boot time:
|
||||
|
||||
$ sudo update-rc.d grafana-server defaults
|
||||
```bash
|
||||
sudo update-rc.d grafana-server defaults
|
||||
```
|
||||
|
||||
## Start the server (via systemd)
|
||||
|
||||
To start the service using systemd:
|
||||
|
||||
$ systemctl daemon-reload
|
||||
$ systemctl start grafana-server
|
||||
$ systemctl status grafana-server
|
||||
```bash
|
||||
systemctl daemon-reload
|
||||
systemctl start grafana-server
|
||||
systemctl status grafana-server
|
||||
```
|
||||
|
||||
Enable the systemd service so that Grafana starts at boot.
|
||||
|
||||
sudo systemctl enable grafana-server.service
|
||||
```bash
|
||||
sudo systemctl enable grafana-server.service
|
||||
```
|
||||
|
||||
## Environment file
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user