config.html 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <h3 class="page-heading">MySQL Connection</h3>
  2. <div class="gf-form-group">
  3. <div class="gf-form max-width-30">
  4. <span class="gf-form-label width-7">Host</span>
  5. <input type="text" class="gf-form-input" ng-model='ctrl.current.url' placeholder="localhost:3306" bs-typeahead="{{['localhost:3306', 'localhost:3307']}}" required></input>
  6. </div>
  7. <div class="gf-form max-width-30">
  8. <span class="gf-form-label width-7">Database</span>
  9. <input type="text" class="gf-form-input" ng-model='ctrl.current.database' placeholder="database name" required></input>
  10. </div>
  11. <div class="gf-form-inline">
  12. <div class="gf-form max-width-15">
  13. <span class="gf-form-label width-7">User</span>
  14. <input type="text" class="gf-form-input" ng-model='ctrl.current.user' placeholder="user"></input>
  15. </div>
  16. <div class="gf-form max-width-15">
  17. <span class="gf-form-label width-7">Password</span>
  18. <input type="password" class="gf-form-input" ng-model='ctrl.current.password' placeholder="password"></input>
  19. </div>
  20. </div>
  21. <div class="gf-form-group">
  22. <div class="gf-form-inline">
  23. <gf-form-switch class="gf-form" label="TLS Client Auth" label-class="width-10" checked="ctrl.current.jsonData.tlsAuth"
  24. switch-class="max-width-6"></gf-form-switch>
  25. <gf-form-switch class="gf-form" label="With CA Cert" tooltip="Needed for verifing self-signed TLS Certs" checked="ctrl.current.jsonData.tlsAuthWithCACert"
  26. label-class="width-11" switch-class="max-width-6"></gf-form-switch>
  27. </div>
  28. <div class="gf-form-inline">
  29. <gf-form-switch class="gf-form" label="Skip TLS Verify" label-class="width-10" checked="ctrl.current.jsonData.tlsSkipVerify"
  30. switch-class="max-width-6"></gf-form-switch>
  31. </div>
  32. </div>
  33. <div class="gf-form-group" ng-if="(ctrl.current.jsonData.tlsAuth || ctrl.current.jsonData.tlsAuthWithCACert)">
  34. <div class="gf-form">
  35. <h6>TLS Auth Details</h6>
  36. <info-popover mode="header">TLS Certs are encrypted and stored in the Grafana database.</info-popover>
  37. </div>
  38. <div ng-if="ctrl.current.jsonData.tlsAuthWithCACert">
  39. <div class="gf-form-inline">
  40. <div class="gf-form gf-form--v-stretch">
  41. <label class="gf-form-label width-7">CA Cert</label>
  42. </div>
  43. <div class="gf-form gf-form--grow" ng-if="!ctrl.current.secureJsonFields.tlsCACert">
  44. <textarea rows="7" class="gf-form-input gf-form-textarea" ng-model="ctrl.current.secureJsonData.tlsCACert"
  45. placeholder="Begins with -----BEGIN CERTIFICATE-----"></textarea>
  46. </div>
  47. <div class="gf-form" ng-if="ctrl.current.secureJsonFields.tlsCACert">
  48. <input type="text" class="gf-form-input max-width-12" disabled="disabled" value="configured">
  49. <a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.current.secureJsonFields.tlsCACert = false">reset</a>
  50. </div>
  51. </div>
  52. </div>
  53. <div ng-if="ctrl.current.jsonData.tlsAuth">
  54. <div class="gf-form-inline">
  55. <div class="gf-form gf-form--v-stretch">
  56. <label class="gf-form-label width-7">Client Cert</label>
  57. </div>
  58. <div class="gf-form gf-form--grow" ng-if="!ctrl.current.secureJsonFields.tlsClientCert">
  59. <textarea rows="7" class="gf-form-input gf-form-textarea" ng-model="ctrl.current.secureJsonData.tlsClientCert"
  60. placeholder="Begins with -----BEGIN CERTIFICATE-----" required></textarea>
  61. </div>
  62. <div class="gf-form" ng-if="ctrl.current.secureJsonFields.tlsClientCert">
  63. <input type="text" class="gf-form-input max-width-12" disabled="disabled" value="configured">
  64. <a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.current.secureJsonFields.tlsClientCert = false">reset</a>
  65. </div>
  66. </div>
  67. <div class="gf-form-inline">
  68. <div class="gf-form gf-form--v-stretch">
  69. <label class="gf-form-label width-7">Client Key</label>
  70. </div>
  71. <div class="gf-form gf-form--grow" ng-if="!ctrl.current.secureJsonFields.tlsClientKey">
  72. <textarea rows="7" class="gf-form-input gf-form-textarea" ng-model="ctrl.current.secureJsonData.tlsClientKey"
  73. placeholder="Begins with -----BEGIN RSA PRIVATE KEY-----" required></textarea>
  74. </div>
  75. <div class="gf-form" ng-if="ctrl.current.secureJsonFields.tlsClientKey">
  76. <input type="text" class="gf-form-input max-width-12" disabled="disabled" value="configured">
  77. <a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.current.secureJsonFields.tlsClientKey = false">reset</a>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. <b>Connection limits</b>
  84. <div class="gf-form-group">
  85. <div class="gf-form max-width-15">
  86. <span class="gf-form-label width-7">Max open</span>
  87. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxOpenConns" placeholder="unlimited"></input>
  88. <info-popover mode="right-absolute">
  89. The maximum number of open connections to the database. If <i>Max idle connections</i> is greater than 0 and the
  90. <i>Max open connections</i> is less than <i>Max idle connections</i>, then <i>Max idle connections</i> will be
  91. reduced to match the <i>Max open connections</i> limit. If set to 0, there is no limit on the number of open
  92. connections.
  93. </info-popover>
  94. </div>
  95. <div class="gf-form max-width-15">
  96. <span class="gf-form-label width-7">Max idle</span>
  97. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxIdleConns" placeholder="2"></input>
  98. <info-popover mode="right-absolute">
  99. The maximum number of connections in the idle connection pool. If <i>Max open connections</i> is greater than 0 but
  100. less than the <i>Max idle connections</i>, then the <i>Max idle connections</i> will be reduced to match the
  101. <i>Max open connections</i> limit. If set to 0, no idle connections are retained.
  102. </info-popover>
  103. </div>
  104. <div class="gf-form max-width-15">
  105. <span class="gf-form-label width-7">Max lifetime</span>
  106. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.connMaxLifetime" placeholder="14400"></input>
  107. <info-popover mode="right-absolute">
  108. The maximum amount of time in seconds a connection may be reused. If set to 0, connections are reused forever.<br/><br/>
  109. This should always be lower than configured <a href="https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout" target="_blank">wait_timeout</a> in MySQL.
  110. </info-popover>
  111. </div>
  112. </div>
  113. <h3 class="page-heading">MySQL details</h3>
  114. <div class="gf-form-group">
  115. <div class="gf-form-inline">
  116. <div class="gf-form">
  117. <span class="gf-form-label width-9">Min time interval</span>
  118. <input type="text" class="gf-form-input width-6" ng-model="ctrl.current.jsonData.timeInterval" spellcheck='false' placeholder="1m"></input>
  119. <info-popover mode="right-absolute">
  120. A lower limit for the auto group by time interval. Recommended to be set to write frequency,
  121. for example <code>1m</code> if your data is written every minute.
  122. </info-popover>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="gf-form-group">
  127. <div class="grafana-info-box">
  128. <h5>User Permission</h5>
  129. <p>
  130. The database user should only be granted SELECT permissions on the specified database &amp; tables you want to query.
  131. Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
  132. like <code>USE otherdb;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
  133. <strong>Highly</strong> recommmend you create a specific MySQL user with restricted permissions.
  134. Checkout the <a class="external-link" target="_blank" href="http://docs.grafana.org/features/datasources/mysql/">MySQL Data Source Docs</a> for more information.
  135. </p>
  136. </div>
  137. </div>