diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/zbxsysinfo/aix/diskspace.c | 97 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/freebsd/diskspace.c | 97 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/hpux/diskspace.c | 97 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/linux/diskspace.c | 97 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/netbsd/diskspace.c | 97 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/openbsd/diskspace.c | 97 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/osf/diskspace.c | 121 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/osx/diskspace.c | 97 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/solaris/diskspace.c | 96 | ||||
-rw-r--r-- | src/libs/zbxsysinfo/unknown/diskspace.c | 97 |
10 files changed, 501 insertions, 492 deletions
diff --git a/src/libs/zbxsysinfo/aix/diskspace.c b/src/libs/zbxsysinfo/aix/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/aix/diskspace.c +++ b/src/libs/zbxsysinfo/aix/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/freebsd/diskspace.c b/src/libs/zbxsysinfo/freebsd/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/freebsd/diskspace.c +++ b/src/libs/zbxsysinfo/freebsd/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/hpux/diskspace.c b/src/libs/zbxsysinfo/hpux/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/hpux/diskspace.c +++ b/src/libs/zbxsysinfo/hpux/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/linux/diskspace.c b/src/libs/zbxsysinfo/linux/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/linux/diskspace.c +++ b/src/libs/zbxsysinfo/linux/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/netbsd/diskspace.c b/src/libs/zbxsysinfo/netbsd/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/netbsd/diskspace.c +++ b/src/libs/zbxsysinfo/netbsd/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/openbsd/diskspace.c b/src/libs/zbxsysinfo/openbsd/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/openbsd/diskspace.c +++ b/src/libs/zbxsysinfo/openbsd/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/osf/diskspace.c b/src/libs/zbxsysinfo/osf/diskspace.c index ec4763e9..06b225ee 100644 --- a/src/libs/zbxsysinfo/osf/diskspace.c +++ b/src/libs/zbxsysinfo/osf/diskspace.c @@ -135,55 +135,7 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +int VFS_FS_USED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H struct statvfs s; @@ -193,8 +145,8 @@ int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const ch return SYSINFO_RET_FAIL; } -/* return s.f_bavail * (s.f_bsize / 1024.0);*/ - *value=s.f_bavail * (s.f_frsize / 1024.0); +/* return (s.f_blocks-s.f_bavail) * (s.f_bsize / 1024.0);*/ + *value=(s.f_blocks-s.f_bavail) * (s.f_frsize / 1024.0); return SYSINFO_RET_OK; #else struct statfs s; @@ -219,7 +171,7 @@ int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const ch ,blocks_percent_used ,mountPoint); */ - *value=s.f_bavail * (s.f_bsize / 1024.0); + *value=blocks_used * (s.f_bsize / 1024.0); return SYSINFO_RET_OK; } @@ -228,7 +180,7 @@ int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const ch #endif } -int VFS_FS_USED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H struct statvfs s; @@ -238,8 +190,8 @@ int VFS_FS_USED(const char *cmd, const char *mountPoint,double *value, const ch return SYSINFO_RET_FAIL; } -/* return (s.f_blocks-s.f_bavail) * (s.f_bsize / 1024.0);*/ - *value=(s.f_blocks-s.f_bavail) * (s.f_frsize / 1024.0); +/* return s.f_blocks * (s.f_bsize / 1024.0);*/ + *value= s.f_blocks * (s.f_frsize / 1024.0); return SYSINFO_RET_OK; #else struct statfs s; @@ -264,7 +216,7 @@ int VFS_FS_USED(const char *cmd, const char *mountPoint,double *value, const ch ,blocks_percent_used ,mountPoint); */ - *value=blocks_used * (s.f_bsize / 1024.0); + *value=s.f_blocks * (s.f_bsize / 1024.0); return SYSINFO_RET_OK; } @@ -273,7 +225,55 @@ int VFS_FS_USED(const char *cmd, const char *mountPoint,double *value, const ch #endif } -int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H struct statvfs s; @@ -283,8 +283,8 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; } -/* return s.f_blocks * (s.f_bsize / 1024.0);*/ - *value= s.f_blocks * (s.f_frsize / 1024.0); +/* return s.f_bavail * (s.f_bsize / 1024.0);*/ + *value=s.f_bavail * (s.f_frsize / 1024.0); return SYSINFO_RET_OK; #else struct statfs s; @@ -309,7 +309,7 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c ,blocks_percent_used ,mountPoint); */ - *value=s.f_blocks * (s.f_bsize / 1024.0); + *value=s.f_bavail * (s.f_bsize / 1024.0); return SYSINFO_RET_OK; } @@ -317,3 +317,4 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + diff --git a/src/libs/zbxsysinfo/osx/diskspace.c b/src/libs/zbxsysinfo/osx/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/osx/diskspace.c +++ b/src/libs/zbxsysinfo/osx/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/solaris/diskspace.c b/src/libs/zbxsysinfo/solaris/diskspace.c index 9e5ffc70..91b593b3 100644 --- a/src/libs/zbxsysinfo/solaris/diskspace.c +++ b/src/libs/zbxsysinfo/solaris/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -237,3 +189,51 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c #endif } +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + diff --git a/src/libs/zbxsysinfo/unknown/diskspace.c b/src/libs/zbxsysinfo/unknown/diskspace.c index ec4763e9..b0955ef6 100644 --- a/src/libs/zbxsysinfo/unknown/diskspace.c +++ b/src/libs/zbxsysinfo/unknown/diskspace.c @@ -135,54 +135,6 @@ #include "common.h" #include "sysinfo.h" -int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double used; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*used/total; - return SYSINFO_RET_OK; -} - -int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) -{ - double total; - double free; - - if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) - { - return SYSINFO_RET_FAIL; - } - - if(total == 0) - { - return SYSINFO_RET_FAIL; - } - - *value = 100*free/total; - return SYSINFO_RET_OK; -} - int VFS_FS_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) { #ifdef HAVE_SYS_STATVFS_H @@ -317,3 +269,52 @@ int VFS_FS_TOTAL(const char *cmd, const char *mountPoint,double *value, const c return SYSINFO_RET_FAIL; #endif } + +int VFS_FS_PUSED(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double used; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_USED(cmd, mountPoint, &used, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*used/total; + return SYSINFO_RET_OK; +} + +int VFS_FS_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max) +{ + double total; + double free; + + if(SYSINFO_RET_OK != VFS_FS_TOTAL(cmd, mountPoint, &total, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(SYSINFO_RET_OK != VFS_FS_FREE(cmd, mountPoint, &free, msg, mlen_max)) + { + return SYSINFO_RET_FAIL; + } + + if(total == 0) + { + return SYSINFO_RET_FAIL; + } + + *value = 100*free/total; + return SYSINFO_RET_OK; +} + |