config.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <h3 class="page-heading">PostgreSQL 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:5432" bs-typeahead="{{['localhost:5432', 'localhost:5433']}}" 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" ng-if="!ctrl.current.secureJsonFields.password">
  17. <span class="gf-form-label width-7">Password</span>
  18. <input type="password" class="gf-form-input" ng-model='ctrl.current.secureJsonData.password' placeholder="password"></input>
  19. </div>
  20. <div class="gf-form max-width-19" ng-if="ctrl.current.secureJsonFields.password">
  21. <span class="gf-form-label width-7">Password</span>
  22. <input type="text" class="gf-form-input" disabled="disabled" value="configured">
  23. <a class="btn btn-secondary gf-form-btn" href="#" ng-click="ctrl.current.secureJsonFields.password = false">reset</a>
  24. </div>
  25. </div>
  26. <div class="gf-form">
  27. <label class="gf-form-label width-7">SSL Mode</label>
  28. <div class="gf-form-select-wrapper max-width-15 gf-form-select-wrapper--has-help-icon">
  29. <select class="gf-form-input" ng-model="ctrl.current.jsonData.sslmode" ng-options="mode for mode in ['disable', 'require', 'verify-ca', 'verify-full']" ng-init="ctrl.current.jsonData.sslmode"></select>
  30. <info-popover mode="right-absolute">
  31. This option determines whether or with what priority a secure SSL TCP/IP connection will be negotiated with the server.
  32. </info-popover>
  33. </div>
  34. </div>
  35. </div>
  36. <b>Connection limits</b>
  37. <div class="gf-form-group">
  38. <div class="gf-form max-width-15">
  39. <span class="gf-form-label width-7">Max open</span>
  40. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxOpenConns" placeholder="unlimited"></input>
  41. <info-popover mode="right-absolute">
  42. The maximum number of open connections to the database. If <i>Max idle connections</i> is greater than 0 and the
  43. <i>Max open connections</i> is less than <i>Max idle connections</i>, then <i>Max idle connections</i> will be
  44. reduced to match the <i>Max open connections</i> limit. If set to 0, there is no limit on the number of open
  45. connections.
  46. </info-popover>
  47. </div>
  48. <div class="gf-form max-width-15">
  49. <span class="gf-form-label width-7">Max idle</span>
  50. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxIdleConns" placeholder="2"></input>
  51. <info-popover mode="right-absolute">
  52. The maximum number of connections in the idle connection pool. If <i>Max open connections</i> is greater than 0 but
  53. less than the <i>Max idle connections</i>, then the <i>Max idle connections</i> will be reduced to match the
  54. <i>Max open connections</i> limit. If set to 0, no idle connections are retained.
  55. </info-popover>
  56. </div>
  57. <div class="gf-form max-width-15">
  58. <span class="gf-form-label width-7">Max lifetime</span>
  59. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.connMaxLifetime" placeholder="14400"></input>
  60. <info-popover mode="right-absolute">
  61. The maximum amount of time in seconds a connection may be reused. If set to 0, connections are reused forever.
  62. </info-popover>
  63. </div>
  64. </div>
  65. <h3 class="page-heading">PostgreSQL details</h3>
  66. <div class="gf-form-group">
  67. <div class="gf-form">
  68. <span class="gf-form-label width-9">
  69. Version
  70. <info-popover mode="right-normal" position="top center">
  71. This option controls what functions are available in the PostgreSQL query builder.
  72. </info-popover>
  73. </span>
  74. <span class="gf-form-select-wrapper">
  75. <select class="gf-form-input gf-size-auto" ng-model="ctrl.current.jsonData.postgresVersion" ng-options="f.value as f.name for f in ctrl.postgresVersions"></select>
  76. </span>
  77. </div>
  78. <div class="gf-form">
  79. <gf-form-switch class="gf-form" label="TimescaleDB" label-class="width-9" checked="ctrl.current.jsonData.timescaledb" switch-class="max-width-6"></gf-form-switch>
  80. <label class="gf-form-label query-keyword pointer" ng-click="ctrl.toggleTimescaleDBHelp()">
  81. Help&nbsp;
  82. <i class="fa fa-caret-down" ng-show="ctrl.showTimescaleDBHelp"></i>
  83. <i class="fa fa-caret-right" ng-hide="ctrl.showTimescaleDBHelp">&nbsp;</i>
  84. </label>
  85. </div>
  86. <div class="gf-form-inline">
  87. <div class="gf-form">
  88. <span class="gf-form-label width-9">Min time interval</span>
  89. <input type="text" class="gf-form-input width-6" ng-model="ctrl.current.jsonData.timeInterval" spellcheck='false' placeholder="1m"></input>
  90. <info-popover mode="right-absolute">
  91. A lower limit for the auto group by time interval. Recommended to be set to write frequency,
  92. for example <code>1m</code> if your data is written every minute.
  93. </info-popover>
  94. </div>
  95. </div>
  96. <div class="grafana-info-box alert alert-info" ng-show="ctrl.showTimescaleDBHelp">
  97. <div class="alert-body">
  98. <p>
  99. <a href="https://github.com/timescale/timescaledb" class="pointer" target="_blank">TimescaleDB</a> is a time-series database built as a PostgreSQL extension. If enabled, Grafana will use <code>time_bucket</code> in the <code>$__timeGroup</code> macro and display TimescaleDB specific aggregate functions in the query builder.
  100. </p>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="gf-form-group">
  105. <div class="grafana-info-box">
  106. <h5>User Permission</h5>
  107. <p>
  108. The database user should only be granted SELECT permissions on the specified database &amp; tables you want to query.
  109. Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
  110. like <code>DELETE FROM user;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
  111. <strong>Highly</strong> recommmend you create a specific PostgreSQL user with restricted permissions.
  112. </p>
  113. </div>
  114. </div>