config.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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">
  17. <secret-form-field
  18. isConfigured="ctrl.current.secureJsonFields.password"
  19. value="ctrl.current.secureJsonData.password"
  20. on-reset="ctrl.onPasswordReset"
  21. on-change="ctrl.onPasswordChange"
  22. inputWidth="9"
  23. />
  24. </div>
  25. </div>
  26. <div class="gf-form-group">
  27. <div class="gf-form-inline">
  28. <gf-form-checkbox class="gf-form" label="TLS Client Auth" label-class="width-10"
  29. checked="ctrl.current.jsonData.tlsAuth" switch-class="max-width-6"></gf-form-checkbox>
  30. <gf-form-checkbox class="gf-form" label="With CA Cert" tooltip="Needed for
  31. verifing self-signed TLS Certs" checked="ctrl.current.jsonData.tlsAuthWithCACert" label-class="width-11"
  32. switch-class="max-width-6"></gf-form-checkbox>
  33. </div>
  34. <div class="gf-form-inline">
  35. <gf-form-checkbox class="gf-form" label="Skip TLS Verify" label-class="width-10"
  36. checked="ctrl.current.jsonData.tlsSkipVerify" switch-class="max-width-6"></gf-form-checkbox>
  37. </div>
  38. </div>
  39. <datasource-tls-auth-settings current="ctrl.current" ng-if="(ctrl.current.jsonData.tlsAuth || ctrl.current.jsonData.tlsAuthWithCACert)">
  40. </datasource-tls-auth-settings>
  41. <b>Connection limits</b>
  42. <div class="gf-form-group">
  43. <div class="gf-form max-width-15">
  44. <span class="gf-form-label width-7">Max open</span>
  45. <input type="number" min="0" class="gf-form-input gf-form-input--has-help-icon" ng-model="ctrl.current.jsonData.maxOpenConns" placeholder="unlimited"></input>
  46. <info-popover mode="right-absolute">
  47. The maximum number of open connections to the database. If <i>Max idle connections</i> is greater than 0 and the
  48. <i>Max open connections</i> is less than <i>Max idle connections</i>, then <i>Max idle connections</i> will be
  49. reduced to match the <i>Max open connections</i> limit. If set to 0, there is no limit on the number of open
  50. connections.
  51. </info-popover>
  52. </div>
  53. <div class="gf-form max-width-15">
  54. <span class="gf-form-label width-7">Max idle</span>
  55. <input type="number" min="0" class="gf-form-input gf-form-input--has-help-icon" ng-model="ctrl.current.jsonData.maxIdleConns" placeholder="2"></input>
  56. <info-popover mode="right-absolute">
  57. The maximum number of connections in the idle connection pool. If <i>Max open connections</i> is greater than 0 but
  58. less than the <i>Max idle connections</i>, then the <i>Max idle connections</i> will be reduced to match the
  59. <i>Max open connections</i> limit. If set to 0, no idle connections are retained.
  60. </info-popover>
  61. </div>
  62. <div class="gf-form max-width-15">
  63. <span class="gf-form-label width-7">Max lifetime</span>
  64. <input type="number" min="0" class="gf-form-input gf-form-input--has-help-icon" ng-model="ctrl.current.jsonData.connMaxLifetime" placeholder="14400"></input>
  65. <info-popover mode="right-absolute">
  66. The maximum amount of time in seconds a connection may be reused. If set to 0, connections are reused forever.<br/><br/>
  67. 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.
  68. </info-popover>
  69. </div>
  70. </div>
  71. <h3 class="page-heading">MySQL details</h3>
  72. <div class="gf-form-group">
  73. <div class="gf-form-inline">
  74. <div class="gf-form">
  75. <span class="gf-form-label width-9">Min time interval</span>
  76. <input
  77. type="text"
  78. class="gf-form-input width-6 gf-form-input--has-help-icon"
  79. ng-model="ctrl.current.jsonData.timeInterval"
  80. spellcheck='false'
  81. placeholder="1m"
  82. ng-pattern="/^\d+(ms|[Mwdhmsy])$/"
  83. ></input>
  84. <info-popover mode="right-absolute">
  85. A lower limit for the auto group by time interval. Recommended to be set to write frequency,
  86. for example <code>1m</code> if your data is written every minute.
  87. </info-popover>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="gf-form-group">
  92. <div class="grafana-info-box">
  93. <h5>User Permission</h5>
  94. <p>
  95. The database user should only be granted SELECT permissions on the specified database &amp; tables you want to query.
  96. Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
  97. like <code>USE otherdb;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
  98. <strong>Highly</strong> recommmend you create a specific MySQL user with restricted permissions.
  99. Checkout the <a class="external-link" target="_blank" href="http://docs.grafana.org/features/datasources/mysql/">MySQL Data Source Docs</a> for more information.
  100. </p>
  101. </div>
  102. </div>