Skip to content

Commit 8e9977d

Browse files
author
hias
committed
add option to use own datasourceName
1 parent 7208b8e commit 8e9977d

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Here are some of the important config-options:
3737
|general|tmpFolder|Set a folder path, if the default PHP Tmp folder does not suite you.|
3838
|general|specialChar|Can be used to create more specific regex within the rules. E.g. $host = '&host&' will be replaced with 'linux-server1' if the select hostname is linux-server1. This works likewise with host, service, command.|
3939
|general|databaseType|Choose between influxDB and victoriametrics. |
40+
|general|datasourceName|Choose different datasourcename for victoriametrics backend|
4041
|general|disablePanelTitle|If this is set to true the PanelTitels are hidden globaly, there is an URL Flag which does it just with the current page. It is usefull to get a bigger Graphpicture.|
4142
|folder|defaultTemplateFolder|This is the path to the folder containing the default templates|
4243
|folder|customTemplateFolder|This is the path to the folder containing the custom templates. The templates in this folder will override files in the default folder, if they have the same filename|

histou.ini.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ tmpFolder = ""
66
specialChar = "&"
77
; set the backend: influxdb, victoriametrics
88
databaseType = "influxdb"
9+
; set a different datasourceName for victoriametrics backend
10+
; datasourceName = "myownds"
911
forecastDatasourceName = "nagflux_forecast"
1012
; disable the Panel Titel globally
1113
disablePanelTitle = false

histou/basic.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ public static function parsIni($filename)
214214
strtolower(Basic::getConfigKey($config, 'general', 'databaseType')),
215215
"influxdb"
216216
);
217+
Basic::setConstant(
218+
"DATASOURCE_NAME",
219+
strtolower(Basic::getConfigKey($config, 'general', 'datasourceName')),
220+
"victoriametrics"
221+
);
217222
Basic::setConstant(
218223
"FORECAST_DATASOURCE_NAME",
219224
strtolower(Basic::getConfigKey($config, 'general', 'forecastDatasourceName')),
@@ -230,6 +235,8 @@ public static function parsIni($filename)
230235

231236
if (DATABASE_TYPE == INFLUXDB && preg_match(";db=(\\w*);", URL, $matches)) {
232237
define('INFLUXDB_DB', $matches[1]);
238+
} elseif (DATABASE_TYPE == VICTORIAMETRICS && DATASOURCE_NAME !== 'victoriametrics') {
239+
define('VICTORIAMETRICS_DS', DATASOURCE_NAME);
233240
} elseif (DATABASE_TYPE == VICTORIAMETRICS) {
234241
define('VICTORIAMETRICS_DS', 'victoriametrics');
235242
}

0 commit comments

Comments
 (0)