This module provide a simple collection of Powershell commandlet to manage Grafana by the REST API.
Simple manage Grafana users, folder, permissions ... with a windows commande line tool.
This module required at least Powershell version 5. (I've seen some problems with version 4 and JSON dashboard importation, maybe all other commandlets work great)
All contribution are welcome !
To simplify multiple operations, there is some commandlet to store credential. You can use this functions :
- Storing username / password credential and target URL :
Connect-Grafana -authLogin foobar -authPassword myPassword -url https://foo.bar.com
- Storing API key credential and target URL :
Connect-Grafana -authToken f00barazertyMynAme1sWa11t3rWh1t3 -url https://foo.bar.com
- Define the "context" (working organisation for the authenticated user with plaintext method) :
Set-Grafana-Context -url "https://foobar.fr" -authLogin admin -authPassword Passw0rd -orgName "foo bar org."
- DisConnect- commandlet
Disconnect-Grafana
All commandlet can be used with authentications parameters. Refer to the next chapter for more informations.
Use Get-Help to display all features of a commandlet. By example, "get-help -full New-GrafanaDashboard" will show you that you could create a new dashboard from a template and how to use it.
I referenced here all commandlets that will be usefull.
All of them are not developed at this time. I just coded the ones I needed for my job.
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaSettings | Link | Token & Plaintext | not started |
Get-GrafanaStats | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaAlerts | Link | Token & Plaintext | not started |
Pause-GrafanaAlerts | Link | Token & Plaintext | not started |
Get-GrafanaAlertsNotifications | Link | Token & Plaintext | not started |
New-GrafanaAlertsNotifications | Link | Token & Plaintext | not started |
Set-GrafanaAlertsNotifications | Link | Token & Plaintext | not started |
Remove-GrafanaAlertsNotifications | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaAnnotations | Link | Token & Plaintext | not started |
New-GrafanaAnnotations | Link | Token & Plaintext | not started |
Set-GrafanaAnnotations | Link | Token & Plaintext | not started |
Remove-GrafanaAnnotations | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
New-GrafanaApikey | Link | Token & Plaintext | not started |
Remove-GrafanaApikey | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
New-GrafanaDashboard | Link | Token & Plaintext | OK |
Get-GrafanaDashboard | Link | Token & Plaintext | OK |
Get-GrafanaDashboardContent | Token & Plaintext | OK | |
Move-GrafanaDashboard | Token & Plaintext | OK | |
Remove-GrafanaDashboard | Link | Token & Plaintext | OK |
Set-GrafanaDashboard | Custom function to move or rename a dashboard | Token & Plaintext | OK |
Get-GrafanaHomeDashboard | Link | Token & Plaintext | not started |
Get-GrafanaDashboardVersion | Link | Token & Plaintext | OK |
Restore-GrafanaDashboard | Link | Token & Plaintext | not started |
Compare-GrafanaHomeDashboard | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaDatasource | Link | Token & Plaintext | OK |
New-GrafanaDatasource | Link | Token & Plaintext | not started |
Set-GrafanaDatasource | Link | Token & Plaintext | not started |
Remove-GrafanaDatasource | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaFoldersList | Link | Token & Plaintext | OK |
Get-GrafanaFolder | Token & Plaintext | OK | |
New-GrafanaFolder | Link | Token & Plaintext | OK |
Remove-GrafanaFolder | Link | Token & Plaintext | OK |
Set-GrafanaFolder | Link | Token & Plaintext | OK |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaOrganisation | Link | Plaintext only | OK |
New-GrafanaOrganisation | Link | Plaintext only | OK |
Set-GrafanaOrganisation | Link | Plaintext only | OK |
Add-GrafanaUserInOrganisation | Link | Plaintext only | OK |
Get-GrafanaOrganisationUsers | Link | Plaintext only | OK |
Set-GrafanaUserRoleInOrganisation | Link | Token & Plaintext | OK |
Remove-GrafanaUserFromOrganisation | Link | Token & Plaintext | OK |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaFolderPermissions | Link | Token & Plaintext | OK |
New-GrafanaFolderPermissions | Link | Token & Plaintext | OK |
Remove-GrafanaFolderPermissions | Link | Token & Plaintext | OK |
Get-GrafanaDashboardPermissions | Link | Token & Plaintext | OK |
New-GrafanaDashboardPermissions | Link | Token & Plaintext | OK |
Remove-GrafanaDashboardPermissions | Link | Token & Plaintext | OK |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaSettings | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaCurrentUserPrefs | Link | Token & Plaintext | not started |
Set-GrafanaCurrentUserPrefs | Link | Token & Plaintext | not started |
Get-GrafanaCurrentOrgPrefs | Link | Token & Plaintext | not started |
Set-GrafanaCurrentOrgPrefs | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
New-GrafanaSnapshot | Link | Token & Plaintext | not started |
Get-GrafanaSnapshot | Link | Token & Plaintext | not started |
Remove-GrafanaSnapshot | Link | Token & Plaintext | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
New-GrafanaTeam | Link | Token & Plaintext | OK |
Get-GrafanaTeam | Link | Token & Plaintext | OK |
Set-GrafanaTeam | Link | Token & Plaintext | OK |
Remove-GrafanaTeam | Link | Token & Plaintext | OK |
Get-GrafanaTeamMembers | Link | Token & Plaintext | OK |
Add-GrafanaTeamMember | Link | Plaintext only | OK |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Get-GrafanaUser | Link | Plaintext only | OK |
New-GrafanaUser | Link | Plaintext only | OK |
Set-GrafanaUser | Link | Plaintext only | OK |
Get-GrafanaUserOrgs | Link | Plaintext only | OK |
Remove-GrafanaUser | Link | Plaintext only | OK |
Set-GrafanaContext | Link | Plaintext only | OK |
Set-StarGrafanaDashboard | Link | Token & Plaintex | not started |
Commandlet | Official API documentation | Authentication | Status |
---|---|---|---|
Connect-Grafana | See chapter 'Common features' | Token & Plaintext | OK |
Disconnect-Grafana | See chapter 'Common features' | OK |
- Code all commandlets
- Improve parameter verifications
- Add pipe features