Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/zbxsysinfo/osf/inodes.c')
-rw-r--r--src/libs/zbxsysinfo/osf/inodes.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/libs/zbxsysinfo/osf/inodes.c b/src/libs/zbxsysinfo/osf/inodes.c
index cc9d1cc3658..51513fd9bf5 100644
--- a/src/libs/zbxsysinfo/osf/inodes.c
+++ b/src/libs/zbxsysinfo/osf/inodes.c
@@ -22,7 +22,7 @@
#include "log.h"
-static int vfs_fs_inode(AGENT_REQUEST *request, AGENT_RESULT *result)
+static int vfs_fs_inode_local(AGENT_REQUEST *request, AGENT_RESULT *result)
{
#ifdef HAVE_SYS_STATVFS_H
# define ZBX_STATFS statvfs
@@ -75,13 +75,7 @@ static int vfs_fs_inode(AGENT_REQUEST *request, AGENT_RESULT *result)
#ifdef HAVE_SYS_STATVFS_H
total -= s.f_ffree - s.f_favail;
#endif
- if (0 != total)
- SET_DBL_RESULT(result, (double)(100.0 * s.ZBX_FFREE) / total);
- else
- {
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Cannot calculate percentage because total is zero."));
- return SYSINFO_RET_FAIL;
- }
+ SET_DBL_RESULT(result, 0 != total ? (double)(100.0 * s.ZBX_FFREE) / total : 100.0);
}
else if (0 == strcmp(mode, "pused"))
{
@@ -89,15 +83,7 @@ static int vfs_fs_inode(AGENT_REQUEST *request, AGENT_RESULT *result)
#ifdef HAVE_SYS_STATVFS_H
total -= s.f_ffree - s.f_favail;
#endif
- if (0 != total)
- {
- SET_DBL_RESULT(result, 100.0 - (double)(100.0 * s.ZBX_FFREE) / total);
- }
- else
- {
- SET_MSG_RESULT(result, zbx_strdup(NULL, "Cannot calculate percentage because total is zero."));
- return SYSINFO_RET_FAIL;
- }
+ SET_DBL_RESULT(result, 0 != total ? 100.0 - (double)(100.0 * s.ZBX_FFREE) / total : 0.0);
}
else
{
@@ -110,7 +96,7 @@ static int vfs_fs_inode(AGENT_REQUEST *request, AGENT_RESULT *result)
#undef ZBX_FFREE
}
-int VFS_FS_INODE(AGENT_REQUEST *request, AGENT_RESULT *result)
+int vfs_fs_inode(AGENT_REQUEST *request, AGENT_RESULT *result)
{
- return zbx_execute_threaded_metric(vfs_fs_inode, request, result);
+ return zbx_execute_threaded_metric(vfs_fs_inode_local, request, result);
}