Skip to content

Instantly share code, notes, and snippets.

grafana_server_url = "https://localhost:3000"
add_user_endpoint = grafana_server_url + "/api/admin/users/"
user_dict = {
"name": "David Ohana",
"email": "NotMyRealEmail@ibm.com",
"login": "NotMyRealEmail@ibm.com",
"password": "dummypass",
}
response = requests.post(
permission_doc = {"isGrafanaAdmin": True}
grafana_server_url = "https://localhost:3000"
permission_end_point = "{}/api/admin/users/{}/permissions".format(grafana_server_url, user_id)
response = requests.put(permission_end_point,
json=permission_doc,
verify=False,
auth=('admin', grafana_admin_password))
role_doc = {"role": "Admin"}
grafana_server_url = "https://localhost:3000"
patch_user_endpoint = grafana_server_url + "/api/org/users/"
role_end_point = patch_user_endpoint + str(user_id)
r = requests.patch(role_end_point,
json=role_doc,
verify=False,
auth=('admin', grafana_admin_password))
import csv
import json
import logging
import os
import requests
logger = logging.getLogger(__name__)
"""CSV format for users file:
@config_section
class LogConfig:
# enable/disable log output to stdout
console_enabled = True
# minimum log level to show on console
console_level = "INFO"
# enable/disable log output to file
file_enabled = True
@config_custom
def staging():
LogConfig.file_out_folder = "../log-staging"
ElasticConfig.env_name = "staging"
MirrorConfig.batch_hours = 1
[LOG]
file_out_folder = ../log-staging
[ELASTIC]
env_name = staging
[MIRROR]
batch_hours = 1
class DatabaseConfig {
var user = "default_user"
@Secret
var password = "changeme"
var endpoints = listOf("http://localhost:1234")
var unsafeSSL = false
var dbSizeLimits = mapOf("alerts" to 50, "logs" to 200)
}
val settings = KofikoSettings()
.addCli(args) { this.overrideToken = "-o" }
.addEnv()
.addSystemProperties()
.addFiles(
"sample_config.json", "sample_config.ini",
"sample_config.env", "sample_config.properties"
)
// optional setting to print config options with non-default value
total : took 25.59 s (100.00%), 195,015 samples, 131.24 ( 116.68) ms / 1000 samples, 7,619.73 ( 8,570.71) hz
parser : took 17.56 s ( 68.62%), 195,015 samples, 90.05 ( 78.85) ms / 1000 samples, 11,104.39 ( 12,682.72) hz
publish : took 6.02 s ( 23.51%), 175,882 samples, 34.21 ( 32.19) ms / 1000 samples, 29,231.77 ( 31,069.33) hz
split : took 4.95 s ( 19.35%), 175,882 samples, 28.16 ( 25.18) ms / 1000 samples, 35,513.22 ( 39,721.53) hz
drain : took 4.73 s ( 18.50%), 7,484 samples, 632.60 ( 632.60) ms / 1000 samples, 1,580.79 ( 1,580.79) hz
mask : took 0.90 s ( 3.51%), 7,484 samples, 120.15 ( 120.15) ms / 1000 samples, 8,323.22 ( 8,323.22) hz