config.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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>
  22. <b>Connection limits</b>
  23. <div class="gf-form-group">
  24. <div class="gf-form max-width-15">
  25. <span class="gf-form-label width-7">Max open</span>
  26. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxOpenConns" placeholder="unlimited"></input>
  27. <info-popover mode="right-absolute">
  28. The maximum number of open connections to the database. If <i>Max idle connections</i> is greater than 0 and the
  29. <i>Max open connections</i> is less than <i>Max idle connections</i>, then <i>Max idle connections</i> will be
  30. reduced to match the <i>Max open connections</i> limit. If set to 0, there is no limit on the number of open
  31. connections.
  32. </info-popover>
  33. </div>
  34. <div class="gf-form max-width-15">
  35. <span class="gf-form-label width-7">Max idle</span>
  36. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxIdleConns" placeholder="2"></input>
  37. <info-popover mode="right-absolute">
  38. The maximum number of connections in the idle connection pool. If <i>Max open connections</i> is greater than 0 but
  39. less than the <i>Max idle connections</i>, then the <i>Max idle connections</i> will be reduced to match the
  40. <i>Max open connections</i> limit. If set to 0, no idle connections are retained.
  41. </info-popover>
  42. </div>
  43. <div class="gf-form max-width-15">
  44. <span class="gf-form-label width-7">Max lifetime</span>
  45. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.connMaxLifetime" placeholder="14400"></input>
  46. <info-popover mode="right-absolute">
  47. The maximum amount of time in seconds a connection may be reused. If set to 0, connections are reused forever.<br/><br/>
  48. 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.
  49. </info-popover>
  50. </div>
  51. </div>
  52. <h3 class="page-heading">MySQL details</h3>
  53. <div class="gf-form-group">
  54. <div class="gf-form-inline">
  55. <div class="gf-form">
  56. <span class="gf-form-label width-9">Min time interval</span>
  57. <input type="text" class="gf-form-input width-6" ng-model="ctrl.current.jsonData.timeInterval" spellcheck='false' placeholder="1m"></input>
  58. <info-popover mode="right-absolute">
  59. A lower limit for the auto group by time interval. Recommended to be set to write frequency,
  60. for example <code>1m</code> if your data is written every minute.
  61. </info-popover>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="gf-form-group">
  66. <div class="grafana-info-box">
  67. <h5>User Permission</h5>
  68. <p>
  69. The database user should only be granted SELECT permissions on the specified database &amp; tables you want to query.
  70. Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
  71. like <code>USE otherdb;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
  72. <strong>Highly</strong> recommmend you create a specific MySQL user with restricted permissions.
  73. Checkout the <a class="external-link" target="_blank" href="http://docs.grafana.org/features/datasources/mysql/">MySQL Data Source Docs</a> for more information.
  74. </p>
  75. </div>
  76. </div>