Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vstatus #67

Merged
merged 2 commits into from
Mar 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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