Python模块和脚本,用于从LDAP邀请人员加入Grafana
项目描述
grafana-inviter
通常通过Grafana UI邀请人员加入Grafana组织。对于较小的组来说这可能是容易的,但对于大量人员来说,人们更愿意不麻烦地在UI中操作,而是以自动化的方式操作。
该工具旨在向从LDAP获取的人员发送邀请以加入新的Grafana组织。
安装
$ python setup.py install
或
$ pip install grafana-inviter
用法
- 复制example_config.json配置并调整以满足您的需求
- 使用管理员权限生成Grafana API令牌(https://<YOUR_GRAFANA_URL>/org/apikeys)
- 确保您已创建用于搜索的LDAP服务帐户用户
$ grafana-inviter --grafana-token "<YOUR_GF_TOKEN_WITH>" --ldap-user <YOUR_SVC_ACCOUNT_USER> --config config.json --ask-ldap-password
LDAP password:
Sending invite to John Doe (John Doe@acme.org)
{'name': 'John Doe', 'loginOrEmail': 'John.Doe@acme.org', 'role': 'Viewer', 'sendEmail': False, 'orgId': 10}
> User John.Doe@acme.org is already added to organization
Sending invite to Jane Doe (Jane.Doe@acme.org)
{'name': 'Jane Doe', 'loginOrEmail': 'Jane.Doe@acme.org', 'role': 'Viewer', 'sendEmail': False, 'orgId': 10}
> Created invite for Jane.Doe@acme.org
Available invite URLs: ['https://<YOUR_GRAFANA_URL>/invite/Vv4Q8SYVyk7ULGpeWvjMXl0iuWLl67']