Library to manage Grafana API
Project description
# grafanacli [![GitHub license](https://img.shields.io/github/license/m0nhawk/grafana_api.svg?style=flat-square)](https://github.com/JeferCatarina/grafanacli/blob/master/LICENSE)
## What the heck is that?
GrafanaCLI is a Python library used to manage Grafana API
## Requirements
Python :: 2
Python :: 3
## Installation
Install the pip package:
```
pip install grafanacli
```
## Usage
```python
from grafanacli import GrafanaAdmin
ga = GrafanaAdmin('http://127.0.0.1:3000')
# Disable SSL verification
ga.verify = False
SSL verification must by disabled after use GrafanaAuth
# Authentication using username and password
ga.GrafanaAuth(Username='admin', Password='admin')
# Authentication using API-Key
ga.GrafanaAuth(AuthType='APIKey', Key='xxxxxxxxxxxxx')
# List your current organization
ga.CurrentOrganization()
# List all organizations
ga.OrganizationList()
# Search Organization
ga.OrganizationSearch('MyOrganization')
# Create Organization
ga.OrganizationCreate('MyNewOrganization')
# Update Organization
ga.OrganizationUpdate('1', 'NewOrganizationName')
Where "1" is the organization Id that will be updated.
# Delete Organization
ga.OrganizationDelete('1')
Where "1" is the organization Id that will be deleted.
# Switch Organization
ga.OrganizationSwitch('2')
Where "2" is the organization Id what I want to switch
# Search dashboard whitout filter
ga.DashboardSearch()
# Search dashboard by title
ga.DashboardSearch(DashboardName='My Dashboard')
# Search dashboard by tag
ga.DashboardSearch(Tag='My Tag')
# Search starred dashboards
ga.DashboardSearch(Starred=True)
# Search dashboard aplying more than one conditition
ga.DashboardSearch(Starred=True, Tag='My Tag')
ga.DashboardSearch(Name='My Dashboard', Tag='My Tag')
ga.DashboardSearch(Name='My Dashboard', Tag='My Tag', Starred=True)
# Download Dashboard
ga.DashboardDownload('DashboardUid', '/tmp/mydash.json')
# Upload Dashboard
ga.DashboardUpload('/tmp/mydash.json', Overwrite=True)
ga.DashboardUpload('/tmp/mydash.json')
ga.DashboardUpload('/tmp/mydash.json, FolderId=3'
```
## License
GrafanaCLI is licensed under the terms of the MIT License (see the
[LICENSE](LICENSE) file).
## What the heck is that?
GrafanaCLI is a Python library used to manage Grafana API
## Requirements
Python :: 2
Python :: 3
## Installation
Install the pip package:
```
pip install grafanacli
```
## Usage
```python
from grafanacli import GrafanaAdmin
ga = GrafanaAdmin('http://127.0.0.1:3000')
# Disable SSL verification
ga.verify = False
SSL verification must by disabled after use GrafanaAuth
# Authentication using username and password
ga.GrafanaAuth(Username='admin', Password='admin')
# Authentication using API-Key
ga.GrafanaAuth(AuthType='APIKey', Key='xxxxxxxxxxxxx')
# List your current organization
ga.CurrentOrganization()
# List all organizations
ga.OrganizationList()
# Search Organization
ga.OrganizationSearch('MyOrganization')
# Create Organization
ga.OrganizationCreate('MyNewOrganization')
# Update Organization
ga.OrganizationUpdate('1', 'NewOrganizationName')
Where "1" is the organization Id that will be updated.
# Delete Organization
ga.OrganizationDelete('1')
Where "1" is the organization Id that will be deleted.
# Switch Organization
ga.OrganizationSwitch('2')
Where "2" is the organization Id what I want to switch
# Search dashboard whitout filter
ga.DashboardSearch()
# Search dashboard by title
ga.DashboardSearch(DashboardName='My Dashboard')
# Search dashboard by tag
ga.DashboardSearch(Tag='My Tag')
# Search starred dashboards
ga.DashboardSearch(Starred=True)
# Search dashboard aplying more than one conditition
ga.DashboardSearch(Starred=True, Tag='My Tag')
ga.DashboardSearch(Name='My Dashboard', Tag='My Tag')
ga.DashboardSearch(Name='My Dashboard', Tag='My Tag', Starred=True)
# Download Dashboard
ga.DashboardDownload('DashboardUid', '/tmp/mydash.json')
# Upload Dashboard
ga.DashboardUpload('/tmp/mydash.json', Overwrite=True)
ga.DashboardUpload('/tmp/mydash.json')
ga.DashboardUpload('/tmp/mydash.json, FolderId=3'
```
## License
GrafanaCLI is licensed under the terms of the MIT License (see the
[LICENSE](LICENSE) file).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for grafanacli-1.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bc17fb0075228dce7958b67521fb75221c225266cb606cfd4e901fc835f0a5c |
|
MD5 | f920f2b99162a30f80e19536aa7f0b61 |
|
BLAKE2b-256 | 77d530d51586855b44544868e334d08f8d9bbfa79e81b9d019c895d709395799 |