diff options
Diffstat (limited to 'include/net-snmp/agent/hardware')
-rw-r--r-- | include/net-snmp/agent/hardware/cpu.h | 68 | ||||
-rw-r--r-- | include/net-snmp/agent/hardware/fsys.h | 109 | ||||
-rw-r--r-- | include/net-snmp/agent/hardware/memory.h | 39 | ||||
-rw-r--r-- | include/net-snmp/agent/hardware/sensors.h | 48 |
4 files changed, 264 insertions, 0 deletions
diff --git a/include/net-snmp/agent/hardware/cpu.h b/include/net-snmp/agent/hardware/cpu.h new file mode 100644 index 0000000..f6e43e5 --- /dev/null +++ b/include/net-snmp/agent/hardware/cpu.h @@ -0,0 +1,68 @@ +typedef struct netsnmp_cpu_info_s netsnmp_cpu_info; +extern int cpu_num; + + /* For rolling averages */ +struct netsnmp_cpu_history { + unsigned long long user_hist; + unsigned long long sys_hist; + unsigned long long idle_hist; + unsigned long long nice_hist; + unsigned long long total_hist; + + unsigned long long ctx_hist; + unsigned long long intr_hist; + unsigned long long swpi_hist; + unsigned long long swpo_hist; + unsigned long long pagei_hist; + unsigned long long pageo_hist; +}; + +struct netsnmp_cpu_info_s { + int idx; + /* For hrDeviceTable */ + char name[ SNMP_MAXBUF ]; + char descr[ SNMP_MAXBUF ]; + int status; + + /* For UCD cpu stats */ + unsigned long long user_ticks; + unsigned long long nice_ticks; + unsigned long long sys_ticks; + unsigned long long idle_ticks; + unsigned long long wait_ticks; + unsigned long long kern_ticks; + unsigned long long intrpt_ticks; + unsigned long long sirq_ticks; + unsigned long long steal_ticks; + unsigned long long guest_ticks; + unsigned long long guestnice_ticks; + + unsigned long long total_ticks; + unsigned long long sys2_ticks; /* For non-atomic system counts */ + + /* For paging-related UCD stats */ + /* XXX - Do these belong elsewhere ?? */ + /* XXX - Do Not Use - Subject to Change */ + unsigned long long pageIn; + unsigned long long pageOut; + unsigned long long swapIn; + unsigned long long swapOut; + unsigned long long nInterrupts; + unsigned long long nCtxSwitches; + + struct netsnmp_cpu_history *history; + + netsnmp_cpu_info *next; +}; + + + /* + * Possibly not all needed ?? + */ +netsnmp_cpu_info *netsnmp_cpu_get_first( void ); +netsnmp_cpu_info *netsnmp_cpu_get_next( netsnmp_cpu_info* ); +netsnmp_cpu_info *netsnmp_cpu_get_byIdx( int, int ); +netsnmp_cpu_info *netsnmp_cpu_get_byName( char*, int ); + +netsnmp_cache *netsnmp_cpu_get_cache( void ); +int netsnmp_cpu_load( void ); diff --git a/include/net-snmp/agent/hardware/fsys.h b/include/net-snmp/agent/hardware/fsys.h new file mode 100644 index 0000000..91e8e17 --- /dev/null +++ b/include/net-snmp/agent/hardware/fsys.h @@ -0,0 +1,109 @@ +typedef struct netsnmp_fsys_info_s netsnmp_fsys_info; + +#define _NETSNMP_FS_TYPE_SKIP_BIT 0x2000 +#define _NETSNMP_FS_TYPE_LOCAL 0x1000 + + /* + * Enumeration from HOST-RESOURCES-TYPES mib + */ +#define NETSNMP_FS_TYPE_OTHER 1 +#define NETSNMP_FS_TYPE_UNKNOWN 2 +#define NETSNMP_FS_TYPE_BERKELEY 3 +#define NETSNMP_FS_TYPE_SYSV 4 +#define NETSNMP_FS_TYPE_FAT 5 +#define NETSNMP_FS_TYPE_HPFS 6 +#define NETSNMP_FS_TYPE_HFS 7 +#define NETSNMP_FS_TYPE_MFS 8 +#define NETSNMP_FS_TYPE_NTFS 9 +#define NETSNMP_FS_TYPE_VNODE 10 +#define NETSNMP_FS_TYPE_JFS 11 +#define NETSNMP_FS_TYPE_ISO9660 12 +#define NETSNMP_FS_TYPE_ROCKRIDGE 13 +#define NETSNMP_FS_TYPE_NFS 14 +#define NETSNMP_FS_TYPE_NETWARE 15 +#define NETSNMP_FS_TYPE_AFS 16 +#define NETSNMP_FS_TYPE_DFS 17 +#define NETSNMP_FS_TYPE_APPLESHARE 18 +#define NETSNMP_FS_TYPE_RFS 19 +#define NETSNMP_FS_TYPE_DGCS 20 +#define NETSNMP_FS_TYPE_BOOTFS 21 +#define NETSNMP_FS_TYPE_FAT32 22 +#define NETSNMP_FS_TYPE_EXT2 23 + + /* + * Additional enumerationis - not listed in that MIB + */ +#define NETSNMP_FS_TYPE_IGNORE 1 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT + +#define NETSNMP_FS_TYPE_PROC 2 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT + +#define NETSNMP_FS_TYPE_DEVPTS 3 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT +#define NETSNMP_FS_TYPE_SYSFS 4 | _NETSNMP_FS_TYPE_LOCAL | _NETSNMP_FS_TYPE_SKIP_BIT +#define NETSNMP_FS_TYPE_TMPFS 5 | _NETSNMP_FS_TYPE_LOCAL +#define NETSNMP_FS_TYPE_USBFS 6 | _NETSNMP_FS_TYPE_LOCAL + +#define NETSNMP_FS_FLAG_ACTIVE 0x01 +#define NETSNMP_FS_FLAG_REMOTE 0x02 +#define NETSNMP_FS_FLAG_RONLY 0x04 +#define NETSNMP_FS_FLAG_BOOTABLE 0x08 +#define NETSNMP_FS_FLAG_REMOVE 0x10 +#define NETSNMP_FS_FLAG_UCD 0x20 + +#define NETSNMP_FS_FIND_CREATE 1 /* or use one of the type values */ +#define NETSNMP_FS_FIND_EXIST 0 + +struct netsnmp_fsys_info_s { + netsnmp_index idx; + /* int idx; */ + + char path[ SNMP_MAXPATH+1]; + char device[SNMP_MAXPATH+1]; + int type; + + unsigned long long size; + unsigned long long used; + unsigned long long avail; + unsigned long long units; + + /* artificially computed values, both 'size_32' and 'units_32' fit INT32 */ + unsigned long size_32; + unsigned long used_32; + unsigned long avail_32; + unsigned long units_32; + + unsigned long long inums_total; + unsigned long long inums_avail; + + int minspace; + int minpercent; + + long flags; + + netsnmp_fsys_info *next; +}; + + + /* + * Possibly not all needed ?? + */ +netsnmp_fsys_info *netsnmp_fsys_get_first( void ); +netsnmp_fsys_info *netsnmp_fsys_get_next( netsnmp_fsys_info* ); +netsnmp_fsys_info *netsnmp_fsys_get_byIdx( int, int ); +netsnmp_fsys_info *netsnmp_fsys_get_next_byIdx(int,int ); + +netsnmp_fsys_info *netsnmp_fsys_by_device( char*, int ); +netsnmp_fsys_info *netsnmp_fsys_by_path( char*, int ); + +netsnmp_cache *netsnmp_fsys_get_cache( void ); +int netsnmp_fsys_load( netsnmp_cache *cache, void *data ); +void netsnmp_fsys_free( netsnmp_cache *cache, void *data ); + +int netsnmp_fsys_size( netsnmp_fsys_info* ); +int netsnmp_fsys_used( netsnmp_fsys_info* ); +int netsnmp_fsys_avail(netsnmp_fsys_info* ); + +unsigned long long netsnmp_fsys_size_ull( netsnmp_fsys_info* ); +unsigned long long netsnmp_fsys_used_ull( netsnmp_fsys_info* ); +unsigned long long netsnmp_fsys_avail_ull(netsnmp_fsys_info* ); + +void netsnmp_fsys_calculate32( netsnmp_fsys_info *f); diff --git a/include/net-snmp/agent/hardware/memory.h b/include/net-snmp/agent/hardware/memory.h new file mode 100644 index 0000000..aba0a6c --- /dev/null +++ b/include/net-snmp/agent/hardware/memory.h @@ -0,0 +1,39 @@ +typedef struct netsnmp_memory_info_s netsnmp_memory_info; + +#define NETSNMP_MEM_TYPE_PHYSMEM 1 +#define NETSNMP_MEM_TYPE_USERMEM 2 +#define NETSNMP_MEM_TYPE_VIRTMEM 3 +#define NETSNMP_MEM_TYPE_STEXT 4 +#define NETSNMP_MEM_TYPE_RTEXT 5 +#define NETSNMP_MEM_TYPE_MBUF 6 +#define NETSNMP_MEM_TYPE_CACHED 7 +#define NETSNMP_MEM_TYPE_SHARED 8 +#define NETSNMP_MEM_TYPE_SHARED2 9 +#define NETSNMP_MEM_TYPE_SWAP 10 + /* Leave space for individual swap devices */ +#define NETSNMP_MEM_TYPE_MAX 30 + +struct netsnmp_memory_info_s { + int idx; + int type; + char *descr; + + long units; + long size; + long free; + long other; + + netsnmp_memory_info *next; +}; + + + /* + * Possibly not all needed ?? + */ +netsnmp_memory_info *netsnmp_memory_get_first( int ); +netsnmp_memory_info *netsnmp_memory_get_next( netsnmp_memory_info*, int ); +netsnmp_memory_info *netsnmp_memory_get_byIdx( int, int ); +netsnmp_memory_info *netsnmp_memory_get_next_byIdx(int,int ); + +netsnmp_cache *netsnmp_memory_get_cache( void ); +int netsnmp_memory_load( void ); diff --git a/include/net-snmp/agent/hardware/sensors.h b/include/net-snmp/agent/hardware/sensors.h new file mode 100644 index 0000000..d59eca7 --- /dev/null +++ b/include/net-snmp/agent/hardware/sensors.h @@ -0,0 +1,48 @@ +/* + * Hardware Abstraction Layer - Sensors module + * + * Public interface + */ + +#define NETSNMP_SENSOR_TYPE_OTHER 1 +#define NETSNMP_SENSOR_TYPE_VOLTAGE_AC 3 +#define NETSNMP_SENSOR_TYPE_VOLTAGE_DC 4 +#define NETSNMP_SENSOR_TYPE_CURRENT 5 +#define NETSNMP_SENSOR_TYPE_POWER 6 +#define NETSNMP_SENSOR_TYPE_FREQUENCY 7 +#define NETSNMP_SENSOR_TYPE_TEMPERATURE 8 +#define NETSNMP_SENSOR_TYPE_HUMIDITY 9 +#define NETSNMP_SENSOR_TYPE_RPM 10 +#define NETSNMP_SENSOR_TYPE_VOLUME 11 +#define NETSNMP_SENSOR_TYPE_BOOLEAN 12 + + +#define NETSNMP_SENSOR_FLAG_ACTIVE 0x01 +#define NETSNMP_SENSOR_FLAG_NAVAIL 0x02 +#define NETSNMP_SENSOR_FLAG_BROKEN 0x04 +#define NETSNMP_SENSOR_FLAG_DISABLE 0x08 + +#define NETSNMP_SENSOR_MASK_STATUS 0x06 /* NAVAIL|BROKEN */ + + +#define NETSNMP_SENSOR_FIND_CREATE 1 /* or use one of the sensor type values */ +#define NETSNMP_SENSOR_FIND_EXIST 0 + +typedef struct netsnmp_sensor_info_s netsnmp_sensor_info; +struct netsnmp_sensor_info_s { + + netsnmp_index idx; + /* int idx; */ + char name[256]; + + int type; + float value; + char descr[256]; + long flags; +}; + +netsnmp_container *get_sensor_container( void ); +netsnmp_cache *get_sensor_cache( void ); +netsnmp_sensor_info *sensor_by_name( const char *, int ); +NetsnmpCacheLoad netsnmp_sensor_load; +NetsnmpCacheFree netsnmp_sensor_free; |