void int_hpux(void) { /* define the structure we're going to ask the agent to register our information at */ struct variable2 hp_variables[] = { {HPCONF, ASN_INTEGER, RWRITE, var_hp, 1, {HPCONF}}, {HPRECONFIG, ASN_INTEGER, RWRITE, var_hp, 1, {HPRECONFIG}}, {HPFLAG, ASN_INTEGER, RWRITE, var_hp, 1, {HPFLAG}}, {HPLOGMASK, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORFLAG}}, {HPSTATUS, ASN_INTEGER, RWRITE, var_hp, 1, {ERRORMSG}} }; struct variable2 hptrap_variables[] = { {HPTRAP, ASN_IPADDRESS, RWRITE, var_hp, 1, {HPTRAP }}, }; /* Define the OID pointer to the top of the mib tree that we're registering underneath */ oid hp_variables_oid[] = { 1,3,6,1,4,1,11,2,13,1,2,1 }; oid hptrap_variables_oid[] = { 1,3,6,1,4,1,11,2,13,2 }; /* register ourselves with the agent to handle our mib tree */ REGISTER_MIB("mibII/hpux:hp", hp_variables, variable2, hp_variables_oid); REGISTER_MIB("mibII/hpux:hptrap", hptrap_variables, variable2, \ hptrap_variables_oid); }
void init_logmatch(void) { struct variable2 logmatch_info[] = { {LOGMATCH_INFO, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 0} }; struct variable2 logmatch_table[] = { {LOGMATCH_INDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {1}}, {LOGMATCH_NAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {2}}, {LOGMATCH_FILENAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {3}}, {LOGMATCH_REGEX, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {4}}, {LOGMATCH_GLOBALCTR, ASN_COUNTER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {5}}, {LOGMATCH_GLOBALCNT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {6}}, {LOGMATCH_CURRENTCTR, ASN_COUNTER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {7}}, {LOGMATCH_CURRENTCNT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {8}}, {LOGMATCH_COUNTER, ASN_COUNTER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {9}}, {LOGMATCH_COUNT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {10}}, {LOGMATCH_FREQ, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {11}}, {LOGMATCH_ERROR, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {100}}, {LOGMATCH_MSG, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_logmatch_table, 1, {101}} }; /* * Define the OID pointer to the top of the mib tree that we're * registering underneath */ oid logmatch_info_oid[] = { NETSNMP_UCDAVIS_MIB, 16, 1 }; oid logmatch_variables_oid[] = { NETSNMP_UCDAVIS_MIB, 16, 2, 1 }; /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("ucd-snmp/logmatch", logmatch_info, variable2, logmatch_info_oid); REGISTER_MIB("ucd-snmp/logmatch", logmatch_table, variable2, logmatch_variables_oid); snmpd_register_config_handler("logmatch", logmatch_parse_config, logmatch_free_config, "logmatch name path cycletime regex"); }
void init_ip(void) { netsnmp_handler_registration *reginfo; /* * register ourselves with the agent as a group of scalars... */ DEBUGMSGTL(("mibII/ip", "Initialising IP group\n")); reginfo = netsnmp_create_handler_registration("ip", ip_handler, ip_oid, OID_LENGTH(ip_oid), HANDLER_CAN_RONLY); netsnmp_register_scalar_group(reginfo, IPFORWARDING, IPROUTEDISCARDS); /* * .... with a local cache * (except for HP-UX 11, which extracts objects individually) */ #ifndef hpux11 netsnmp_inject_handler( reginfo, netsnmp_get_cache_handler(IP_STATS_CACHE_TIMEOUT, ip_load, ip_free, ip_oid, OID_LENGTH(ip_oid))); #endif /* * register (using the old-style API) to handle the IP tables */ REGISTER_MIB("mibII/ipaddr", ipaddr_variables, variable1, ipaddr_variables_oid); REGISTER_MIB("mibII/iproute", iproute_variables, variable1, iproute_variables_oid); REGISTER_MIB("mibII/ipmedia", ipmedia_variables, variable1, ipmedia_variables_oid); if (++ip_module_count == 2) REGISTER_SYSOR_ENTRY(ip_module_oid, "The MIB module for managing IP and ICMP implementations"); /* * for speed optimization, we call this now to do the lookup */ #ifdef IPSTAT_SYMBOL auto_nlist(IPSTAT_SYMBOL, 0, 0); #endif #ifdef IP_FORWARDING_SYMBOL auto_nlist(IP_FORWARDING_SYMBOL, 0, 0); #endif #ifdef TCP_TTL_SYMBOL auto_nlist(TCP_TTL_SYMBOL, 0, 0); #endif #ifdef MIB_IPCOUNTER_SYMBOL auto_nlist(MIB_IPCOUNTER_SYMBOL, 0, 0); #endif #ifdef solaris2 init_kernel_sunos5(); #endif }
/* static int nk_awk(char *src, int pos, char *dst) { char *ptmp = src; int j; while((*ptmp != '\0') && ((*ptmp == ' ') || (*ptmp == '\t'))) ptmp++; for(j = 0; j < pos; j++) { sscanf(ptmp, "%s", dst); ptmp += strlen(dst); while((*ptmp != '\0') && ((*ptmp == ' ') || (*ptmp == '\t'))) ptmp++; if(*ptmp == '\0') { *dst = '\0'; return -1; } } return 0; } int nk_parse_tmp_file(char *filename, int pos, char *dst) { char tmp[256]; int ret = 0; FILE *fp = fopen(filename, "r"); if(fp) { memset(tmp, '\0', sizeof(tmp)); fgets(tmp, sizeof(tmp), fp); if(nk_awk(tmp, pos, dst) < 0) { ret = -1; } fclose(fp); } else { ret = -2; } return ret; } */ void init_cisco_MIB(void) { #ifdef CONFIG_MODEL_RV0XX REGISTER_MIB("common", common_variables, variable2, common_variables_oid); REGISTER_MIB("basicMgt", basicMgt_variables, variable4, basicMgt_variables_oid); REGISTER_MIB("advanceMgt", advanceMgt_variables, variable4, advanceMgt_variables_oid); REGISTER_MIB("wanMgt", wanMgt_variables, variable4, wanMgt_variables_oid); REGISTER_MIB("entity", entity_variables, variable2, entity_variables_oid); #endif }
void zebra_snmp_init () { smux_init (zebra_oid, sizeof (zebra_oid) / sizeof (oid)); REGISTER_MIB("mibII/ipforward", zebra_variables, variable, ipfw_oid); smux_start (); }
void init_extensible(void) { struct variable2 extensible_extensible_variables[] = { {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_shell, 1, {MIBINDEX}}, {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {ERRORNAME}}, {SHELLCOMMAND, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {SHELLCOMMAND}}, {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_shell, 1, {ERRORFLAG}}, {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {ERRORMSG}}, {ERRORFIX, ASN_INTEGER, RWRITE, var_extensible_shell, 1, {ERRORFIX}}, {ERRORFIXCMD, ASN_OCTET_STR, RONLY, var_extensible_shell, 1, {ERRORFIXCMD}} }; /* Define the OID pointer to the top of the mib tree that we're registering underneath */ oid extensible_variables_oid[] = { EXTENSIBLEMIB,SHELLMIBNUM,1 }; /* register ourselves with the agent to handle our mib tree */ REGISTER_MIB("mibII/extensible", extensible_extensible_variables, variable2, \ extensible_variables_oid); snmpd_register_config_handler("exec", extensible_parse_config, extensible_free_config, "[miboid] name program arguments"); snmpd_register_config_handler("sh", extensible_parse_config, extensible_free_config, "[miboid] name program-or-script arguments"); snmpd_register_config_handler("execfix", execfix_parse_config, NULL, "exec-or-sh-name program [arguments...]"); }
void init_versioninfo(void) { /* define the structure we're going to ask the agent to register our information at */ struct variable2 extensible_version_variables[] = { {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_version, 1, {MIBINDEX}}, {VERTAG, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERTAG}}, {VERDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERDATE}}, {VERCDATE, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERCDATE}}, {VERIDENT, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERIDENT}}, {VERCONFIG, ASN_OCTET_STR, RONLY, var_extensible_version, 1, {VERCONFIG}}, {VERCLEARCACHE, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERCLEARCACHE}}, {VERUPDATECONFIG, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERUPDATECONFIG}}, {VERRESTARTAGENT, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERRESTARTAGENT}}, {VERDEBUGGING, ASN_INTEGER, RWRITE, var_extensible_version, 1, {VERDEBUGGING}} }; /* Define the OID pointer to the top of the mib tree that we're registering underneath */ oid version_variables_oid[] = { EXTENSIBLEMIB,VERSIONMIBNUM }; /* register ourselves with the agent to handle our mib tree */ REGISTER_MIB("ucd-snmp/versioninfo", extensible_version_variables, \ variable2, version_variables_oid); }
/** Initializes the cpqHost module */ void init_cpqHost(void) { DEBUGMSGTL(("cpqHost", "Initializing\n")); myDistro = getDistroInfo(); cpqHostMibStatusArray[CPQMIB].major = CPQMIBREVMAJOR; cpqHostMibStatusArray[CPQMIB].minor = CPQMIBREVMINOR; netsnmp_register_scalar_group( netsnmp_create_handler_registration("cpqHostMib", cpqHostMib_handler, cpqHostMib_oid, OID_LENGTH(cpqHostMib_oid), HANDLER_CAN_RONLY), CPQHOSTMIBREVMAJOR, CPQHOSTMIBCONDITION); netsnmp_register_scalar_group( netsnmp_create_handler_registration("cpqHostInfo", cpqHostInfo_handler, cpqHostInfo_oid, OID_LENGTH(cpqHostInfo_oid), HANDLER_CAN_RONLY), CPQHOSTNAME, CPQHOSTSYSDESCR); init_cpqHoFileSysTable(); init_cpqHoSwVerTable(); init_cpqHostOsMem(); init_cpqHoSWRunningTable(); /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("cpqHostOs", cpqHostOs_variables, variable7, cpqHostOs_variables_oid); /* * place any other initialization junk you need here */ cpqHostMibStatusArray[CPQMIB].stat = MIB_STATUS_AVAILABLE; cpqHostMibStatusArray[CPQMIB].cond = MIB_CONDITION_OK; DEBUGMSGTL(("cpqHost", "Checkinging periodic test trap interval = %d\n", testtrap_interval)); if (testtrap_interval >= 0) { if ((GenericDataStr = getenv(GenericDataEnv)) != (char *) 0) GenericData = GenericDataStr; DEBUGMSGTL(("cpqHost", "Registering periodic test trap alarm\n")); SendcpqHostGenericTrap(); if (testtrap_interval > 0) { if (snmp_alarm_register(testtrap_interval, SA_REPEAT, (SNMPAlarmCallback *) &SendcpqHostGenericTrap, NULL) == 0 ) DEBUGMSGTL(("cpqHost", "Alarm register failed\n")); } } }
void init_ip(void) { /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("mibII/ip", ip_variables, variable3, ip_variables_oid); if (++ip_module_count == 2) REGISTER_SYSOR_ENTRY(ip_module_oid, "The MIB module for managing IP and ICMP implementations"); /* * for speed optimization, we call this now to do the lookup */ #ifdef IPSTAT_SYMBOL auto_nlist(IPSTAT_SYMBOL, 0, 0); #endif #ifdef IP_FORWARDING_SYMBOL auto_nlist(IP_FORWARDING_SYMBOL, 0, 0); #endif #ifdef TCP_TTL_SYMBOL auto_nlist(TCP_TTL_SYMBOL, 0, 0); #endif #ifdef MIB_IPCOUNTER_SYMBOL auto_nlist(MIB_IPCOUNTER_SYMBOL, 0, 0); #endif #ifdef solaris2 init_kernel_sunos5(); #endif }
void init_dlmod(void) { char *p; int len; REGISTER_MIB("dlmod", dlmod_variables, variable4, dlmod_variables_oid); /* * TODO: REGISTER_SYSOR_ENTRY */ DEBUGMSGTL(("dlmod", "register mib\n")); snmpd_register_config_handler("dlmod", dlmod_parse_config, dlmod_free_config, "module-name module-path"); p = getenv("SNMPDLMODPATH"); strncpy(dlmod_path, SNMPDLMODPATH, sizeof(dlmod_path)); dlmod_path[ sizeof(dlmod_path)-1 ] = 0; if (p) { if (p[0] == ':') { len = strlen(dlmod_path); if (dlmod_path[len - 1] != ':') { strncat(dlmod_path, ":", sizeof(dlmod_path) - len -1); len++; } strncat(dlmod_path, p + 1, sizeof(dlmod_path) - len); } else strncpy(dlmod_path, p, sizeof(dlmod_path)); } dlmod_path[ sizeof(dlmod_path)-1 ] = 0; DEBUGMSGTL(("dlmod", "dlmod_path: %s\n", dlmod_path)); }
/* Register OSPFv3-MIB. */ void ospf6_snmp_init () { smux_init (ospf6d_oid, sizeof (ospf6d_oid) / sizeof (oid)); REGISTER_MIB ("OSPFv3MIB", ospfv3_variables, variable, ospfv3_oid); smux_start (); }
void init_hr_device (void) { int i; /* * Initially assume no devices * Insert pointers to initialisation/get_next routines * for particular device types as they are implemented * (set up in the appropriate 'init_*()' routine ) */ for (i = 0; i < HRDEV_TYPE_MAX; ++i) { init_device[i] = NULL; next_device[i] = NULL; save_device[i] = NULL; dev_idx_inc[i] = 0; /* Assume random indices */ device_descr[i] = NULL; device_prodid[i] = NULL; device_status[i] = NULL; device_errors[i] = NULL; } REGISTER_MIB ("host/hr_device", hrdevice_variables, variable4, hrdevice_variables_oid); }
void init_hrh_storage(void) { char *appname; netsnmp_register_scalar( netsnmp_create_handler_registration("host/hrMemorySize", handle_memsize, hrMemorySize_oid, OID_LENGTH(hrMemorySize_oid), HANDLER_CAN_RONLY)); REGISTER_MIB("host/hr_storage", hrstore_variables, variable2, hrStorageTable_oid); appname = netsnmp_ds_get_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE); netsnmp_ds_register_config(ASN_BOOLEAN, appname, "skipNFSInHostResources", NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_SKIPNFSINHOSTRESOURCES); netsnmp_ds_register_config(ASN_BOOLEAN, appname, "realStorageUnits", NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_REALSTORAGEUNITS); snmpd_register_config_handler("storageUseNFS", parse_storage_config, NULL, "1 | 2\t\t(1 = enable, 2 = disable)"); }
void init_errormib (void) { /* * define the structure we're going to ask the agent to register our * information at */ struct variable2 extensible_error_variables[] = { {MIBINDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_errors, 1, {MIBINDEX}}, {ERRORNAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_extensible_errors, 1, {ERRORNAME}}, {ERRORFLAG, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_errors, 1, {ERRORFLAG}}, {ERRORMSG, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_extensible_errors, 1, {ERRORMSG}} }; /* * Define the OID pointer to the top of the mib tree that we're * registering underneath */ oid extensible_error_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_ERRORMIBNUM }; /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB ("ucd-snmp/errormib", extensible_error_variables, variable2, extensible_error_variables_oid); }
void init_traceRouteResultsTable(void) { DEBUGMSGTL(("traceRouteResultsTable", "initializing... ")); /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("traceRouteResultsTable", traceRouteResultsTable_variables, variable2, traceRouteResultsTable_variables_oid); /* * register our config handler(s) to deal with registrations */ snmpd_register_config_handler("traceRouteResultsTable", parse_traceRouteResultsTable, NULL, NULL); /* * we need to be called back later to store our data */ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, store_traceRouteResultsTable, NULL); DEBUGMSGTL(("traceRouteResultsTable", "done.\n")); }
/* * init_snmpNotifyFilterTable(): * Initialization routine. This is called when the agent starts up. * At a minimum, registration of your variables should take place here. */ void init_snmpNotifyFilterTable(void) { DEBUGMSGTL(("snmpNotifyFilterTable", "initializing... ")); /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("snmpNotifyFilterTable", snmpNotifyFilterTable_variables, variable2, snmpNotifyFilterTable_variables_oid); /* * register our config handler(s) to deal with registrations */ snmpd_register_config_handler("snmpNotifyFilterTable", parse_snmpNotifyFilterTable, NULL, NULL); /* * we need to be called back later to store our data */ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, store_snmpNotifyFilterTable, NULL); /* * place any other initialization junk you need here */ DEBUGMSGTL(("snmpNotifyFilterTable", "done.\n")); }
void init_vmstat_darwin7(void) { struct variable2 extensible_vmstat_variables[] = { {MIBINDEX, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {MIBINDEX}}, {ERRORNAME, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORNAME}}, {SWAPIN, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPIN}}, {SWAPOUT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SWAPOUT}}, {IOSENT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IOSENT}}, {IORECEIVE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {IORECEIVE}}, {SYSINTERRUPTS, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SYSINTERRUPTS}}, {SYSCONTEXT, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {SYSCONTEXT}}, {CPUUSER, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUUSER}}, {CPUSYSTEM, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUSYSTEM}}, {CPUIDLE, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {CPUIDLE}}, {CPURAWUSER, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {CPURAWUSER}}, {CPURAWNICE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {CPURAWNICE}}, {CPURAWSYSTEM, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {CPURAWSYSTEM}}, {CPURAWIDLE, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {CPURAWIDLE}}, {CPURAWKERNEL, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {CPURAWKERNEL}}, {CPURAWINTR, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {CPURAWINTR}}, {SYSRAWINTERRUPTS, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {SYSRAWINTERRUPTS}}, {SYSRAWCONTEXT, ASN_COUNTER, RONLY, var_extensible_vmstat, 1, {SYSRAWCONTEXT}}, /* * Future use: */ /* * {ERRORFLAG, ASN_INTEGER, RONLY, var_extensible_vmstat, 1, {ERRORFLAG }}, * {ERRORMSG, ASN_OCTET_STR, RONLY, var_extensible_vmstat, 1, {ERRORMSG }} */ }; /* * Define the OID pointer to the top of the mib tree that we're * registering underneath */ oid vmstat_variables_oid[] = { UCDAVIS_MIB, 11 }; /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("ucd-snmp/vmstat", extensible_vmstat_variables, variable2, vmstat_variables_oid); }
void init_dlmod(void) { REGISTER_MIB("dlmod", dlmod_variables, variable4, dlmod_variables_oid); /* * TODO: REGISTER_SYSOR_ENTRY */ DEBUGMSGTL(("dlmod", "register mib\n")); snmpd_register_config_handler("dlmod", dlmod_parse_config, dlmod_free_config, "module-name module-path"); { const char * const p = getenv("SNMPDLMODPATH"); strlcpy(dlmod_path, SNMPDLMODPATH, sizeof(dlmod_path)); if (p) { if (p[0] == ':') { int len = strlen(dlmod_path); if (len >= 1 && dlmod_path[len - 1] != ':') strlcat(dlmod_path, ":", sizeof(dlmod_path)); strlcat(dlmod_path, p + 1, sizeof(dlmod_path)); } else strlcpy(dlmod_path, p, sizeof(dlmod_path)); } } DEBUGMSGTL(("dlmod", "dlmod_path: %s\n", dlmod_path)); }
void init_loadave(void) { /* * define the structure we're going to ask the agent to register our * information at */ struct variable2 extensible_loadave_variables[] = { {MIBINDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_loadave, 1, {MIBINDEX}}, {ERRORNAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_extensible_loadave, 1, {ERRORNAME}}, {LOADAVE, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_extensible_loadave, 1, {LOADAVE}}, {LOADMAXVAL, ASN_OCTET_STR, NETSNMP_OLDAPI_RWRITE, var_extensible_loadave, 1, {LOADMAXVAL}}, {LOADAVEINT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_loadave, 1, {LOADAVEINT}}, #ifdef NETSNMP_WITH_OPAQUE_SPECIAL_TYPES {LOADAVEFLOAT, ASN_OPAQUE_FLOAT, NETSNMP_OLDAPI_RONLY, var_extensible_loadave, 1, {LOADAVEFLOAT}}, #endif {ERRORFLAG, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_loadave, 1, {ERRORFLAG}}, {ERRORMSG, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_extensible_loadave, 1, {ERRORMSG}} }; /* * Define the OID pointer to the top of the mib tree that we're * registering underneath */ oid loadave_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_LOADAVEMIBNUM, 1 }; /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("ucd-snmp/loadave", extensible_loadave_variables, variable2, loadave_variables_oid); laConfigSet = 0; snmpd_register_config_handler("load", loadave_parse_config, loadave_free_config, "max1 [max5] [max15]"); snmpd_register_config_handler("pload", loadave_parse_config, NULL, NULL); /* * we need to be called back later */ snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_STORE_DATA, loadave_store_config, NULL); }
void init_hr_disk(void) { int i; init_device[HRDEV_DISK] = Init_HR_Disk; next_device[HRDEV_DISK] = Get_Next_HR_Disk; save_device[HRDEV_DISK] = Save_HR_Disk_General; #ifdef HRD_MONOTONICALLY_INCREASING dev_idx_inc[HRDEV_DISK] = 1; #endif #if defined(linux) Add_HR_Disk_entry("/dev/hd%c%d", -1, -1, 'a', 'l', "/dev/hd%c", 1, 15); Add_HR_Disk_entry("/dev/sd%c%d", -1, -1, 'a', 'p', "/dev/sd%c", 1, 15); Add_HR_Disk_entry("/dev/md%d", -1, -1, 0, 3, "/dev/md%d", 0, 0); Add_HR_Disk_entry("/dev/fd%d", -1, -1, 0, 1, "/dev/fd%d", 0, 0); #elif defined(hpux) #if defined(hpux10) || defined(hpux11) Add_HR_Disk_entry("/dev/rdsk/c%dt%xd%d", 0, 1, 0, 15, "/dev/rdsk/c%dt%xd0", 0, 4); #else /* hpux9 */ Add_HR_Disk_entry("/dev/rdsk/c%dd%xs%d", 201, 201, 0, 15, "/dev/rdsk/c%dd%xs0", 0, 4); #endif #elif defined(solaris2) Add_HR_Disk_entry("/dev/rdsk/c%dt%dd0s%d", 0, 7, 0, 15, "/dev/rdsk/c%dt%dd0s0", 0, 7); Add_HR_Disk_entry("/dev/rdsk/c%dd%ds%d", 0, 7, 0, 15, "/dev/rdsk/c%dd%ds0", 0, 7); #elif defined(freebsd4) || defined(freebsd5) Add_HR_Disk_entry("/dev/ad%ds%d%c", 0, 1, 1, 4, "/dev/ad%ds%d", 'a', 'h'); Add_HR_Disk_entry("/dev/da%ds%d%c", 0, 1, 1, 4, "/dev/da%ds%d", 'a', 'h'); #elif defined(freebsd3) Add_HR_Disk_entry("/dev/wd%ds%d%c", 0, 1, 1, 4, "/dev/wd%ds%d", 'a', 'h'); Add_HR_Disk_entry("/dev/sd%ds%d%c", 0, 1, 1, 4, "/dev/sd%ds%d", 'a', 'h'); #elif defined(freebsd2) Add_HR_Disk_entry("/dev/wd%d%c", -1, -1, 0, 3, "/dev/wd%d", 'a', 'h'); Add_HR_Disk_entry("/dev/sd%d%c", -1, -1, 0, 3, "/dev/sd%d", 'a', 'h'); #elif defined(netbsd1) Add_HR_Disk_entry("/dev/wd%d%c", -1, -1, 0, 3, "/dev/wd%dc", 'a', 'h'); Add_HR_Disk_entry("/dev/sd%d%c", -1, -1, 0, 3, "/dev/sd%dc", 'a', 'h'); #endif device_descr[HRDEV_DISK] = describe_disk; HRD_savedModel[0] = '\0'; HRD_savedCapacity = 0; for (i = 0; i < HRDEV_TYPE_MASK; ++i) HRD_history[i] = -1; REGISTER_MIB("host/hr_disk", hrdisk_variables, variable4, hrdisk_variables_oid); snmpd_register_config_handler("ignoredisk", parse_disk_config, free_disk_config, "name"); }
/* Register RIPv2-MIB. */ void rip_snmp_init () { rip_ifaddr_table = route_table_init (); smux_init (master); REGISTER_MIB("mibII/rip", rip_variables, variable, rip_oid); }
/* * init_dot3(): * Initialization routine. This is called when the agent starts up. * At a minimum, registration of your variables should take place here. */ void init_dot3(void) { /* register ourselves with the agent to handle our mib tree */ REGISTER_MIB("dot3", dot3_variables, variable4, dot3_variables_oid); /* place any other initialization junk you need here */ }
void init_alarm (void) { REGISTER_MIB ("alarmTable", oidalarmVariables, variable7, oidalarmVariablesOid); ROWAPI_init_table (&AlarmCtrlTable, "Alarm", 0, &alarm_Create, NULL, /* &alarm_Clone, */ NULL, /* &alarm_Delete, */ &alarm_Validate, &alarm_Activate, &alarm_Deactivate, &alarm_Copy); }
void init_event(void) { REGISTER_MIB("eventTable", eventTable_variables, variable2, eventTable_variables_oid); REGISTER_MIB("logTable", logTable_variables, variable2, logTable_variables_oid); ROWAPI_init_table(&EventCtrlTable, "Event", 0, &event_Create, &event_Clone, &event_Delete, NULL, /* &event_Validate, */ &event_Activate, &event_Deactivate, &event_Copy); #if 0 add_event_entry(3, "Alarm", EVENT_LOG_AND_TRAP, NULL); /* * add_event_entry (5, ">=", EVENT_LOG_AND_TRAP, NULL); */ #endif }
void init_memory_hpux(void) { struct variable2 extensible_mem_variables[] = { {MIBINDEX, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MIBINDEX}}, {ERRORNAME, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {ERRORNAME}}, {MEMTOTALSWAP, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMTOTALSWAP}}, {MEMAVAILSWAP, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMAVAILSWAP}}, {MEMTOTALREAL, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMTOTALREAL}}, {MEMAVAILREAL, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMAVAILREAL}}, {MEMTOTALSWAPTXT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMTOTALSWAPTXT}}, {MEMUSEDSWAPTXT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMUSEDSWAPTXT}}, {MEMTOTALREALTXT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMTOTALREALTXT}}, {MEMUSEDREALTXT, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMUSEDREALTXT}}, {MEMTOTALFREE, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMTOTALFREE}}, {MEMSWAPMINIMUM, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMSWAPMINIMUM}}, {MEMSHARED, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMSHARED}}, {MEMBUFFER, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMBUFFER}}, {MEMCACHED, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {MEMCACHED}}, {ERRORFLAG, ASN_INTEGER, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {ERRORFLAG}}, {ERRORMSG, ASN_OCTET_STR, NETSNMP_OLDAPI_RONLY, var_extensible_mem, 1, {ERRORMSG}} }; /* * Define the OID pointer to the top of the mib tree that we're * registering underneath */ oid mem_variables_oid[] = { NETSNMP_UCDAVIS_MIB, NETSNMP_MEMMIBNUM }; /* * register ourselves with the agent to handle our mib tree */ REGISTER_MIB("ucd-snmp/memory", extensible_mem_variables, variable2, mem_variables_oid); snmpd_register_config_handler("swap", memory_parse_config, memory_free_config, "min-avail"); } /* end init_hpux */
/* Register RIPv2-MIB. */ void rip_snmp_init () { rip_ifaddr_table = route_table_init (); smux_init (ripd_oid, sizeof (ripd_oid) / sizeof (oid)); REGISTER_MIB("mibII/rip", rip_variables, variable, rip_oid); smux_start (); }
void init_disk(void) { /* register ourselves with the agent to handle our mib tree */ REGISTER_MIB("mibII/dis", extensible_disk_variables, variable2, \ disk_variables_oid); snmpd_register_config_handler("disk", disk_parse_config, disk_free_config, "path [ minspace | minpercent% ]"); }
void init_usmStats (void) { #ifdef USING_MIBII_SYSORTABLE_MODULE static oid reg[] = {1,3,6,1,6,3,15,2,1,1}; register_sysORTable(reg,10,"The management information definitions for the SNMP User-based Security Model."); #endif REGISTER_MIB("snmpv3/usmStats", usmStats_variables, variable2, \ usmStats_variables_oid ); }
/* * init_icmp(): * Initialization routine. This is called when the agent starts up. * At a minimum, registration of your variables should take place here. */ void init_icmp(void) { /* register ourselves with the agent to handle our mib tree */ REGISTER_MIB("icmp", icmp_variables, variable2, icmp_variables_oid); /* place any other initialization junk you need here */ }
void init_hr_system(void) { #ifdef NPROC_SYMBOL auto_nlist(NPROC_SYMBOL, 0, 0); #endif REGISTER_MIB("host/hr_system", hrsystem_variables, variable2, hrsystem_variables_oid); } /* end init_hr_system */