config.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. <div class="gf-form-group">
  37. <div class="gf-form max-width-30">
  38. <span class="gf-form-label width-11">Max open connections</span>
  39. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxOpenConns" placeholder="unlimited"></input>
  40. </div>
  41. <div class="gf-form max-width-30">
  42. <span class="gf-form-label width-11">Max idle connections</span>
  43. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.maxIdleConns" placeholder="2"></input>
  44. </div>
  45. <div class="gf-form max-width-30">
  46. <span class="gf-form-label width-11">Connection lifetime</span>
  47. <input type="number" min="0" class="gf-form-input" ng-model="ctrl.current.jsonData.connMaxLifetime" placeholder="14400"></input>
  48. <info-popover mode="right-absolute">
  49. The connection lifetime in seconds.
  50. </info-popover>
  51. </div>
  52. </div>
  53. <h3 class="page-heading">PostgreSQL details</h3>
  54. <div class="gf-form-group">
  55. <div class="gf-form">
  56. <span class="gf-form-label width-9">
  57. Version
  58. <info-popover mode="right-normal" position="top center">
  59. This option controls what functions are available in the PostgreSQL query builder.
  60. </info-popover>
  61. </span>
  62. <span class="gf-form-select-wrapper">
  63. <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>
  64. </span>
  65. </div>
  66. <div class="gf-form">
  67. <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>
  68. <label class="gf-form-label query-keyword pointer" ng-click="ctrl.toggleTimescaleDBHelp()">
  69. Help&nbsp;
  70. <i class="fa fa-caret-down" ng-show="ctrl.showTimescaleDBHelp"></i>
  71. <i class="fa fa-caret-right" ng-hide="ctrl.showTimescaleDBHelp">&nbsp;</i>
  72. </label>
  73. </div>
  74. <div class="gf-form-inline">
  75. <div class="gf-form">
  76. <span class="gf-form-label width-9">Min time interval</span>
  77. <input type="text" class="gf-form-input width-6" ng-model="ctrl.current.jsonData.timeInterval" spellcheck='false' placeholder="1m"></input>
  78. <info-popover mode="right-absolute">
  79. A lower limit for the auto group by time interval. Recommended to be set to write frequency,
  80. for example <code>1m</code> if your data is written every minute.
  81. </info-popover>
  82. </div>
  83. </div>
  84. <div class="grafana-info-box alert alert-info" ng-show="ctrl.showTimescaleDBHelp">
  85. <div class="alert-body">
  86. <p>
  87. <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.
  88. </p>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="gf-form-group">
  93. <div class="grafana-info-box">
  94. <h5>User Permission</h5>
  95. <p>
  96. The database user should only be granted SELECT permissions on the specified database &amp; tables you want to query.
  97. Grafana does not validate that queries are safe so queries can contain any SQL statement. For example, statements
  98. like <code>DELETE FROM user;</code> and <code>DROP TABLE user;</code> would be executed. To protect against this we
  99. <strong>Highly</strong> recommmend you create a specific PostgreSQL user with restricted permissions.
  100. </p>
  101. </div>
  102. </div>