mirror of
https://github.com/grafana/grafana.git
synced 2025-07-28 11:32:36 +08:00
Docs: Remove feature folder (#27830)
* moved files out of tutorials folder * link update * updated weights * moved Explore * move files and fix links * moved files out of features * Revert "moved files out of features" This reverts commit 5e44cbcc95288d653f9d89f9516c96173d542967. * fixed links
This commit is contained in:
@ -1,23 +0,0 @@
|
||||
+++
|
||||
title = "Tutorials"
|
||||
type = "docs"
|
||||
[menu.docs]
|
||||
identifier = "tutorials"
|
||||
weight = 6
|
||||
+++
|
||||
|
||||
# Tutorials
|
||||
|
||||
This section of the docs contains a series for tutorials and stack setup guides.
|
||||
|
||||
## Articles
|
||||
|
||||
- [API Tutorial: How To Create API Tokens And Dashboards For A Specific Organization]({{< relref "api_org_token_howto.md" >}})
|
||||
- [How to setup Grafana for high availability]({{< relref "ha_setup.md" >}})
|
||||
|
||||
## External links
|
||||
|
||||
- [Installing Graphite and Grafana on RHEL 6, 7, or Ubuntu in under 30 minutes](https://www.beginswithdata.com/2015/09/14/installing-graphite-and-grafana-on-rhel-6-7-or-ubuntu-in-under-30-minutes/)
|
||||
- [Monitoring Urbancode deployments with Docker, Graphite, Grafana, collectd and chef!](http://cloud.boriskuschel.com/2015/08/monitoring-urbancode-deploments-with.html)
|
||||
- [Scripting Grafana dashboards](http://anatolijd.blogspot.se/2014/07/scripting-grafana-dashboards.html)
|
||||
|
@ -1,75 +0,0 @@
|
||||
+++
|
||||
title = "API Tutorial: Create API tokens and dashboards for an organization"
|
||||
type = "docs"
|
||||
keywords = ["grafana", "tutorials", "API", "Token", "Org", "Organization"]
|
||||
[menu.docs]
|
||||
parent = "tutorials"
|
||||
weight = 10
|
||||
+++
|
||||
|
||||
# API Tutorial: Create API tokens and dashboards for an organization
|
||||
|
||||
Use the Grafana API to setup new Grafana organizations or to add dynamically generated dashboards to an existing organization.
|
||||
|
||||
## Authentication
|
||||
|
||||
There are two authentication methods to access the API:
|
||||
|
||||
- Basic authentication: A Grafana Admin user can access some parts of the Grafana API through basic authentication.
|
||||
- API Tokens: All organization actions are accessed through an API Token. An API Token is associated with an organization. It can be used to create dashboards and other components specific for that organization.
|
||||
|
||||
## How to create a new organization and an API Token
|
||||
|
||||
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-organization). 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-organization):
|
||||
```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-for-signed-in-user):
|
||||
```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
|
||||
```
|
||||
|
||||
This should return a response: `{"name":"apikeycurl","key":"eyJrIjoiR0ZXZmt1UFc0OEpIOGN5RWdUalBJTllUTk83VlhtVGwiLCJuIjoiYXBpa2V5Y3VybCIsImlkIjo2fQ=="}`.
|
||||
|
||||
Save the key returned here in your password manager as it is not possible to fetch again it in the future.
|
||||
|
||||
## How to add a dashboard
|
||||
|
||||
Using the Token that was created in the previous step, you can create a dashboard or carry out other actions without having to switch organizations.
|
||||
|
||||
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,
|
||||
"title": "Production Overview",
|
||||
"tags": [ "templated" ],
|
||||
"timezone": "browser",
|
||||
"rows": [
|
||||
{
|
||||
}
|
||||
],
|
||||
"schemaVersion": 6,
|
||||
"version": 0
|
||||
},
|
||||
"overwrite": false
|
||||
}' http://localhost:3000/api/dashboards/db
|
||||
```
|
||||
|
||||
> **Note.** If you export a dashboard for sharing externally using the Share > Export menu in the Grafana UI, you cannot import that dashboard. Instead, click **View JSON** and save it to a file or fetch the JSON output through the API.
|
@ -1,50 +0,0 @@
|
||||
+++
|
||||
title = "Setup Grafana for high availability"
|
||||
type = "docs"
|
||||
keywords = ["grafana", "tutorials", "HA", "high availability"]
|
||||
[menu.docs]
|
||||
parent = "tutorials"
|
||||
weight = 10
|
||||
+++
|
||||
|
||||
# How to setup Grafana for high availability
|
||||
|
||||
Setting up Grafana for high availability is fairly simple. You just need a shared database for storing dashboard, users,
|
||||
and other persistent data. So the default embedded SQLite database will not work, you will have to switch to
|
||||
MySQL or Postgres.
|
||||
|
||||
<div class="text-center">
|
||||
<img src="/img/docs/tutorials/grafana-high-availability.png" max-width= "800px" class="center" />
|
||||
</div>
|
||||
|
||||
## Configure multiple servers to use the same database
|
||||
|
||||
First, you need to setup MySQL or Postgres on another server and configure Grafana to use that database.
|
||||
You can find the configuration for doing that in the [[database]]({{< relref "../administration/configuration.md" >}}#database) section in the grafana config.
|
||||
Grafana will now persist all long term data in the database. How to configure the database for high availability is out of scope for this guide. We recommend finding an expert on for the database you're using.
|
||||
|
||||
## Alerting
|
||||
|
||||
Currently alerting supports a limited form of high availability. Since v4.2.0, alert notifications are deduped when running multiple servers. This means all alerts are executed on every server but alert notifications are only sent once per alert. Grafana does not support load distribution between servers.
|
||||
|
||||
## User sessions
|
||||
|
||||
> After Grafana 6.2 you don't need to configure session storage since the database will be used by default.
|
||||
> If you want to offload the login session data from the database you can configure [remote_cache]({{< relref "../administration/configuration.md" >}}#remote-cache)
|
||||
|
||||
The second thing to consider is how to deal with user sessions and how to configure your load balancer in front of Grafana.
|
||||
Grafana supports two ways of storing session data: locally on disk or in a database/cache-server.
|
||||
If you want to store sessions on disk you can use `sticky sessions` in your load balancer. If you prefer to store session data in a database/cache-server
|
||||
you can use any stateless routing strategy in your load balancer (ex round robin or least connections).
|
||||
|
||||
### Sticky sessions
|
||||
Using sticky sessions, all traffic for one user will always be sent to the same server. Which means that session related data can be
|
||||
stored on disk rather than on a shared database. This is the default behavior for Grafana and if you only want multiple servers for fail over this is a good solution since it requires the least amount of work.
|
||||
|
||||
### Stateless sessions
|
||||
You can also choose to store session data in a Redis/Memcache/Postgres/MySQL which means that the load balancer can send a user to any Grafana server without having to log in on each server. This requires a little bit more work from the operator but enables you to remove/add grafana servers without impacting the user experience.
|
||||
If you use MySQL/Postgres for session storage, you first need a table to store the session data in. More details about that in [[sessions]]({{< relref "../administration/configuration.md" >}}#session)
|
||||
|
||||
For Grafana itself it doesn't really matter if you store the session data on disk or database/redis/memcache. But we recommend using a database/redis/memcache since it makes it easier to manage the grafana servers.
|
||||
|
||||
|
Reference in New Issue
Block a user