diff options
author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-01 14:47:20 +0000 |
---|---|---|
committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-11-01 14:47:20 +0000 |
commit | 12b9d9858224301d1abb19f08956964c6fabd9a0 (patch) | |
tree | 5f389fdc2c5c66563eaf9ac3aa7a5311e0cf182a /src/libs/zbxsysinfo/linux/inodes.c | |
parent | de267adc7399911d3d3339c8aa91bcab381ad50a (diff) | |
download | zabbix-12b9d9858224301d1abb19f08956964c6fabd9a0.tar.gz zabbix-12b9d9858224301d1abb19f08956964c6fabd9a0.tar.xz zabbix-12b9d9858224301d1abb19f08956964c6fabd9a0.zip |
- added support of new sysinfo function interface for aix (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2236 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs/zbxsysinfo/linux/inodes.c')
-rw-r--r-- | src/libs/zbxsysinfo/linux/inodes.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/src/libs/zbxsysinfo/linux/inodes.c b/src/libs/zbxsysinfo/linux/inodes.c index d6b124eb..c8109f28 100644 --- a/src/libs/zbxsysinfo/linux/inodes.c +++ b/src/libs/zbxsysinfo/linux/inodes.c @@ -24,66 +24,7 @@ #include "md5.h" -int VFS_FS_INODE(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) -{ - -#define FS_FNCLIST struct fs_fnclist_s -FS_FNCLIST -{ - char *mode; - int (*function)(); -}; - - FS_FNCLIST fl[] = - { - {"free" , VFS_FS_INODE_FREE}, - {"total" , VFS_FS_INODE_TOTAL}, - {"used", VFS_FS_INODE_USED}, - {"pfree" , VFS_FS_INODE_PFREE}, - {"pused" , VFS_FS_INODE_PUSED}, - {0, 0} - }; - - char fsname[MAX_STRING_LEN]; - char mode[MAX_STRING_LEN]; - int i; - - assert(result); - - clean_result(result); - - if(num_param(param) > 2) - { - return SYSINFO_RET_FAIL; - } - - if(get_param(param, 1, fsname, MAX_STRING_LEN) != 0) - { - return SYSINFO_RET_FAIL; - } - - if(get_param(param, 2, mode, MAX_STRING_LEN) != 0) - { - mode[0] = '\0'; - } - if(mode[0] == '\0') - { - /* default parameter */ - sprintf(mode, "total"); - } - - for(i=0; fl[i].mode!=0; i++) - { - if(strncmp(mode, fl[i].mode, MAX_STRING_LEN)==0) - { - return (fl[i].function)(cmd, fsname, flags, result); - } - } - - return SYSINFO_RET_FAIL; -} - -int get_fs_inodes_stat(char *fs, double *total, double *free, double *usage) +static int get_fs_inodes_stat(char *fs, double *total, double *free, double *usage) { #ifdef HAVE_SYS_STATVFS_H struct statvfs s; @@ -118,7 +59,7 @@ int get_fs_inodes_stat(char *fs, double *total, double *free, double *usage) return SYSINFO_RET_OK; } -int VFS_FS_INODE_USED(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +static int VFS_FS_INODE_USED(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { char mountPoint[MAX_STRING_LEN]; double value = 0; @@ -142,7 +83,7 @@ int VFS_FS_INODE_USED(const char *cmd, const char *param, unsigned flags, AGENT_ return SYSINFO_RET_OK; } -int VFS_FS_INODE_FREE(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +static int VFS_FS_INODE_FREE(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { char mountPoint[MAX_STRING_LEN]; double value = 0; @@ -166,7 +107,7 @@ int VFS_FS_INODE_FREE(const char *cmd, const char *param, unsigned flags, AGENT_ return SYSINFO_RET_OK; } -int VFS_FS_INODE_TOTAL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +static int VFS_FS_INODE_TOTAL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { char mountPoint[MAX_STRING_LEN]; double value = 0; @@ -192,7 +133,7 @@ int VFS_FS_INODE_TOTAL(const char *cmd, const char *param, unsigned flags, AGENT return SYSINFO_RET_OK; } -int VFS_FS_INODE_PFREE(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +static int VFS_FS_INODE_PFREE(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { char mountPoint[MAX_STRING_LEN]; double tot_val = 0; @@ -217,7 +158,7 @@ int VFS_FS_INODE_PFREE(const char *cmd, const char *param, unsigned flags, AGENT return SYSINFO_RET_OK; } -int VFS_FS_INODE_PUSED(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +static int VFS_FS_INODE_PUSED(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { char mountPoint[MAX_STRING_LEN]; double tot_val = 0; @@ -242,3 +183,62 @@ int VFS_FS_INODE_PUSED(const char *cmd, const char *param, unsigned flags, AGENT return SYSINFO_RET_OK; } +int VFS_FS_INODE(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + +#define FS_FNCLIST struct fs_fnclist_s +FS_FNCLIST +{ + char *mode; + int (*function)(); +}; + + FS_FNCLIST fl[] = + { + {"free" , VFS_FS_INODE_FREE}, + {"total" , VFS_FS_INODE_TOTAL}, + {"used", VFS_FS_INODE_USED}, + {"pfree" , VFS_FS_INODE_PFREE}, + {"pused" , VFS_FS_INODE_PUSED}, + {0, 0} + }; + + char fsname[MAX_STRING_LEN]; + char mode[MAX_STRING_LEN]; + int i; + + assert(result); + + clean_result(result); + + if(num_param(param) > 2) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, fsname, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 2, mode, MAX_STRING_LEN) != 0) + { + mode[0] = '\0'; + } + if(mode[0] == '\0') + { + /* default parameter */ + sprintf(mode, "total"); + } + + for(i=0; fl[i].mode!=0; i++) + { + if(strncmp(mode, fl[i].mode, MAX_STRING_LEN)==0) + { + return (fl[i].function)(cmd, fsname, flags, result); + } + } + + return SYSINFO_RET_FAIL; +} + |