community.grafana
community.grafana copied to clipboard
mssql datasource
SUMMARY
Added support for mssql as a datasource. It might be possible to better support some options, but this is working for me.
ISSUE TYPE
Feature Pull Request
COMPONENT NAME
grafana_datasource
ADDITIONAL INFORMATION
I'm not really sure what to add. I'm using this to add Microsoft SQL Server datasources to Grafana for a tool called SQLWATCH.
ok: [vmdbtest01] => {
"datasource": {
"changed": true,
"datasource": {
"access": "proxy",
"basicAuth": false,
"basicAuthUser": "",
"database": "SQLWATCH",
"id": 2,
"isDefault": false,
"jsonData": {
"timeInterval": "5s",
"tlsAuth": false,
"tlsAuthWithCACert": false
},
"name": "vmdbtest01 SQLWATCH",
"orgId": 1,
"readOnly": false,
"secureJsonFields": {
"password": true
},
"type": "mssql",
"typeLogoUrl": "",
"uid": "xxxxx",
"url": "vmdbtest01.company.com",
"user": "sqlwatch",
"version": 1,
"withCredentials": false
},
"diff": {
"after": {
"access": "proxy",
"basicAuth": false,
"database": "SQLWATCH",
"isDefault": false,
"jsonData": {
"timeInterval": "5s",
"tlsAuth": false,
"tlsAuthWithCACert": false
},
"name": "vmdbtest01 SQLWATCH",
"orgId": 1,
"type": "mssql",
"url": "vmdbtest01.company.com",
"user": "sqlwatch",
"withCredentials": false
},
"before": {
"access": "proxy",
"basicAuth": false,
"database": "",
"isDefault": false,
"jsonData": {
"authenticationType": "Windows Authentication",
"connMaxLifetime": 14400,
"database": "SQLWATCH",
"maxIdleConns": 100,
"maxIdleConnsAuto": true,
"maxOpenConns": 100,
"timeInterval": "5s",
"tlsAuth": false,
"tlsAuthWithCACert": false
},
"name": "vmdbtest01 SQLWATCH",
"orgId": 1,
"type": "mssql",
"url": "vmdbtest01.company.com",
"user": "",
"withCredentials": false
}
},
"failed": false,
"msg": "Datasource vmdbtest01 SQLWATCH updated"
}
}
Just realized I have a typeo in my first commit. There's not a way to fix it here without opening a new PR, is there?
Hello @ImNtReal . Thanks for your MR, you can do a git rebase origin main
and squash the 2nt commit, then git push your branch --force.
Also, can you add a changelog fragment please ?
@seuf sorry it took me so long to get back around to this. I've added a changelog fragment.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
ff49e95
) 69.63% compared to head (8e1ab84
) 71.06%.
Additional details and impacted files
@@ Coverage Diff @@
## main #307 +/- ##
==========================================
+ Coverage 69.63% 71.06% +1.42%
==========================================
Files 9 18 +9
Lines 1166 1863 +697
Branches 255 321 +66
==========================================
+ Hits 812 1324 +512
- Misses 204 397 +193
+ Partials 150 142 -8
Flag | Coverage Δ | |
---|---|---|
integration | 69.81% <100.00%> (+0.17%) |
:arrow_up: |
sanity | 23.70% <0.00%> (?) |
|
units | 65.59% <0.00%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
Files | Coverage Δ | |
---|---|---|
plugins/modules/grafana_datasource.py | 76.71% <100.00%> (+2.64%) |
:arrow_up: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hey @ImNtReal,
would you mind creating some integration-tests for this PR? :)