Skip to content

Commit

Permalink
Vstatus (#67)
Browse files Browse the repository at this point in the history
* Fix vstatus metrics

* v0.6.5
  • Loading branch information
jangaraj authored Mar 17, 2017
1 parent f7f1ca3 commit 6bc64ee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changes for 0.6.4
# Changes 0.6.5

- fixed incorrect docker.vstatus metric ([#66](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/66))

# Changes 0.6.4

- added changelog ([#51](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/51))
- compatibility with all zabbix module API versions 2.x/3.x ([#54](https://github.com/monitoringartist/zabbix-docker-monitoring/issues/54))
20 changes: 12 additions & 8 deletions src/modules/zabbix_module_docker/zabbix_module_docker.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct inspect_result
int return_code;
};

char *m_version = "v0.6.4";
char *m_version = "v0.6.5";
char *stat_dir = NULL, *driver, *c_prefix = NULL, *c_suffix = NULL, *cpu_cgroup = NULL, *hostname = 0;
static int item_timeout = 1, buffer_size = 1024, cid_length = 66, socket_api;
int zbx_module_docker_discovery(AGENT_REQUEST *request, AGENT_RESULT *result);
Expand Down Expand Up @@ -2347,7 +2347,8 @@ int zbx_module_docker_vstatus(AGENT_REQUEST *request, AGENT_RESULT *result)
struct zbx_json_parse jp_data, jp_data2;
jp_data.start = &answer[0];
jp_data.end = &answer[strlen(answer)];
if (SUCCEED != zbx_json_brackets_by_name(&jp_data, "Volumes", &jp_data2)) {

if (SUCCEED == zbx_json_brackets_by_name(&jp_data, "Volumes", &jp_data2)) {
int count = zbx_json_count(&jp_data2);
free((void*) answer);
zabbix_log(LOG_LEVEL_DEBUG, "Count of volumes in %s status: %d", state, count);
Expand All @@ -2371,14 +2372,17 @@ int zbx_module_docker_vstatus(AGENT_REQUEST *request, AGENT_RESULT *result)
return SYSINFO_RET_FAIL;
}

struct zbx_json_parse jp_data;
struct zbx_json_parse jp_data, jp_data2;
jp_data.start = &answer[0];
jp_data.end = &answer[strlen(answer)];
int count = zbx_json_count(&jp_data);
free((void*) answer);
zabbix_log(LOG_LEVEL_DEBUG, "Count of volumes in %s status: %d", state, count);
SET_UI64_RESULT(result, count);
return SYSINFO_RET_OK;

if (SUCCEED == zbx_json_brackets_by_name(&jp_data, "Volumes", &jp_data2)) {
int count = zbx_json_count(&jp_data2);
free((void*) answer);
zabbix_log(LOG_LEVEL_DEBUG, "Count of volumes in %s status: %d", state, count);
SET_UI64_RESULT(result, count);
return SYSINFO_RET_OK;
}
}

zabbix_log(LOG_LEVEL_DEBUG, "Not supported volume state: %s", state);
Expand Down

0 comments on commit 6bc64ee

Please sign in to comment.