config.html 6.2 KB

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