diff options
Diffstat (limited to 'src/libs')
30 files changed, 1941 insertions, 728 deletions
diff --git a/src/libs/zbxsysinfo/aix/Makefile.am b/src/libs/zbxsysinfo/aix/Makefile.am index 4e57c84f..94393287 100644 --- a/src/libs/zbxsysinfo/aix/Makefile.am +++ b/src/libs/zbxsysinfo/aix/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/aix/aix.c b/src/libs/zbxsysinfo/aix/aix.c index e04ef0e7..df66bf38 100644 --- a/src/libs/zbxsysinfo/aix/aix.c +++ b/src/libs/zbxsysinfo/aix/aix.c @@ -18,254 +18,179 @@ **/ #include "config.h" +#include "common.h" #include "sysinfo.h" -int VM_MEMORY_BUFFERS(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_CACHED(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_CPU_IDLE1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_IDLE5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_IDLE15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_USER1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_USER5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_USER15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_NICE1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_NICE5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_NICE15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_SYS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_SYS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_SYS15(const char *cmd, const char *parameter,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); -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); -int VFS_FS_PFREE(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); - -int DISK_IO(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_RIO(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_WIO(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_RBLK(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_WBLK(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_FREE(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int VFS_FILE_ATIME(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_CKSUM(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_CTIME(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_MD5SUM(const char *cmd, const char *filename, char **value, const char *msg, int mlen_max); -int VFS_FILE_MTIME(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_REGEXP(const char *cmd, const char *filename, char **value, const char *msg, int mlen_max); -int VFS_FILE_REGMATCH(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_SIZE(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_EXISTS(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); - -int VFS_FS_INODE_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max); -int VFS_FS_INODE_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max); -int VFS_FS_INODE_TOTAL(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max); - - -int KERNEL_MAXFILES(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int KERNEL_MAXPROC(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int NET_IF_IBYTES1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_IBYTES5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_IBYTES15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int NET_IF_OBYTES1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_OBYTES5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_OBYTES15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int DISKREADOPS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADOPS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADOPS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADBLKS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADBLKS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADBLKS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEOPS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEOPS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEOPS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEBLKS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEBLKS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEBLKS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int AGENT_PING(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_SHARED(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_TOTAL(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int PROC_NUM(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int PROC_MEMORY(const char *cmd, const char *param, double *value, const char *msg, int mlen_max); - -int PROCCOUNT(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_CPU_LOAD1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_LOAD5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_LOAD15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SENSOR_TEMP1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SENSOR_TEMP2(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SENSOR_TEMP3(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_UPTIME(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_SWAP_FREE(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_SWAP_TOTAL(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int TCP_LISTEN(const char *cmd, const char *porthex,double *value, const char *msg, int mlen_max); - -int EXECUTE(const char *cmd, const char *command,double *value, const char *msg, int mlen_max); -int EXECUTE_STR(const char *cmd, const char *command, const char *parameter, char **value, const char *msg, int mlen_max); -int AGENT_VERSION(const char *cmd, const char *command,char **value, const char *msg, int mlen_max); - - -int CHECK_SERVICE(const char *cmd, const char *service,double *value, const char *msg, int mlen_max); -int CHECK_SERVICE_PERF(const char *cmd, const char *service,double *value, const char *msg, int mlen_max); -int CHECK_PORT(const char *cmd, const char *ip_and_port,double *value, const char *msg, int mlen_max); -int CHECK_DNS(const char *cmd, const char *service,double *value, const char *msg, int mlen_max); - ZBX_METRIC parameters_specific[]= -/* KEY FUNCTION (if double) FUNCTION (if string) PARAM*/ +/* KEY FLAG FUNCTION ADD_PARAM TEST_PARAM */ { /* Outdated */ - - {"cksum[*]" ,VFS_FILE_CKSUM, 0, "/etc/services"}, - {"cpu[idle1]" ,SYSTEM_CPU_IDLE1, 0, 0}, - {"cpu[idle5]" ,SYSTEM_CPU_IDLE5, 0, 0}, - {"cpu[idle15]" ,SYSTEM_CPU_IDLE15, 0, 0}, - {"cpu[nice1]" ,SYSTEM_CPU_NICE1, 0, 0}, - {"cpu[nice5]" ,SYSTEM_CPU_NICE5, 0, 0}, - {"cpu[nice15]" ,SYSTEM_CPU_NICE15, 0, 0}, - {"cpu[system1]" ,SYSTEM_CPU_SYS1, 0, 0}, - {"cpu[system5]" ,SYSTEM_CPU_SYS5, 0, 0}, - {"cpu[system15]" ,SYSTEM_CPU_SYS15, 0, 0}, - {"cpu[user1]" ,SYSTEM_CPU_USER1, 0, 0}, - {"cpu[user5]" ,SYSTEM_CPU_USER5, 0, 0}, - {"cpu[user15]" ,SYSTEM_CPU_USER15, 0, 0}, - {"diskfree[*]" ,VFS_FS_FREE, 0, "/"}, - {"disktotal[*]" ,VFS_FS_TOTAL, 0, "/"}, - {"diskused[*]" ,VFS_FS_USED, 0, "/"}, - {"diskfree_perc[*]" ,VFS_FS_PFREE, 0, "/"}, - {"diskused_perc[*]" ,VFS_FS_PUSED, 0, "/"}, - {"file[*]" ,VFS_FILE_EXISTS, 0, "/etc/passwd"}, - {"filesize[*]" ,VFS_FILE_SIZE, 0, "/etc/passwd"}, - {"inodefree[*]" ,VFS_FS_INODE_FREE, 0, "/"}, - {"inodetotal[*]" ,VFS_FS_INODE_TOTAL, 0, "/"}, - {"inodefree_perc[*]" ,VFS_FS_INODE_PFREE, 0, "/"}, - {"kern[maxfiles]" ,KERNEL_MAXFILES, 0, 0}, - {"kern[maxproc]" ,KERNEL_MAXPROC, 0, 0}, - {"md5sum[*]" ,0, VFS_FILE_MD5SUM, "/etc/services"}, - {"memory[buffers]" ,VM_MEMORY_BUFFERS, 0, 0}, - {"memory[cached]" ,VM_MEMORY_CACHED, 0, 0}, - {"memory[free]" ,VM_MEMORY_FREE, 0, 0}, - {"memory[shared]" ,VM_MEMORY_SHARED, 0, 0}, - {"memory[total]" ,VM_MEMORY_TOTAL, 0, 0}, - {"netloadin1[*]" ,NET_IF_IBYTES1, 0, "lo"}, - {"netloadin5[*]" ,NET_IF_IBYTES5, 0, "lo"}, - {"netloadin15[*]" ,NET_IF_IBYTES15, 0, "lo"}, - {"netloadout1[*]" ,NET_IF_OBYTES1, 0, "lo"}, - {"netloadout5[*]" ,NET_IF_OBYTES5, 0, "lo"}, - {"netloadout15[*]" ,NET_IF_OBYTES15, 0, "lo"}, - {"ping" ,AGENT_PING, 0, 0}, - {"proc_cnt[*]" ,PROC_NUM, 0, "inetd"}, - {"swap[free]" ,SYSTEM_SWAP_FREE, 0, 0}, - {"swap[total]" ,SYSTEM_SWAP_TOTAL, 0, 0}, - {"system[procload]" ,SYSTEM_CPU_LOAD1, 0, 0}, - {"system[procload5]" ,SYSTEM_CPU_LOAD5, 0, 0}, - {"system[procload15]" ,SYSTEM_CPU_LOAD15, 0, 0}, - {"system[hostname]" ,0, EXECUTE_STR, "hostname"}, - {"system[uname]" ,0, EXECUTE_STR, "uname -a"}, - {"system[uptime]" ,SYSTEM_UPTIME, 0, 0}, - {"system[users]" ,EXECUTE, 0,"who|wc -l"}, - {"version[zabbix_agent]", 0, AGENT_VERSION, 0}, +/* incorrect OLD naming */ + {"cpu", CF_USEUPARAM, OLD_CPU, 0, "idle1"}, +/* + {"cpu[idle1]", 0, 0, 0, 0}, + {"cpu[idle5]", 0, 0, 0, 0}, + {"cpu[idle15]", 0, 0, 0, 0}, + {"cpu[nice1]", 0, 0, 0, 0}, + {"cpu[nice5]", 0, 0, 0, 0}, + {"cpu[nice15]", 0, 0, 0, 0}, + {"cpu[system1]", 0, 0, 0, 0}, + {"cpu[system5]", 0, 0, 0, 0}, + {"cpu[system15]", 0, 0, 0, 0}, + {"cpu[user1]", 0, 0, 0, 0}, + {"cpu[user5]", 0, 0, 0, 0}, + {"cpu[user15]", 0, 0, 0, 0}, +*/ + {"io", CF_USEUPARAM, OLD_IO, 0, "disk_io"}, +/* + {"io[disk_io]", 0, 0, 0, 0}, + {"io[disk_rio]", 0, 0, 0, 0}, + {"io[disk_wio]", 0, 0, 0, 0}, + {"io[disk_rblk]", 0, 0, 0, 0}, + {"io[disk_wblk]", 0, 0, 0, 0}, +*/ + {"kern", CF_USEUPARAM, OLD_KERNEL, 0, "maxfiles"}, +/* + {"kern[maxfiles]", 0, 0, 0, 0}, + {"kern[maxproc]", 0, 0, 0, 0}, +*/ + {"memory", CF_USEUPARAM, OLD_MEMORY, 0, "buffers"}, +/* + {"memory[buffers]", 0, 0, 0, 0}, + {"memory[cached]", 0, 0, 0, 0}, + {"memory[free]", 0, 0, 0, 0}, + {"memory[shared]", 0, 0, 0, 0}, + {"memory[total]", 0, 0, 0, 0}, +*/ + {"system", CF_USEUPARAM, OLD_SYSTEM, 0, "uname"}, +/* + {"system[proccount]", 0, 0, 0, 0}, + + {"system[procload]", 0, 0, 0, 0}, + {"system[procload5]", 0, 0, 0, 0}, + {"system[procload15]", 0, 0, 0, 0}, + {"system[hostname]", 0, 0, 0, 0}, + {"system[uname]", 0, 0, 0, 0}, + {"system[uptime]", 0, 0, 0, 0}, + {"system[users]", 0, 0, 0, 0}, + + {"system[procrunning]", 0, 0, 0, 0}, +*/ + {"sensor", CF_USEUPARAM, OLD_SENSOR, 0, "temp1"}, +/* + {"sensor[temp1]", 0, 0, 0, 0}, + {"sensor[temp2]", 0, 0, 0, 0}, + {"sensor[temp3]", 0, 0, 0, 0}, +*/ + {"swap", CF_USEUPARAM, OLD_SWAP, 0, "total"}, +/* + {"swap[free]", 0, 0, 0, 0}, + {"swap[total]", 0, 0, 0, 0}, +*/ + {"version", CF_USEUPARAM, OLD_VERSION, 0, "zabbix_agent"}, +/* + {"version[zabbix_agent]", 0, OLD_VERSION, 0, 0}, +*/ +/* correct OLD naming */ +/* + {"cksum", CF_USEUPARAM, VFS_FILE_CKSUM, 0, "/etc/services"}, +*/ +/* + {"diskfree", CF_USEUPARAM, VFS_FS_FREE, 0, "/"}, + {"disktotal", CF_USEUPARAM, VFS_FS_TOTAL, 0, "/"}, + {"diskused", CF_USEUPARAM, VFS_FS_USED, 0, "/"}, + {"diskfree_perc", CF_USEUPARAM, VFS_FS_PFREE, 0, "/"}, + {"diskused_perc", CF_USEUPARAM, VFS_FS_PUSED, 0, "/"}, +*/ +/* + {"file", CF_USEUPARAM, VFS_FILE_EXISTS, 0, "/etc/passwd"}, + {"filesize", CF_USEUPARAM, VFS_FILE_SIZE, 0, "/etc/passwd"}, +*/ +/* + {"inodefree", CF_USEUPARAM, VFS_FS_INODE_FREE, 0, "/"}, + {"inodetotal", CF_USEUPARAM, VFS_FS_INODE_TOTAL, 0, "/"}, + {"inodefree_perc", CF_USEUPARAM, VFS_FS_INODE_PFREE, 0, "/"}, +*/ +/* + {"md5sum", CF_USEUPARAM, VFS_FILE_MD5SUM, 0, "/etc/services"}, +*/ +/* + {"netloadin1", CF_USEUPARAM, NET_IF_IBYTES1, 0, "lo"}, + {"netloadin5", CF_USEUPARAM, NET_IF_IBYTES5, 0, "lo"}, + {"netloadin15", CF_USEUPARAM, NET_IF_IBYTES15, 0, "lo"}, + {"netloadout1", CF_USEUPARAM, NET_IF_OBYTES1, 0, "lo"}, + {"netloadout5", CF_USEUPARAM, NET_IF_OBYTES5, 0, "lo"}, + {"netloadout15", CF_USEUPARAM, NET_IF_OBYTES15, 0, "lo"}, +*/ +/* + {"ping", 0, AGENT_PING, 0, 0}, +*/ /* New naming */ - - {"agent.ping" ,AGENT_PING, 0, 0}, - {"agent.version", 0, AGENT_VERSION, 0}, - - {"kernel.maxfiles]" ,KERNEL_MAXFILES, 0, 0}, - {"kernel.maxproc" ,KERNEL_MAXPROC, 0, 0}, - - {"proc.num[*]" ,PROC_NUM, 0, "inetd"}, - {"proc.mem[*]" ,PROC_MEMORY, 0, "inetd"}, - - {"vm.memory.total" ,VM_MEMORY_TOTAL, 0, 0}, - {"vm.memory.shared" ,VM_MEMORY_SHARED, 0, 0}, - {"vm.memory.buffers" ,VM_MEMORY_BUFFERS, 0, 0}, - {"vm.memory.cached" ,VM_MEMORY_CACHED, 0, 0}, - {"vm.memory.free" ,VM_MEMORY_FREE, 0, 0}, - - {"vfs.fs.free[*]" ,VFS_FS_FREE, 0, "/"}, - {"vfs.fs.total[*]" ,VFS_FS_TOTAL, 0, "/"}, - {"vfs.fs.used[*]" ,VFS_FS_USED, 0, "/"}, - - {"vfs.fs.pfree[*]" ,VFS_FS_PFREE, 0, "/"}, - {"vfs.fs.pused[*]" ,VFS_FS_PUSED, 0, "/"}, - - {"vfs.fs.inode.free[*]" ,VFS_FS_INODE_FREE, 0, "/"}, - {"vfs.fs.inode.total[*]",VFS_FS_INODE_TOTAL, 0, "/"}, - {"vfs.fs.inode.pfree[*]",VFS_FS_INODE_PFREE, 0, "/"}, - - {"vfs.file.atime[*]" ,VFS_FILE_ATIME, 0, "/etc/passwd"}, - {"vfs.file.cksum[*]" ,VFS_FILE_CKSUM, 0, "/etc/services"}, - {"vfs.file.ctime[*]" ,VFS_FILE_CTIME, 0, "/etc/passwd"}, - {"vfs.file.exists[*]" ,VFS_FILE_EXISTS, 0, "/etc/passwd"}, - {"vfs.file.md5sum[*]" ,0, VFS_FILE_MD5SUM, "/etc/services"}, - {"vfs.file.mtime[*]" ,VFS_FILE_MTIME, 0, "/etc/passwd"}, - {"vfs.file.regexp[*]" ,0, VFS_FILE_REGEXP, "/etc/passwd,root"}, - {"vfs.file.regmatch[*]" ,VFS_FILE_REGMATCH, 0, "/etc/passwd,root"}, - {"vfs.file.size[*]" ,VFS_FILE_SIZE, 0, "/etc/passwd"}, - - {"system.cpu.idle1" ,SYSTEM_CPU_IDLE1, 0, 0}, - {"system.cpu.idle5" ,SYSTEM_CPU_IDLE5, 0, 0}, - {"system.cpu.idle15" ,SYSTEM_CPU_IDLE15, 0, 0}, - {"system.cpu.nice1" ,SYSTEM_CPU_NICE1, 0, 0}, - {"system.cpu.nice5" ,SYSTEM_CPU_NICE5, 0, 0}, - {"system.cpu.nice15" ,SYSTEM_CPU_NICE15, 0, 0}, - {"system.cpu.sys1" ,SYSTEM_CPU_SYS1, 0, 0}, - {"system.cpu.sys5" ,SYSTEM_CPU_SYS5, 0, 0}, - {"system.cpu.sys15" ,SYSTEM_CPU_SYS15, 0, 0}, - {"system.cpu.user1" ,SYSTEM_CPU_USER1, 0, 0}, - {"system.cpu.user5" ,SYSTEM_CPU_USER5, 0, 0}, - {"system.cpu.user15" ,SYSTEM_CPU_USER15, 0, 0}, - - {"net.if.ibytes1[*]" ,NET_IF_IBYTES1, 0, "lo"}, - {"net.if.ibytes5[*]" ,NET_IF_IBYTES5, 0, "lo"}, - {"net.if.ibytes15[*]" ,NET_IF_IBYTES15, 0, "lo"}, - {"net.if.obytes1[*]" ,NET_IF_OBYTES1, 0, "lo"}, - {"net.if.obytes5[*]" ,NET_IF_OBYTES5, 0, "lo"}, - {"net.if.obytes15[*]" ,NET_IF_OBYTES15, 0, "lo"}, - - {"disk_read_ops1[*]" ,DISKREADOPS1, 0, "hda"}, - {"disk_read_ops5[*]" ,DISKREADOPS5, 0, "hda"}, - {"disk_read_ops15[*]" ,DISKREADOPS15, 0, "hda"}, - - {"disk_read_blks1[*]" ,DISKREADBLKS1, 0, "hda"}, - {"disk_read_blks5[*]" ,DISKREADBLKS5, 0, "hda"}, - {"disk_read_blks15[*]" ,DISKREADBLKS15, 0, "hda"}, - - {"disk_write_ops1[*]" ,DISKWRITEOPS1, 0, "hda"}, - {"disk_write_ops5[*]" ,DISKWRITEOPS5, 0, "hda"}, - {"disk_write_ops15[*]" ,DISKWRITEOPS15, 0, "hda"}, - - {"disk_write_blks1[*]" ,DISKWRITEBLKS1, 0, "hda"}, - {"disk_write_blks5[*]" ,DISKWRITEBLKS5, 0, "hda"}, - {"disk_write_blks15[*]" ,DISKWRITEBLKS15, 0, "hda"}, - - {"sensor[temp1]" ,SENSOR_TEMP1, 0, 0}, - {"sensor[temp2]" ,SENSOR_TEMP2, 0, 0}, - {"sensor[temp3]" ,SENSOR_TEMP3, 0, 0}, - - {"system.cpu.load1" ,SYSTEM_CPU_LOAD1, 0, 0}, - {"system.cpu.load5" ,SYSTEM_CPU_LOAD5, 0, 0}, - {"system.cpu.load15" ,SYSTEM_CPU_LOAD15, 0, 0}, - - {"system.hostname" ,0, EXECUTE_STR, "hostname"}, - - {"system.swap.free" ,SYSTEM_SWAP_FREE, 0, 0}, - {"system.swap.total" ,SYSTEM_SWAP_TOTAL, 0, 0}, - - {"system.uname" ,0, EXECUTE_STR, "uname -a"}, - {"system.uptime" ,SYSTEM_UPTIME, 0, 0}, - {"system.users.num" ,EXECUTE, 0,"who|wc -l"}, +/* + {"system.cpu.idle1", 0, SYSTEM_CPU_IDLE1, 0, 0}, + {"system.cpu.idle5", 0, SYSTEM_CPU_IDLE5, 0, 0}, + {"system.cpu.idle15", 0, SYSTEM_CPU_IDLE15, 0, 0}, + {"system.cpu.nice1", 0, SYSTEM_CPU_NICE1, 0, 0}, + {"system.cpu.nice5", 0, SYSTEM_CPU_NICE5, 0, 0}, + {"system.cpu.nice15", 0, SYSTEM_CPU_NICE15, 0, 0}, + {"system.cpu.sys1", 0, SYSTEM_CPU_SYS1, 0, 0}, + {"system.cpu.sys5", 0, SYSTEM_CPU_SYS5, 0, 0}, + {"system.cpu.sys15", 0, SYSTEM_CPU_SYS15, 0, 0}, + {"system.cpu.user1", 0, SYSTEM_CPU_USER1, 0, 0}, + {"system.cpu.user5", 0, SYSTEM_CPU_USER5, 0, 0}, + {"system.cpu.user15", 0, SYSTEM_CPU_USER15, 0, 0}, +*/ +/* + {"vm.memory.total", 0, VM_MEMORY_TOTAL, 0, 0}, + {"vm.memory.shared", 0, VM_MEMORY_SHARED, 0, 0}, + {"vm.memory.buffers", 0, VM_MEMORY_BUFFERS, 0, 0}, + {"vm.memory.cached", 0, VM_MEMORY_CACHED, 0, 0}, + {"vm.memory.free", 0, VM_MEMORY_FREE, 0, 0}, +*/ +/* + {"vfs.fs.free", CF_USEUPARAM, VFS_FS_FREE, 0, "/"}, + {"vfs.fs.total", CF_USEUPARAM, VFS_FS_TOTAL, 0, "/"}, + {"vfs.fs.used", CF_USEUPARAM, VFS_FS_USED, 0, "/"}, + {"vfs.fs.pfree", CF_USEUPARAM, VFS_FS_PFREE, 0, "/"}, + {"vfs.fs.pused", CF_USEUPARAM, VFS_FS_PUSED, 0, "/"}, +*/ +/* + {"vfs.fs.inode.free", CF_USEUPARAM, VFS_FS_INODE_FREE, 0, "/"}, + {"vfs.fs.inode.total", CF_USEUPARAM, VFS_FS_INODE_TOTAL, 0, "/"}, + {"vfs.fs.inode.pfree", CF_USEUPARAM, VFS_FS_INODE_PFREE, 0, "/"}, +*/ +/* + {"net.if.ibytes1", CF_USEUPARAM, NET_IF_IBYTES1, 0, "lo"}, + {"net.if.ibytes5", CF_USEUPARAM, NET_IF_IBYTES5, 0, "lo"}, + {"net.if.ibytes15", CF_USEUPARAM, NET_IF_IBYTES15,0, "lo"}, + + {"net.if.obytes1", CF_USEUPARAM, NET_IF_OBYTES1, 0, "lo"}, + {"net.if.obytes5", CF_USEUPARAM, NET_IF_OBYTES5, 0, "lo"}, + {"net.if.obytes15", CF_USEUPARAM, NET_IF_OBYTES15,0, "lo"}, +*/ +/* + {"disk_read_ops1", CF_USEUPARAM, DISKREADOPS1, 0, "hda"}, + {"disk_read_ops5", CF_USEUPARAM, DISKREADOPS5, 0, "hda"}, + {"disk_read_ops15", CF_USEUPARAM, DISKREADOPS15, 0, "hda"}, + + {"disk_read_blks1", CF_USEUPARAM, DISKREADBLKS1, 0, "hda"}, + {"disk_read_blks5", CF_USEUPARAM, DISKREADBLKS5, 0, "hda"}, + {"disk_read_blks15", CF_USEUPARAM, DISKREADBLKS15, 0, "hda"}, + + {"disk_write_ops1", CF_USEUPARAM, DISKWRITEOPS1, 0, "hda"}, + {"disk_write_ops5", CF_USEUPARAM, DISKWRITEOPS5, 0, "hda"}, + {"disk_write_ops15", CF_USEUPARAM, DISKWRITEOPS15, 0, "hda"}, + + {"disk_write_blks1", CF_USEUPARAM, DISKWRITEBLKS1, 0, "hda"}, + {"disk_write_blks5", CF_USEUPARAM, DISKWRITEBLKS5, 0, "hda"}, + {"disk_write_blks15", CF_USEUPARAM, DISKWRITEBLKS15,0, "hda"}, +*/ +/* + {"system.cpu.load1", 0, SYSTEM_CPU_LOAD1, 0, 0}, + {"system.cpu.load5", 0, SYSTEM_CPU_LOAD5, 0, 0}, + {"system.cpu.load15", 0, SYSTEM_CPU_LOAD15, 0, 0}, +*/ /**************************************** All these perameters require more than 1 second to retrieve. @@ -277,30 +202,66 @@ ZBX_METRIC parameters_specific[]= {"system[switches]" ,EXECUTE, 0, "vmstat -n 1 2|tail -1|cut -b62-67"}, ***************************************/ - {"io[disk_io]" ,DISK_IO, 0, 0}, - {"io[disk_rio]" ,DISK_RIO, 0, 0}, - {"io[disk_wio]" ,DISK_WIO, 0, 0}, - {"io[disk_rblk]" ,DISK_RBLK, 0, 0}, - {"io[disk_wblk]" ,DISK_WBLK, 0, 0}, - - - - {"system[proccount]" ,PROCCOUNT, 0, 0}, - -#ifdef HAVE_PROC_LOADAVG - {"system[procrunning]" ,EXECUTE, 0, "cat /proc/loadavg|cut -f1 -d'/'|cut -f4 -d' '"}, -#endif - /* {"tcp_count" ,EXECUTE, 0, "netstat -tn|grep EST|wc -l"}, */ - - {"net[listen_23]" ,TCP_LISTEN, 0, "0017"}, - {"net[listen_80]" ,TCP_LISTEN, 0, "0050"}, - - {"check_port[*]" ,CHECK_PORT, 0, "80"}, - - {"check_service[*]" ,CHECK_SERVICE, 0, "ssh,127.0.0.1,22"}, - {"dns[*]" ,CHECK_DNS, 0, "127.0.0.1,localhost"}, - {"check_service_perf[*]",CHECK_SERVICE_PERF, 0, "ssh,127.0.0.1,22"}, +/* + {"check_port", CF_USEUPARAM, CHECK_PORT, 0, "80"}, + {"check_service", CF_USEUPARAM, CHECK_SERVICE, 0, "ssh,127.0.0.1,22"}, + {"check_service_perf", CF_USEUPARAM, CHECK_SERVICE_PERF, 0, "ssh,127.0.0.1,22"}, +*/ +/* + {"dns", CF_USEUPARAM, CHECK_DNS, 0, "127.0.0.1,localhost"}, +*/ + {"agent.ping", 0, AGENT_PING, 0, 0}, + {"agent.version", 0, AGENT_VERSION, 0, 0}, + + {"kernel.maxfiles", 0, KERNEL_MAXFILES, 0, 0}, + {"kernel.maxproc", 0, KERNEL_MAXPROC, 0, 0}, + + {"vfs.file.atime", CF_USEUPARAM, VFS_FILE_ATIME, 0, "/etc/passwd"}, + {"vfs.file.cksum", CF_USEUPARAM, VFS_FILE_CKSUM, 0, "/etc/services"}, + {"vfs.file.ctime", CF_USEUPARAM, VFS_FILE_CTIME, 0, "/etc/passwd"}, + {"vfs.file.exists", CF_USEUPARAM, VFS_FILE_EXISTS, 0, "/etc/passwd"}, + {"vfs.file.md5sum", CF_USEUPARAM, VFS_FILE_MD5SUM, 0, "/etc/services"}, + {"vfs.file.mtime", CF_USEUPARAM, VFS_FILE_MTIME, 0, "/etc/passwd"}, + {"vfs.file.regexp", CF_USEUPARAM, VFS_FILE_REGEXP, 0, "/etc/passwd,root"}, + {"vfs.file.regmatch", CF_USEUPARAM, VFS_FILE_REGMATCH, 0, "/etc/passwd,root"}, + {"vfs.file.size", CF_USEUPARAM, VFS_FILE_SIZE, 0, "/etc/passwd"}, + +/************************************ + * NEW FUNCTIONS * + ************************************/ + + {"net.tcp.dns", CF_USEUPARAM, CHECK_DNS, 0, "127.0.0.1,localhost"}, + + {"net.tcp.port", CF_USEUPARAM, CHECK_PORT, 0, "80"}, + {"net.tcp.service", CF_USEUPARAM, CHECK_SERVICE, 0, "ssh,127.0.0.1,22"}, + {"net.tcp.service.perf",CF_USEUPARAM, CHECK_SERVICE_PERF, 0, "ssh,127.0.0.1,22"}, + + {"net.if.in", CF_USEUPARAM, NET_IF_IN, 0, "lo,bytes"}, + {"net.if.out", CF_USEUPARAM, NET_IF_OUT, 0, "lo,bytes"}, + + {"vfs.fs.size", CF_USEUPARAM, VFS_FS_SIZE, 0, "/,free"}, + {"vfs.fs.inode", CF_USEUPARAM, VFS_FS_INODE, 0, "/,free"}, + + {"vfs.dev.read", CF_USEUPARAM, VFS_DEV_READ, 0, "hda,ops,avg1"}, + {"vfs.dev.write", CF_USEUPARAM, VFS_DEV_WRITE, 0, "hda,ops,avg1"}, + + {"vm.memory.size", CF_USEUPARAM, VM_MEMORY_SIZE, 0, "free"}, + + {"proc.num", CF_USEUPARAM, PROC_NUM, 0, "inetd,,"}, + {"proc.mem", CF_USEUPARAM, PROC_MEMORY, 0, "inetd,,"}, + + {"system.cpu.util", CF_USEUPARAM, SYSTEM_CPU_UTIL, 0, "all,user,avg1"}, + + {"system.cpu.load", CF_USEUPARAM, SYSTEM_CPU_LOAD, 0, "all,avg1"}, + + {"system.swap.size", CF_USEUPARAM, SYSTEM_SWAP_SIZE, 0, "all,free"}, + + {"system.hostname", 0, SYSTEM_HOSTNAME, 0, 0}, + + {"system.uname", 0, SYSTEM_UNAME, 0, 0}, + {"system.uptime", 0, SYSTEM_UPTIME, 0, 0}, + {"system.users.num", 0, SYSTEM_UNUM, 0, 0}, {0} }; diff --git a/src/libs/zbxsysinfo/aix/kernel.c b/src/libs/zbxsysinfo/aix/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/aix/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/aix/net.c b/src/libs/zbxsysinfo/aix/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/aix/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + diff --git a/src/libs/zbxsysinfo/common/common.c b/src/libs/zbxsysinfo/common/common.c index 24a4bc73..d4366b83 100644 --- a/src/libs/zbxsysinfo/common/common.c +++ b/src/libs/zbxsysinfo/common/common.c @@ -806,98 +806,6 @@ int getPROC(char *file, int lineno, int fieldno, unsigned flags, AGENT_RESULT *r } #endif -int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) -{ -#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES - int mib[2],len; - int maxfiles; - - mib[0]=CTL_KERN; - mib[1]=KERN_MAXFILES; - - assert(result); - - clean_result(result); - - len=sizeof(maxfiles); - - if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) - { - return SYSINFO_RET_FAIL; - } - - result->type |= AR_DOUBLE; - result->dbl = (double)(maxfiles); - return SYSINFO_RET_OK; -#else - return SYSINFO_RET_FAIL; -#endif -} - -int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) -{ -#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC - int mib[2],len; - int maxproc; - - mib[0]=CTL_KERN; - mib[1]=KERN_MAXPROC; - - assert(result); - - clean_result(result); - - len=sizeof(maxproc); - - if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) - { - return SYSINFO_RET_FAIL; -/* printf("Errno [%m]");*/ - } - - result->type |= AR_DOUBLE; - result->dbl = (double)(maxproc); - return SYSINFO_RET_OK; -#else - return SYSINFO_RET_FAIL; -#endif -} - -int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) -{ - char key[MAX_STRING_LEN]; - int ret; - - assert(result); - - clean_result(result); - - if(num_param(param) > 1) - { - return SYSINFO_RET_FAIL; - } - - if(get_param(param, 1, key, MAX_STRING_LEN) != 0) - { - return SYSINFO_RET_FAIL; - } - - if(strcmp(key,"maxfiles") == 0) - { - ret = KERNEL_MAXFILES(cmd, param, flags, result); - } - else if(strcmp(key,"maxproc") == 0) - { - ret = KERNEL_MAXPROC(cmd, param, flags, result); - } - else - { - ret = SYSINFO_RET_FAIL; - } - - return ret; -} - int AGENT_PING(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { assert(result); diff --git a/src/libs/zbxsysinfo/freebsd/Makefile.am b/src/libs/zbxsysinfo/freebsd/Makefile.am index 40d55d50..94393287 100644 --- a/src/libs/zbxsysinfo/freebsd/Makefile.am +++ b/src/libs/zbxsysinfo/freebsd/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=freebsd.c cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/freebsd/kernel.c b/src/libs/zbxsysinfo/freebsd/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/freebsd/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/freebsd/net.c b/src/libs/zbxsysinfo/freebsd/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/freebsd/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + diff --git a/src/libs/zbxsysinfo/hpux/Makefile.am b/src/libs/zbxsysinfo/hpux/Makefile.am index 4e57c84f..94393287 100644 --- a/src/libs/zbxsysinfo/hpux/Makefile.am +++ b/src/libs/zbxsysinfo/hpux/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/hpux/hpux.c b/src/libs/zbxsysinfo/hpux/hpux.c index e04ef0e7..df66bf38 100644 --- a/src/libs/zbxsysinfo/hpux/hpux.c +++ b/src/libs/zbxsysinfo/hpux/hpux.c @@ -18,254 +18,179 @@ **/ #include "config.h" +#include "common.h" #include "sysinfo.h" -int VM_MEMORY_BUFFERS(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_CACHED(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_CPU_IDLE1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_IDLE5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_IDLE15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_USER1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_USER5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_USER15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_NICE1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_NICE5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_NICE15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_SYS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_SYS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_SYS15(const char *cmd, const char *parameter,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); -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); -int VFS_FS_PFREE(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); - -int DISK_IO(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_RIO(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_WIO(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_RBLK(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISK_WBLK(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_FREE(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int VFS_FILE_ATIME(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_CKSUM(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_CTIME(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_MD5SUM(const char *cmd, const char *filename, char **value, const char *msg, int mlen_max); -int VFS_FILE_MTIME(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_REGEXP(const char *cmd, const char *filename, char **value, const char *msg, int mlen_max); -int VFS_FILE_REGMATCH(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_SIZE(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); -int VFS_FILE_EXISTS(const char *cmd, const char *filename,double *value, const char *msg, int mlen_max); - -int VFS_FS_INODE_FREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max); -int VFS_FS_INODE_PFREE(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max); -int VFS_FS_INODE_TOTAL(const char *cmd, const char *mountPoint,double *value, const char *msg, int mlen_max); - - -int KERNEL_MAXFILES(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int KERNEL_MAXPROC(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int NET_IF_IBYTES1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_IBYTES5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_IBYTES15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int NET_IF_OBYTES1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_OBYTES5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int NET_IF_OBYTES15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int DISKREADOPS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADOPS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADOPS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADBLKS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADBLKS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKREADBLKS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEOPS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEOPS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEOPS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEBLKS1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEBLKS5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int DISKWRITEBLKS15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int AGENT_PING(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_SHARED(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int VM_MEMORY_TOTAL(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int PROC_NUM(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int PROC_MEMORY(const char *cmd, const char *param, double *value, const char *msg, int mlen_max); - -int PROCCOUNT(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_CPU_LOAD1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_LOAD5(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_CPU_LOAD15(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SENSOR_TEMP1(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SENSOR_TEMP2(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SENSOR_TEMP3(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_UPTIME(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int SYSTEM_SWAP_FREE(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); -int SYSTEM_SWAP_TOTAL(const char *cmd, const char *parameter,double *value, const char *msg, int mlen_max); - -int TCP_LISTEN(const char *cmd, const char *porthex,double *value, const char *msg, int mlen_max); - -int EXECUTE(const char *cmd, const char *command,double *value, const char *msg, int mlen_max); -int EXECUTE_STR(const char *cmd, const char *command, const char *parameter, char **value, const char *msg, int mlen_max); -int AGENT_VERSION(const char *cmd, const char *command,char **value, const char *msg, int mlen_max); - - -int CHECK_SERVICE(const char *cmd, const char *service,double *value, const char *msg, int mlen_max); -int CHECK_SERVICE_PERF(const char *cmd, const char *service,double *value, const char *msg, int mlen_max); -int CHECK_PORT(const char *cmd, const char *ip_and_port,double *value, const char *msg, int mlen_max); -int CHECK_DNS(const char *cmd, const char *service,double *value, const char *msg, int mlen_max); - ZBX_METRIC parameters_specific[]= -/* KEY FUNCTION (if double) FUNCTION (if string) PARAM*/ +/* KEY FLAG FUNCTION ADD_PARAM TEST_PARAM */ { /* Outdated */ - - {"cksum[*]" ,VFS_FILE_CKSUM, 0, "/etc/services"}, - {"cpu[idle1]" ,SYSTEM_CPU_IDLE1, 0, 0}, - {"cpu[idle5]" ,SYSTEM_CPU_IDLE5, 0, 0}, - {"cpu[idle15]" ,SYSTEM_CPU_IDLE15, 0, 0}, - {"cpu[nice1]" ,SYSTEM_CPU_NICE1, 0, 0}, - {"cpu[nice5]" ,SYSTEM_CPU_NICE5, 0, 0}, - {"cpu[nice15]" ,SYSTEM_CPU_NICE15, 0, 0}, - {"cpu[system1]" ,SYSTEM_CPU_SYS1, 0, 0}, - {"cpu[system5]" ,SYSTEM_CPU_SYS5, 0, 0}, - {"cpu[system15]" ,SYSTEM_CPU_SYS15, 0, 0}, - {"cpu[user1]" ,SYSTEM_CPU_USER1, 0, 0}, - {"cpu[user5]" ,SYSTEM_CPU_USER5, 0, 0}, - {"cpu[user15]" ,SYSTEM_CPU_USER15, 0, 0}, - {"diskfree[*]" ,VFS_FS_FREE, 0, "/"}, - {"disktotal[*]" ,VFS_FS_TOTAL, 0, "/"}, - {"diskused[*]" ,VFS_FS_USED, 0, "/"}, - {"diskfree_perc[*]" ,VFS_FS_PFREE, 0, "/"}, - {"diskused_perc[*]" ,VFS_FS_PUSED, 0, "/"}, - {"file[*]" ,VFS_FILE_EXISTS, 0, "/etc/passwd"}, - {"filesize[*]" ,VFS_FILE_SIZE, 0, "/etc/passwd"}, - {"inodefree[*]" ,VFS_FS_INODE_FREE, 0, "/"}, - {"inodetotal[*]" ,VFS_FS_INODE_TOTAL, 0, "/"}, - {"inodefree_perc[*]" ,VFS_FS_INODE_PFREE, 0, "/"}, - {"kern[maxfiles]" ,KERNEL_MAXFILES, 0, 0}, - {"kern[maxproc]" ,KERNEL_MAXPROC, 0, 0}, - {"md5sum[*]" ,0, VFS_FILE_MD5SUM, "/etc/services"}, - {"memory[buffers]" ,VM_MEMORY_BUFFERS, 0, 0}, - {"memory[cached]" ,VM_MEMORY_CACHED, 0, 0}, - {"memory[free]" ,VM_MEMORY_FREE, 0, 0}, - {"memory[shared]" ,VM_MEMORY_SHARED, 0, 0}, - {"memory[total]" ,VM_MEMORY_TOTAL, 0, 0}, - {"netloadin1[*]" ,NET_IF_IBYTES1, 0, "lo"}, - {"netloadin5[*]" ,NET_IF_IBYTES5, 0, "lo"}, - {"netloadin15[*]" ,NET_IF_IBYTES15, 0, "lo"}, - {"netloadout1[*]" ,NET_IF_OBYTES1, 0, "lo"}, - {"netloadout5[*]" ,NET_IF_OBYTES5, 0, "lo"}, - {"netloadout15[*]" ,NET_IF_OBYTES15, 0, "lo"}, - {"ping" ,AGENT_PING, 0, 0}, - {"proc_cnt[*]" ,PROC_NUM, 0, "inetd"}, - {"swap[free]" ,SYSTEM_SWAP_FREE, 0, 0}, - {"swap[total]" ,SYSTEM_SWAP_TOTAL, 0, 0}, - {"system[procload]" ,SYSTEM_CPU_LOAD1, 0, 0}, - {"system[procload5]" ,SYSTEM_CPU_LOAD5, 0, 0}, - {"system[procload15]" ,SYSTEM_CPU_LOAD15, 0, 0}, - {"system[hostname]" ,0, EXECUTE_STR, "hostname"}, - {"system[uname]" ,0, EXECUTE_STR, "uname -a"}, - {"system[uptime]" ,SYSTEM_UPTIME, 0, 0}, - {"system[users]" ,EXECUTE, 0,"who|wc -l"}, - {"version[zabbix_agent]", 0, AGENT_VERSION, 0}, +/* incorrect OLD naming */ + {"cpu", CF_USEUPARAM, OLD_CPU, 0, "idle1"}, +/* + {"cpu[idle1]", 0, 0, 0, 0}, + {"cpu[idle5]", 0, 0, 0, 0}, + {"cpu[idle15]", 0, 0, 0, 0}, + {"cpu[nice1]", 0, 0, 0, 0}, + {"cpu[nice5]", 0, 0, 0, 0}, + {"cpu[nice15]", 0, 0, 0, 0}, + {"cpu[system1]", 0, 0, 0, 0}, + {"cpu[system5]", 0, 0, 0, 0}, + {"cpu[system15]", 0, 0, 0, 0}, + {"cpu[user1]", 0, 0, 0, 0}, + {"cpu[user5]", 0, 0, 0, 0}, + {"cpu[user15]", 0, 0, 0, 0}, +*/ + {"io", CF_USEUPARAM, OLD_IO, 0, "disk_io"}, +/* + {"io[disk_io]", 0, 0, 0, 0}, + {"io[disk_rio]", 0, 0, 0, 0}, + {"io[disk_wio]", 0, 0, 0, 0}, + {"io[disk_rblk]", 0, 0, 0, 0}, + {"io[disk_wblk]", 0, 0, 0, 0}, +*/ + {"kern", CF_USEUPARAM, OLD_KERNEL, 0, "maxfiles"}, +/* + {"kern[maxfiles]", 0, 0, 0, 0}, + {"kern[maxproc]", 0, 0, 0, 0}, +*/ + {"memory", CF_USEUPARAM, OLD_MEMORY, 0, "buffers"}, +/* + {"memory[buffers]", 0, 0, 0, 0}, + {"memory[cached]", 0, 0, 0, 0}, + {"memory[free]", 0, 0, 0, 0}, + {"memory[shared]", 0, 0, 0, 0}, + {"memory[total]", 0, 0, 0, 0}, +*/ + {"system", CF_USEUPARAM, OLD_SYSTEM, 0, "uname"}, +/* + {"system[proccount]", 0, 0, 0, 0}, + + {"system[procload]", 0, 0, 0, 0}, + {"system[procload5]", 0, 0, 0, 0}, + {"system[procload15]", 0, 0, 0, 0}, + {"system[hostname]", 0, 0, 0, 0}, + {"system[uname]", 0, 0, 0, 0}, + {"system[uptime]", 0, 0, 0, 0}, + {"system[users]", 0, 0, 0, 0}, + + {"system[procrunning]", 0, 0, 0, 0}, +*/ + {"sensor", CF_USEUPARAM, OLD_SENSOR, 0, "temp1"}, +/* + {"sensor[temp1]", 0, 0, 0, 0}, + {"sensor[temp2]", 0, 0, 0, 0}, + {"sensor[temp3]", 0, 0, 0, 0}, +*/ + {"swap", CF_USEUPARAM, OLD_SWAP, 0, "total"}, +/* + {"swap[free]", 0, 0, 0, 0}, + {"swap[total]", 0, 0, 0, 0}, +*/ + {"version", CF_USEUPARAM, OLD_VERSION, 0, "zabbix_agent"}, +/* + {"version[zabbix_agent]", 0, OLD_VERSION, 0, 0}, +*/ +/* correct OLD naming */ +/* + {"cksum", CF_USEUPARAM, VFS_FILE_CKSUM, 0, "/etc/services"}, +*/ +/* + {"diskfree", CF_USEUPARAM, VFS_FS_FREE, 0, "/"}, + {"disktotal", CF_USEUPARAM, VFS_FS_TOTAL, 0, "/"}, + {"diskused", CF_USEUPARAM, VFS_FS_USED, 0, "/"}, + {"diskfree_perc", CF_USEUPARAM, VFS_FS_PFREE, 0, "/"}, + {"diskused_perc", CF_USEUPARAM, VFS_FS_PUSED, 0, "/"}, +*/ +/* + {"file", CF_USEUPARAM, VFS_FILE_EXISTS, 0, "/etc/passwd"}, + {"filesize", CF_USEUPARAM, VFS_FILE_SIZE, 0, "/etc/passwd"}, +*/ +/* + {"inodefree", CF_USEUPARAM, VFS_FS_INODE_FREE, 0, "/"}, + {"inodetotal", CF_USEUPARAM, VFS_FS_INODE_TOTAL, 0, "/"}, + {"inodefree_perc", CF_USEUPARAM, VFS_FS_INODE_PFREE, 0, "/"}, +*/ +/* + {"md5sum", CF_USEUPARAM, VFS_FILE_MD5SUM, 0, "/etc/services"}, +*/ +/* + {"netloadin1", CF_USEUPARAM, NET_IF_IBYTES1, 0, "lo"}, + {"netloadin5", CF_USEUPARAM, NET_IF_IBYTES5, 0, "lo"}, + {"netloadin15", CF_USEUPARAM, NET_IF_IBYTES15, 0, "lo"}, + {"netloadout1", CF_USEUPARAM, NET_IF_OBYTES1, 0, "lo"}, + {"netloadout5", CF_USEUPARAM, NET_IF_OBYTES5, 0, "lo"}, + {"netloadout15", CF_USEUPARAM, NET_IF_OBYTES15, 0, "lo"}, +*/ +/* + {"ping", 0, AGENT_PING, 0, 0}, +*/ /* New naming */ - - {"agent.ping" ,AGENT_PING, 0, 0}, - {"agent.version", 0, AGENT_VERSION, 0}, - - {"kernel.maxfiles]" ,KERNEL_MAXFILES, 0, 0}, - {"kernel.maxproc" ,KERNEL_MAXPROC, 0, 0}, - - {"proc.num[*]" ,PROC_NUM, 0, "inetd"}, - {"proc.mem[*]" ,PROC_MEMORY, 0, "inetd"}, - - {"vm.memory.total" ,VM_MEMORY_TOTAL, 0, 0}, - {"vm.memory.shared" ,VM_MEMORY_SHARED, 0, 0}, - {"vm.memory.buffers" ,VM_MEMORY_BUFFERS, 0, 0}, - {"vm.memory.cached" ,VM_MEMORY_CACHED, 0, 0}, - {"vm.memory.free" ,VM_MEMORY_FREE, 0, 0}, - - {"vfs.fs.free[*]" ,VFS_FS_FREE, 0, "/"}, - {"vfs.fs.total[*]" ,VFS_FS_TOTAL, 0, "/"}, - {"vfs.fs.used[*]" ,VFS_FS_USED, 0, "/"}, - - {"vfs.fs.pfree[*]" ,VFS_FS_PFREE, 0, "/"}, - {"vfs.fs.pused[*]" ,VFS_FS_PUSED, 0, "/"}, - - {"vfs.fs.inode.free[*]" ,VFS_FS_INODE_FREE, 0, "/"}, - {"vfs.fs.inode.total[*]",VFS_FS_INODE_TOTAL, 0, "/"}, - {"vfs.fs.inode.pfree[*]",VFS_FS_INODE_PFREE, 0, "/"}, - - {"vfs.file.atime[*]" ,VFS_FILE_ATIME, 0, "/etc/passwd"}, - {"vfs.file.cksum[*]" ,VFS_FILE_CKSUM, 0, "/etc/services"}, - {"vfs.file.ctime[*]" ,VFS_FILE_CTIME, 0, "/etc/passwd"}, - {"vfs.file.exists[*]" ,VFS_FILE_EXISTS, 0, "/etc/passwd"}, - {"vfs.file.md5sum[*]" ,0, VFS_FILE_MD5SUM, "/etc/services"}, - {"vfs.file.mtime[*]" ,VFS_FILE_MTIME, 0, "/etc/passwd"}, - {"vfs.file.regexp[*]" ,0, VFS_FILE_REGEXP, "/etc/passwd,root"}, - {"vfs.file.regmatch[*]" ,VFS_FILE_REGMATCH, 0, "/etc/passwd,root"}, - {"vfs.file.size[*]" ,VFS_FILE_SIZE, 0, "/etc/passwd"}, - - {"system.cpu.idle1" ,SYSTEM_CPU_IDLE1, 0, 0}, - {"system.cpu.idle5" ,SYSTEM_CPU_IDLE5, 0, 0}, - {"system.cpu.idle15" ,SYSTEM_CPU_IDLE15, 0, 0}, - {"system.cpu.nice1" ,SYSTEM_CPU_NICE1, 0, 0}, - {"system.cpu.nice5" ,SYSTEM_CPU_NICE5, 0, 0}, - {"system.cpu.nice15" ,SYSTEM_CPU_NICE15, 0, 0}, - {"system.cpu.sys1" ,SYSTEM_CPU_SYS1, 0, 0}, - {"system.cpu.sys5" ,SYSTEM_CPU_SYS5, 0, 0}, - {"system.cpu.sys15" ,SYSTEM_CPU_SYS15, 0, 0}, - {"system.cpu.user1" ,SYSTEM_CPU_USER1, 0, 0}, - {"system.cpu.user5" ,SYSTEM_CPU_USER5, 0, 0}, - {"system.cpu.user15" ,SYSTEM_CPU_USER15, 0, 0}, - - {"net.if.ibytes1[*]" ,NET_IF_IBYTES1, 0, "lo"}, - {"net.if.ibytes5[*]" ,NET_IF_IBYTES5, 0, "lo"}, - {"net.if.ibytes15[*]" ,NET_IF_IBYTES15, 0, "lo"}, - {"net.if.obytes1[*]" ,NET_IF_OBYTES1, 0, "lo"}, - {"net.if.obytes5[*]" ,NET_IF_OBYTES5, 0, "lo"}, - {"net.if.obytes15[*]" ,NET_IF_OBYTES15, 0, "lo"}, - - {"disk_read_ops1[*]" ,DISKREADOPS1, 0, "hda"}, - {"disk_read_ops5[*]" ,DISKREADOPS5, 0, "hda"}, - {"disk_read_ops15[*]" ,DISKREADOPS15, 0, "hda"}, - - {"disk_read_blks1[*]" ,DISKREADBLKS1, 0, "hda"}, - {"disk_read_blks5[*]" ,DISKREADBLKS5, 0, "hda"}, - {"disk_read_blks15[*]" ,DISKREADBLKS15, 0, "hda"}, - - {"disk_write_ops1[*]" ,DISKWRITEOPS1, 0, "hda"}, - {"disk_write_ops5[*]" ,DISKWRITEOPS5, 0, "hda"}, - {"disk_write_ops15[*]" ,DISKWRITEOPS15, 0, "hda"}, - - {"disk_write_blks1[*]" ,DISKWRITEBLKS1, 0, "hda"}, - {"disk_write_blks5[*]" ,DISKWRITEBLKS5, 0, "hda"}, - {"disk_write_blks15[*]" ,DISKWRITEBLKS15, 0, "hda"}, - - {"sensor[temp1]" ,SENSOR_TEMP1, 0, 0}, - {"sensor[temp2]" ,SENSOR_TEMP2, 0, 0}, - {"sensor[temp3]" ,SENSOR_TEMP3, 0, 0}, - - {"system.cpu.load1" ,SYSTEM_CPU_LOAD1, 0, 0}, - {"system.cpu.load5" ,SYSTEM_CPU_LOAD5, 0, 0}, - {"system.cpu.load15" ,SYSTEM_CPU_LOAD15, 0, 0}, - - {"system.hostname" ,0, EXECUTE_STR, "hostname"}, - - {"system.swap.free" ,SYSTEM_SWAP_FREE, 0, 0}, - {"system.swap.total" ,SYSTEM_SWAP_TOTAL, 0, 0}, - - {"system.uname" ,0, EXECUTE_STR, "uname -a"}, - {"system.uptime" ,SYSTEM_UPTIME, 0, 0}, - {"system.users.num" ,EXECUTE, 0,"who|wc -l"}, +/* + {"system.cpu.idle1", 0, SYSTEM_CPU_IDLE1, 0, 0}, + {"system.cpu.idle5", 0, SYSTEM_CPU_IDLE5, 0, 0}, + {"system.cpu.idle15", 0, SYSTEM_CPU_IDLE15, 0, 0}, + {"system.cpu.nice1", 0, SYSTEM_CPU_NICE1, 0, 0}, + {"system.cpu.nice5", 0, SYSTEM_CPU_NICE5, 0, 0}, + {"system.cpu.nice15", 0, SYSTEM_CPU_NICE15, 0, 0}, + {"system.cpu.sys1", 0, SYSTEM_CPU_SYS1, 0, 0}, + {"system.cpu.sys5", 0, SYSTEM_CPU_SYS5, 0, 0}, + {"system.cpu.sys15", 0, SYSTEM_CPU_SYS15, 0, 0}, + {"system.cpu.user1", 0, SYSTEM_CPU_USER1, 0, 0}, + {"system.cpu.user5", 0, SYSTEM_CPU_USER5, 0, 0}, + {"system.cpu.user15", 0, SYSTEM_CPU_USER15, 0, 0}, +*/ +/* + {"vm.memory.total", 0, VM_MEMORY_TOTAL, 0, 0}, + {"vm.memory.shared", 0, VM_MEMORY_SHARED, 0, 0}, + {"vm.memory.buffers", 0, VM_MEMORY_BUFFERS, 0, 0}, + {"vm.memory.cached", 0, VM_MEMORY_CACHED, 0, 0}, + {"vm.memory.free", 0, VM_MEMORY_FREE, 0, 0}, +*/ +/* + {"vfs.fs.free", CF_USEUPARAM, VFS_FS_FREE, 0, "/"}, + {"vfs.fs.total", CF_USEUPARAM, VFS_FS_TOTAL, 0, "/"}, + {"vfs.fs.used", CF_USEUPARAM, VFS_FS_USED, 0, "/"}, + {"vfs.fs.pfree", CF_USEUPARAM, VFS_FS_PFREE, 0, "/"}, + {"vfs.fs.pused", CF_USEUPARAM, VFS_FS_PUSED, 0, "/"}, +*/ +/* + {"vfs.fs.inode.free", CF_USEUPARAM, VFS_FS_INODE_FREE, 0, "/"}, + {"vfs.fs.inode.total", CF_USEUPARAM, VFS_FS_INODE_TOTAL, 0, "/"}, + {"vfs.fs.inode.pfree", CF_USEUPARAM, VFS_FS_INODE_PFREE, 0, "/"}, +*/ +/* + {"net.if.ibytes1", CF_USEUPARAM, NET_IF_IBYTES1, 0, "lo"}, + {"net.if.ibytes5", CF_USEUPARAM, NET_IF_IBYTES5, 0, "lo"}, + {"net.if.ibytes15", CF_USEUPARAM, NET_IF_IBYTES15,0, "lo"}, + + {"net.if.obytes1", CF_USEUPARAM, NET_IF_OBYTES1, 0, "lo"}, + {"net.if.obytes5", CF_USEUPARAM, NET_IF_OBYTES5, 0, "lo"}, + {"net.if.obytes15", CF_USEUPARAM, NET_IF_OBYTES15,0, "lo"}, +*/ +/* + {"disk_read_ops1", CF_USEUPARAM, DISKREADOPS1, 0, "hda"}, + {"disk_read_ops5", CF_USEUPARAM, DISKREADOPS5, 0, "hda"}, + {"disk_read_ops15", CF_USEUPARAM, DISKREADOPS15, 0, "hda"}, + + {"disk_read_blks1", CF_USEUPARAM, DISKREADBLKS1, 0, "hda"}, + {"disk_read_blks5", CF_USEUPARAM, DISKREADBLKS5, 0, "hda"}, + {"disk_read_blks15", CF_USEUPARAM, DISKREADBLKS15, 0, "hda"}, + + {"disk_write_ops1", CF_USEUPARAM, DISKWRITEOPS1, 0, "hda"}, + {"disk_write_ops5", CF_USEUPARAM, DISKWRITEOPS5, 0, "hda"}, + {"disk_write_ops15", CF_USEUPARAM, DISKWRITEOPS15, 0, "hda"}, + + {"disk_write_blks1", CF_USEUPARAM, DISKWRITEBLKS1, 0, "hda"}, + {"disk_write_blks5", CF_USEUPARAM, DISKWRITEBLKS5, 0, "hda"}, + {"disk_write_blks15", CF_USEUPARAM, DISKWRITEBLKS15,0, "hda"}, +*/ +/* + {"system.cpu.load1", 0, SYSTEM_CPU_LOAD1, 0, 0}, + {"system.cpu.load5", 0, SYSTEM_CPU_LOAD5, 0, 0}, + {"system.cpu.load15", 0, SYSTEM_CPU_LOAD15, 0, 0}, +*/ /**************************************** All these perameters require more than 1 second to retrieve. @@ -277,30 +202,66 @@ ZBX_METRIC parameters_specific[]= {"system[switches]" ,EXECUTE, 0, "vmstat -n 1 2|tail -1|cut -b62-67"}, ***************************************/ - {"io[disk_io]" ,DISK_IO, 0, 0}, - {"io[disk_rio]" ,DISK_RIO, 0, 0}, - {"io[disk_wio]" ,DISK_WIO, 0, 0}, - {"io[disk_rblk]" ,DISK_RBLK, 0, 0}, - {"io[disk_wblk]" ,DISK_WBLK, 0, 0}, - - - - {"system[proccount]" ,PROCCOUNT, 0, 0}, - -#ifdef HAVE_PROC_LOADAVG - {"system[procrunning]" ,EXECUTE, 0, "cat /proc/loadavg|cut -f1 -d'/'|cut -f4 -d' '"}, -#endif - /* {"tcp_count" ,EXECUTE, 0, "netstat -tn|grep EST|wc -l"}, */ - - {"net[listen_23]" ,TCP_LISTEN, 0, "0017"}, - {"net[listen_80]" ,TCP_LISTEN, 0, "0050"}, - - {"check_port[*]" ,CHECK_PORT, 0, "80"}, - - {"check_service[*]" ,CHECK_SERVICE, 0, "ssh,127.0.0.1,22"}, - {"dns[*]" ,CHECK_DNS, 0, "127.0.0.1,localhost"}, - {"check_service_perf[*]",CHECK_SERVICE_PERF, 0, "ssh,127.0.0.1,22"}, +/* + {"check_port", CF_USEUPARAM, CHECK_PORT, 0, "80"}, + {"check_service", CF_USEUPARAM, CHECK_SERVICE, 0, "ssh,127.0.0.1,22"}, + {"check_service_perf", CF_USEUPARAM, CHECK_SERVICE_PERF, 0, "ssh,127.0.0.1,22"}, +*/ +/* + {"dns", CF_USEUPARAM, CHECK_DNS, 0, "127.0.0.1,localhost"}, +*/ + {"agent.ping", 0, AGENT_PING, 0, 0}, + {"agent.version", 0, AGENT_VERSION, 0, 0}, + + {"kernel.maxfiles", 0, KERNEL_MAXFILES, 0, 0}, + {"kernel.maxproc", 0, KERNEL_MAXPROC, 0, 0}, + + {"vfs.file.atime", CF_USEUPARAM, VFS_FILE_ATIME, 0, "/etc/passwd"}, + {"vfs.file.cksum", CF_USEUPARAM, VFS_FILE_CKSUM, 0, "/etc/services"}, + {"vfs.file.ctime", CF_USEUPARAM, VFS_FILE_CTIME, 0, "/etc/passwd"}, + {"vfs.file.exists", CF_USEUPARAM, VFS_FILE_EXISTS, 0, "/etc/passwd"}, + {"vfs.file.md5sum", CF_USEUPARAM, VFS_FILE_MD5SUM, 0, "/etc/services"}, + {"vfs.file.mtime", CF_USEUPARAM, VFS_FILE_MTIME, 0, "/etc/passwd"}, + {"vfs.file.regexp", CF_USEUPARAM, VFS_FILE_REGEXP, 0, "/etc/passwd,root"}, + {"vfs.file.regmatch", CF_USEUPARAM, VFS_FILE_REGMATCH, 0, "/etc/passwd,root"}, + {"vfs.file.size", CF_USEUPARAM, VFS_FILE_SIZE, 0, "/etc/passwd"}, + +/************************************ + * NEW FUNCTIONS * + ************************************/ + + {"net.tcp.dns", CF_USEUPARAM, CHECK_DNS, 0, "127.0.0.1,localhost"}, + + {"net.tcp.port", CF_USEUPARAM, CHECK_PORT, 0, "80"}, + {"net.tcp.service", CF_USEUPARAM, CHECK_SERVICE, 0, "ssh,127.0.0.1,22"}, + {"net.tcp.service.perf",CF_USEUPARAM, CHECK_SERVICE_PERF, 0, "ssh,127.0.0.1,22"}, + + {"net.if.in", CF_USEUPARAM, NET_IF_IN, 0, "lo,bytes"}, + {"net.if.out", CF_USEUPARAM, NET_IF_OUT, 0, "lo,bytes"}, + + {"vfs.fs.size", CF_USEUPARAM, VFS_FS_SIZE, 0, "/,free"}, + {"vfs.fs.inode", CF_USEUPARAM, VFS_FS_INODE, 0, "/,free"}, + + {"vfs.dev.read", CF_USEUPARAM, VFS_DEV_READ, 0, "hda,ops,avg1"}, + {"vfs.dev.write", CF_USEUPARAM, VFS_DEV_WRITE, 0, "hda,ops,avg1"}, + + {"vm.memory.size", CF_USEUPARAM, VM_MEMORY_SIZE, 0, "free"}, + + {"proc.num", CF_USEUPARAM, PROC_NUM, 0, "inetd,,"}, + {"proc.mem", CF_USEUPARAM, PROC_MEMORY, 0, "inetd,,"}, + + {"system.cpu.util", CF_USEUPARAM, SYSTEM_CPU_UTIL, 0, "all,user,avg1"}, + + {"system.cpu.load", CF_USEUPARAM, SYSTEM_CPU_LOAD, 0, "all,avg1"}, + + {"system.swap.size", CF_USEUPARAM, SYSTEM_SWAP_SIZE, 0, "all,free"}, + + {"system.hostname", 0, SYSTEM_HOSTNAME, 0, 0}, + + {"system.uname", 0, SYSTEM_UNAME, 0, 0}, + {"system.uptime", 0, SYSTEM_UPTIME, 0, 0}, + {"system.users.num", 0, SYSTEM_UNUM, 0, 0}, {0} }; diff --git a/src/libs/zbxsysinfo/hpux/kernel.c b/src/libs/zbxsysinfo/hpux/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/hpux/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/hpux/net.c b/src/libs/zbxsysinfo/hpux/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/hpux/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + diff --git a/src/libs/zbxsysinfo/linux/Makefile.am b/src/libs/zbxsysinfo/linux/Makefile.am index 899b3101..94393287 100644 --- a/src/libs/zbxsysinfo/linux/Makefile.am +++ b/src/libs/zbxsysinfo/linux/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c net.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/linux/kernel.c b/src/libs/zbxsysinfo/linux/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/linux/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/netbsd/Makefile.am b/src/libs/zbxsysinfo/netbsd/Makefile.am index 4e57c84f..94393287 100644 --- a/src/libs/zbxsysinfo/netbsd/Makefile.am +++ b/src/libs/zbxsysinfo/netbsd/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/netbsd/kernel.c b/src/libs/zbxsysinfo/netbsd/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/netbsd/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/netbsd/net.c b/src/libs/zbxsysinfo/netbsd/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/netbsd/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + diff --git a/src/libs/zbxsysinfo/openbsd/Makefile.am b/src/libs/zbxsysinfo/openbsd/Makefile.am index 4e57c84f..94393287 100644 --- a/src/libs/zbxsysinfo/openbsd/Makefile.am +++ b/src/libs/zbxsysinfo/openbsd/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/openbsd/kernel.c b/src/libs/zbxsysinfo/openbsd/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/openbsd/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/openbsd/net.c b/src/libs/zbxsysinfo/openbsd/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/openbsd/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + diff --git a/src/libs/zbxsysinfo/osf/Makefile.am b/src/libs/zbxsysinfo/osf/Makefile.am index 4e57c84f..94393287 100644 --- a/src/libs/zbxsysinfo/osf/Makefile.am +++ b/src/libs/zbxsysinfo/osf/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/osf/kernel.c b/src/libs/zbxsysinfo/osf/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/osf/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/osf/net.c b/src/libs/zbxsysinfo/osf/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/osf/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + diff --git a/src/libs/zbxsysinfo/osx/Makefile.am b/src/libs/zbxsysinfo/osx/Makefile.am index 4e57c84f..94393287 100644 --- a/src/libs/zbxsysinfo/osx/Makefile.am +++ b/src/libs/zbxsysinfo/osx/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/osx/kernel.c b/src/libs/zbxsysinfo/osx/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/osx/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/osx/net.c b/src/libs/zbxsysinfo/osx/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/osx/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + diff --git a/src/libs/zbxsysinfo/solaris/kernel.c b/src/libs/zbxsysinfo/solaris/kernel.c index 5dfae5e6..1ab9772a 100644 --- a/src/libs/zbxsysinfo/solaris/kernel.c +++ b/src/libs/zbxsysinfo/solaris/kernel.c @@ -19,117 +19,104 @@ #include "config.h" -#include <errno.h> - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/types.h> - -/* Definitions of uint32_t under OS/X */ -#ifdef HAVE_STDINT_H - #include <stdint.h> -#endif -#ifdef HAVE_STRINGS_H - #include <strings.h> -#endif -#ifdef HAVE_FCNTL_H - #include <fcntl.h> -#endif -#ifdef HAVE_DIRENT_H - #include <dirent.h> -#endif -/* Linux */ -#ifdef HAVE_SYS_VFS_H - #include <sys/vfs.h> -#endif -#ifdef HAVE_SYS_SYSINFO_H - #include <sys/sysinfo.h> -#endif -/* Solaris */ -#ifdef HAVE_SYS_STATVFS_H - #include <sys/statvfs.h> -#endif -/* Solaris */ -#ifdef HAVE_SYS_PROCFS_H -/* This is needed to access the correct procfs.h definitions */ - #define _STRUCTURED_PROC 1 - #include <sys/procfs.h> -#endif -#ifdef HAVE_SYS_LOADAVG_H - #include <sys/loadavg.h> -#endif -#ifdef HAVE_SYS_SOCKET_H - #include <sys/socket.h> -#endif -#ifdef HAVE_NETINET_IN_H - #include <netinet/in.h> -#endif -#ifdef HAVE_ARPA_INET_H - #include <arpa/inet.h> -#endif -/* OpenBSD/Solaris */ -#ifdef HAVE_SYS_PARAM_H - #include <sys/param.h> -#endif - -#ifdef HAVE_SYS_MOUNT_H - #include <sys/mount.h> -#endif - -/* Solaris */ -#ifdef HAVE_SYS_SWAP_H - #include <sys/swap.h> -#endif - -#ifdef HAVE_SYS_SYSCALL_H - #include <sys/syscall.h> -#endif - -#ifdef HAVE_KSTAT_H - #include <kstat.h> -#endif - -#ifdef HAVE_SYS_VAR_H -# include <sys/var.h> -#endif - #include "common.h" #include "sysinfo.h" -int SYSTEM_KERNEL_MAXPROC(const char *cmd, const char *parameter, double *value, const char *msg, int mlen_max) +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { int result = SYSINFO_RET_FAIL; kstat_ctl_t *kc; kstat_t *kt; struct var *v; - int proc_count = 0; - kc = kstat_open(); - if(kc) - { - kt = kstat_lookup(kc, "unix", 0, "var"); - if(kt) + assert(result); + + clean_result(result); + + kc = kstat_open(); + if(kc) { - if( (kt->ks_type == KSTAT_TYPE_RAW) && - (kstat_read(kc, kt, NULL) != -1) - ) - { - v = (struct var *) kt->ks_data; - - /* int v_proc; Max processes system wide */ - proc_count = v->v_proc; - result = SYSINFO_RET_OK; - } + kt = kstat_lookup(kc, "unix", 0, "var"); + if(kt) + { + if((kt->ks_type == KSTAT_TYPE_RAW) && + (kstat_read(kc, kt, NULL) != -1)) + { + v = (struct var *) kt->ks_data; + + /* int v_proc; Max processes system wide */ + result->type |= AR_DOUBLE; + result->dbl = (double)v->v_proc; + result = SYSINFO_RET_OK; + } + } + kstat_close(kc); + } + + return result; +} + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; } - kstat_close(kc); - } - *value = (double) proc_count; - - return result; + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; } diff --git a/src/libs/zbxsysinfo/unknown/Makefile.am b/src/libs/zbxsysinfo/unknown/Makefile.am index 4e57c84f..94393287 100644 --- a/src/libs/zbxsysinfo/unknown/Makefile.am +++ b/src/libs/zbxsysinfo/unknown/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS= -libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c memory.c proc.c sensors.c swap.c uptime.c +libzbxsysinfo2_a_SOURCES=cpu.c diskio.c diskspace.c inodes.c kernel.c memory.c net.c proc.c sensors.c swap.c uptime.c lib_LIBRARIES=libzbxsysinfo2.a libzbxsysinfo2_a_LIBADD = ../../zbxcommon/libzbxcommon.a ../../zbxcrypto/libzbxcrypto.a diff --git a/src/libs/zbxsysinfo/unknown/kernel.c b/src/libs/zbxsysinfo/unknown/kernel.c new file mode 100644 index 00000000..14157f22 --- /dev/null +++ b/src/libs/zbxsysinfo/unknown/kernel.c @@ -0,0 +1,116 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int KERNEL_MAXFILES(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXFILES + int mib[2],len; + int maxfiles; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXFILES; + + len=sizeof(maxfiles); + + if(sysctl(mib,2,&maxfiles,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxfiles); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int KERNEL_MAXPROC(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ +#ifdef HAVE_FUNCTION_SYSCTL_KERN_MAXPROC + int mib[2],len; + int maxproc; + + assert(result); + + clean_result(result); + + mib[0]=CTL_KERN; + mib[1]=KERN_MAXPROC; + + len=sizeof(maxproc); + + if(sysctl(mib,2,&maxproc,(size_t *)&len,NULL,0) != 0) + { + return SYSINFO_RET_FAIL; +/* printf("Errno [%m]");*/ + } + + result->type |= AR_DOUBLE; + result->dbl = (double)(maxproc); + return SYSINFO_RET_OK; +#else + return SYSINFO_RET_FAIL; +#endif +} + +int OLD_KERNEL(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + char key[MAX_STRING_LEN]; + int ret; + + assert(result); + + clean_result(result); + + if(num_param(param) > 1) + { + return SYSINFO_RET_FAIL; + } + + if(get_param(param, 1, key, MAX_STRING_LEN) != 0) + { + return SYSINFO_RET_FAIL; + } + + if(strcmp(key,"maxfiles") == 0) + { + ret = KERNEL_MAXFILES(cmd, param, flags, result); + } + else if(strcmp(key,"maxproc") == 0) + { + ret = KERNEL_MAXPROC(cmd, param, flags, result); + } + else + { + ret = SYSINFO_RET_FAIL; + } + + return ret; +} + diff --git a/src/libs/zbxsysinfo/unknown/net.c b/src/libs/zbxsysinfo/unknown/net.c new file mode 100644 index 00000000..49867845 --- /dev/null +++ b/src/libs/zbxsysinfo/unknown/net.c @@ -0,0 +1,44 @@ +/* +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix +** +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +**/ + +#include "config.h" + +#include "common.h" +#include "sysinfo.h" + +int NET_IF_IN(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + +int NET_IF_OUT(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) +{ + + assert(result); + + clean_result(result); + + return SYSINFO_RET_FAIL; +} + |