Skip to content

Commit

Permalink
bugfix agent protocol (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsun28 committed Mar 7, 2023
1 parent e393010 commit 076559c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public Map<String, String> getParamsMap() {
String endStr = key.substring(startIndex + 1, endIndex);
String[] params = endStr.split(",");
String[] keys = preStr.split("\\.");
if (keys.length != 2 || params.length != 7) {
if (keys.length != 2 || params.length < 6) {
log.error("zabbix metric key {} do not meet the requirements. ", key);
} else {
paramsMap.put(APP, keys[0]);
Expand All @@ -85,7 +85,9 @@ public Map<String, String> getParamsMap() {
paramsMap.put(DATABASE, params[3]);
paramsMap.put(USERNAME, params[4]);
paramsMap.put(PASSWORD, params[5]);
paramsMap.put(URL, params[6]);
if (params.length >= 7) {
paramsMap.put(URL, params[6]);
}
}
} catch (Exception e) {
log.error("zabbix metric key {} do not meet the requirements. ", key);
Expand Down

0 comments on commit 076559c

Please sign in to comment.