Hello sir,
I want to know that how can I configure mymib.c and mymib.h
file in to my system.
Without main() function they r giving compilation error. And than also I
can not configure this files in to my system..
I have attached my ionline.c file with it.kindly reply me.
Thanks and regards,
jatin
/*
* Note: this file originally auto-generated by mib2c using
* : mib2c.int_watch.conf 13957 2005-12-20 15:33:08Z tanders $
*/
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "ionline.h"
/*
* The variables we want to tie the relevant OIDs to.
* The agent will handle all GET and (if applicable) SET requests
* to these variables automatically, changing the values as needed.
*/
int ionlineOpMode = 0; /* XXX: set default value */
int cpuPercentUsage = 0; /* XXX: set default value */
int diskCapacity = 0; /* XXX: set default value */
int diskPercentUsage = 0; /* XXX: set default value */
int memoryCapacity = 0; /* XXX: set default value */
int memoryPercentUsage = 0; /* XXX: set default value */
int swapCapacity = 0; /* XXX: set default value */
int swapPercentUsage = 0; /* XXX: set default value */
int haMode = 0; /* XXX: set default value */
int liveUsers = 0; /* XXX: set default value */
int httpHits = 0; /* XXX: set default value */
int ftpHits = 0; /* XXX: set default value */
int pop3Hits = 0; /* XXX: set default value */
int imapHits = 0; /* XXX: set default value */
int smtpHits = 0; /* XXX: set default value */
int pop3Service = 0; /* XXX: set default value */
int imap4Service = 0; /* XXX: set default value */
int smtpService = 0; /* XXX: set default value */
int ftpService = 0; /* XXX: set default value */
int httpService = 0; /* XXX: set default value */
int avService = 0; /* XXX: set default value */
int asService = 0; /* XXX: set default value */
int dnsService = 0; /* XXX: set default value */
int haService = 0; /* XXX: set default value */
int idpService = 0; /* XXX: set default value */
int analyzerService = 0; /* XXX: set default value */
int snmpService = 0; /* XXX: set default value */
int appRegStatus = 0; /* XXX: set default value */
int supportSubStatus = 0; /* XXX: set default value */
int avSubStatus = 0; /* XXX: set default value */
int asSubStatus = 0; /* XXX: set default value */
int idpSubStatus = 0; /* XXX: set default value */
int webcatSubStatus = 0; /* XXX: set default value */
/*
* Our initialization routine, called automatically by the agent
* (Note that the function name must match init_FILENAME())
*/
void
init_ionline(void)
{
netsnmp_handler_registration *reg;
netsnmp_watcher_info *winfo;
static oid ionlineOpMode_oid[] = { 1,3,6,1,4,1,21067,3,1,2,1 };
static oid cpuPercentUsage_oid[] = { 1,3,6,1,4,1,21067,3,1,2,3,1 };
static oid diskCapacity_oid[] = { 1,3,6,1,4,1,21067,3,1,2,4,1 };
static oid diskPercentUsage_oid[] = { 1,3,6,1,4,1,21067,3,1,2,4,2 };
static oid memoryCapacity_oid[] = { 1,3,6,1,4,1,21067,3,1,2,5,1 };
static oid memoryPercentUsage_oid[] = { 1,3,6,1,4,1,21067,3,1,2,5,2 };
static oid swapCapacity_oid[] = { 1,3,6,1,4,1,21067,3,1,2,5,3 };
static oid swapPercentUsage_oid[] = { 1,3,6,1,4,1,21067,3,1,2,5,4 };
static oid haMode_oid[] = { 1,3,6,1,4,1,21067,3,1,2,6 };
static oid liveUsers_oid[] = { 1,3,6,1,4,1,21067,3,1,2,7 };
static oid httpHits_oid[] = { 1,3,6,1,4,1,21067,3,1,2,8 };
static oid ftpHits_oid[] = { 1,3,6,1,4,1,21067,3,1,2,9 };
static oid pop3Hits_oid[] = { 1,3,6,1,4,1,21067,3,1,2,10,1 };
static oid imapHits_oid[] = { 1,3,6,1,4,1,21067,3,1,2,10,2 };
static oid smtpHits_oid[] = { 1,3,6,1,4,1,21067,3,1,2,10,3 };
static oid pop3Service_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,1 };
static oid imap4Service_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,2 };
static oid smtpService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,3 };
static oid ftpService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,4 };
static oid httpService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,5 };
static oid avService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,6 };
static oid asService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,7 };
static oid dnsService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,8 };
static oid haService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,9 };
static oid idpService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,10 };
static oid analyzerService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,11 };
static oid snmpService_oid[] = { 1,3,6,1,4,1,21067,3,1,2,11,12 };
static oid appRegStatus_oid[] = { 1,3,6,1,4,1,21067,3,1,3,1,1 };
static oid supportSubStatus_oid[] = { 1,3,6,1,4,1,21067,3,1,3,2,1 };
static oid avSubStatus_oid[] = { 1,3,6,1,4,1,21067,3,1,3,3,1 };
static oid asSubStatus_oid[] = { 1,3,6,1,4,1,21067,3,1,3,4,1 };
static oid idpSubStatus_oid[] = { 1,3,6,1,4,1,21067,3,1,3,5,1 };
static oid webcatSubStatus_oid[] = { 1,3,6,1,4,1,21067,3,1,3,6,1 };
/*
* a debugging statement. Run the agent with -Dionline to see
* the output of this debugging statement.
*/
DEBUGMSGTL(("ionline", "Initializing the ionline module\n"));
/*
* Register scalar watchers for each of the MIB objects.
* The ASN type and RO/RW status are taken from the MIB definition,
* but can be adjusted if needed.
*
* In most circumstances, the scalar watcher will handle all
* of the necessary processing. But the NULL parameter in the
* netsnmp_create_handler_registration() call can be used to
* supply a user-provided handler if necessary.
*
* This approach can also be used to handle Counter64, string-
* and OID-based watched scalars (although variable-sized writeable
* objects will need some more specialised initialisation).
*/
DEBUGMSGTL(("ionline",
"Initializing ionlineOpMode scalar integer. Default value =
%d\n",
ionlineOpMode));
reg = netsnmp_create_handler_registration(
"ionlineOpMode", NULL,
ionlineOpMode_oid, OID_LENGTH(ionlineOpMode_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&ionlineOpMode, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched ionlineOpMode" );
}
DEBUGMSGTL(("ionline",
"Initializing cpuPercentUsage scalar integer. Default value =
%d\n",
cpuPercentUsage));
reg = netsnmp_create_handler_registration(
"cpuPercentUsage",NULL,
cpuPercentUsage_oid, OID_LENGTH(cpuPercentUsage_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&cpuPercentUsage, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
////winfo->max_size = sizeof(cpuPercentUsage);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched cpuPercentUsage" );
}
DEBUGMSGTL(("ionline",
"Initializing diskCapacity scalar integer. Default value =
%d\n",
diskCapacity));
reg = netsnmp_create_handler_registration(
"diskCapacity", NULL,
diskCapacity_oid, OID_LENGTH(diskCapacity_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&diskCapacity, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched diskCapacity" );
}
DEBUGMSGTL(("ionline",
"Initializing diskPercentUsage scalar integer. Default value =
%d\n",
diskPercentUsage));
reg = netsnmp_create_handler_registration(
"diskPercentUsage", NULL,
diskPercentUsage_oid, OID_LENGTH(diskPercentUsage_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&diskPercentUsage, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched diskPercentUsage" );
}
DEBUGMSGTL(("ionline",
"Initializing memoryCapacity scalar integer. Default value =
%d\n",
memoryCapacity));
reg = netsnmp_create_handler_registration(
"memoryCapacity", NULL,
memoryCapacity_oid, OID_LENGTH(memoryCapacity_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&memoryCapacity, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched memoryCapacity" );
}
DEBUGMSGTL(("ionline",
"Initializing memoryPercentUsage scalar integer. Default value
= %d\n",
memoryPercentUsage));
reg = netsnmp_create_handler_registration(
"memoryPercentUsage", NULL,
memoryPercentUsage_oid, OID_LENGTH(memoryPercentUsage_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&memoryPercentUsage, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched memoryPercentUsage" );
}
DEBUGMSGTL(("ionline",
"Initializing swapCapacity scalar integer. Default value =
%d\n",
swapCapacity));
reg = netsnmp_create_handler_registration(
"swapCapacity", NULL,
swapCapacity_oid, OID_LENGTH(swapCapacity_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&swapCapacity, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched swapCapacity" );
}
DEBUGMSGTL(("ionline",
"Initializing swapPercentUsage scalar integer. Default value =
%d\n",
swapPercentUsage));
reg = netsnmp_create_handler_registration(
"swapPercentUsage", NULL,
swapPercentUsage_oid, OID_LENGTH(swapPercentUsage_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&swapPercentUsage, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched swapPercentUsage" );
}
DEBUGMSGTL(("ionline",
"Initializing haMode scalar integer. Default value = %d\n",
haMode));
reg = netsnmp_create_handler_registration(
"haMode", NULL,
haMode_oid, OID_LENGTH(haMode_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&haMode, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched haMode" );
}
DEBUGMSGTL(("ionline",
"Initializing liveUsers scalar integer. Default value = %d\n",
liveUsers));
reg = netsnmp_create_handler_registration(
"liveUsers", NULL,
liveUsers_oid, OID_LENGTH(liveUsers_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&liveUsers, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched liveUsers" );
}
DEBUGMSGTL(("ionline",
"Initializing httpHits scalar integer. Default value = %d\n",
httpHits));
reg = netsnmp_create_handler_registration(
"httpHits", NULL,
httpHits_oid, OID_LENGTH(httpHits_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&httpHits, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched httpHits" );
}
DEBUGMSGTL(("ionline",
"Initializing ftpHits scalar integer. Default value = %d\n",
ftpHits));
reg = netsnmp_create_handler_registration(
"ftpHits", NULL,
ftpHits_oid, OID_LENGTH(ftpHits_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&ftpHits, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched ftpHits" );
}
DEBUGMSGTL(("ionline",
"Initializing pop3Hits scalar integer. Default value = %d\n",
pop3Hits));
reg = netsnmp_create_handler_registration(
"pop3Hits", NULL,
pop3Hits_oid, OID_LENGTH(pop3Hits_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&pop3Hits, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched pop3Hits" );
}
DEBUGMSGTL(("ionline",
"Initializing imapHits scalar integer. Default value = %d\n",
imapHits));
reg = netsnmp_create_handler_registration(
"imapHits", NULL,
imapHits_oid, OID_LENGTH(imapHits_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&imapHits, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched imapHits" );
}
DEBUGMSGTL(("ionline",
"Initializing smtpHits scalar integer. Default value = %d\n",
smtpHits));
reg = netsnmp_create_handler_registration(
"smtpHits", NULL,
smtpHits_oid, OID_LENGTH(smtpHits_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&smtpHits, sizeof(u_long),
ASN_COUNTER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched smtpHits" );
}
DEBUGMSGTL(("ionline",
"Initializing pop3Service scalar integer. Default value =
%d\n",
pop3Service));
reg = netsnmp_create_handler_registration(
"pop3Service", NULL,
pop3Service_oid, OID_LENGTH(pop3Service_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&pop3Service, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched pop3Service" );
}
DEBUGMSGTL(("ionline",
"Initializing imap4Service scalar integer. Default value =
%d\n",
imap4Service));
reg = netsnmp_create_handler_registration(
"imap4Service", NULL,
imap4Service_oid, OID_LENGTH(imap4Service_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&imap4Service, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched imap4Service" );
}
DEBUGMSGTL(("ionline",
"Initializing smtpService scalar integer. Default value =
%d\n",
smtpService));
reg = netsnmp_create_handler_registration(
"smtpService", NULL,
smtpService_oid, OID_LENGTH(smtpService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&smtpService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched smtpService" );
}
DEBUGMSGTL(("ionline",
"Initializing ftpService scalar integer. Default value = %d\n",
ftpService));
reg = netsnmp_create_handler_registration(
"ftpService", NULL,
ftpService_oid, OID_LENGTH(ftpService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&ftpService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched ftpService" );
}
DEBUGMSGTL(("ionline",
"Initializing httpService scalar integer. Default value =
%d\n",
httpService));
reg = netsnmp_create_handler_registration(
"httpService", NULL,
httpService_oid, OID_LENGTH(httpService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&httpService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched httpService" );
}
DEBUGMSGTL(("ionline",
"Initializing avService scalar integer. Default value = %d\n",
avService));
reg = netsnmp_create_handler_registration(
"avService", NULL,
avService_oid, OID_LENGTH(avService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&avService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched avService" );
}
DEBUGMSGTL(("ionline",
"Initializing asService scalar integer. Default value = %d\n",
asService));
reg = netsnmp_create_handler_registration(
"asService", NULL,
asService_oid, OID_LENGTH(asService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&asService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched asService" );
}
DEBUGMSGTL(("ionline",
"Initializing dnsService scalar integer. Default value = %d\n",
dnsService));
reg = netsnmp_create_handler_registration(
"dnsService", NULL,
dnsService_oid, OID_LENGTH(dnsService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&dnsService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched dnsService" );
}
DEBUGMSGTL(("ionline",
"Initializing haService scalar integer. Default value = %d\n",
haService));
reg = netsnmp_create_handler_registration(
"haService", NULL,
haService_oid, OID_LENGTH(haService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&haService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched haService" );
}
DEBUGMSGTL(("ionline",
"Initializing idpService scalar integer. Default value = %d\n",
idpService));
reg = netsnmp_create_handler_registration(
"idpService", NULL,
idpService_oid, OID_LENGTH(idpService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&idpService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched idpService" );
}
DEBUGMSGTL(("ionline",
"Initializing analyzerService scalar integer. Default value =
%d\n",
analyzerService));
reg = netsnmp_create_handler_registration(
"analyzerService", NULL,
analyzerService_oid, OID_LENGTH(analyzerService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&analyzerService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched analyzerService" );
}
DEBUGMSGTL(("ionline",
"Initializing snmpService scalar integer. Default value =
%d\n",
snmpService));
reg = netsnmp_create_handler_registration(
"snmpService", NULL,
snmpService_oid, OID_LENGTH(snmpService_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&snmpService, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched snmpService" );
}
DEBUGMSGTL(("ionline",
"Initializing appRegStatus scalar integer. Default value =
%d\n",
appRegStatus));
reg = netsnmp_create_handler_registration(
"appRegStatus", NULL,
appRegStatus_oid, OID_LENGTH(appRegStatus_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&appRegStatus, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched appRegStatus" );
}
DEBUGMSGTL(("ionline",
"Initializing supportSubStatus scalar integer. Default value =
%d\n",
supportSubStatus));
reg = netsnmp_create_handler_registration(
"supportSubStatus", NULL,
supportSubStatus_oid, OID_LENGTH(supportSubStatus_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&supportSubStatus, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched supportSubStatus" );
}
DEBUGMSGTL(("ionline",
"Initializing avSubStatus scalar integer. Default value =
%d\n",
avSubStatus));
reg = netsnmp_create_handler_registration(
"avSubStatus", NULL,
avSubStatus_oid, OID_LENGTH(avSubStatus_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&avSubStatus, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched avSubStatus" );
}
DEBUGMSGTL(("ionline",
"Initializing asSubStatus scalar integer. Default value =
%d\n",
asSubStatus));
reg = netsnmp_create_handler_registration(
"asSubStatus", NULL,
asSubStatus_oid, OID_LENGTH(asSubStatus_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&asSubStatus, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched asSubStatus" );
}
DEBUGMSGTL(("ionline",
"Initializing idpSubStatus scalar integer. Default value =
%d\n",
idpSubStatus));
reg = netsnmp_create_handler_registration(
"idpSubStatus", NULL,
idpSubStatus_oid, OID_LENGTH(idpSubStatus_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&idpSubStatus, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched idpSubStatus" );
}
DEBUGMSGTL(("ionline",
"Initializing webcatSubStatus scalar integer. Default value =
%d\n",
webcatSubStatus));
reg = netsnmp_create_handler_registration(
"webcatSubStatus", NULL,
webcatSubStatus_oid, OID_LENGTH(webcatSubStatus_oid),
HANDLER_CAN_RONLY);
winfo = netsnmp_create_watcher_info(
&webcatSubStatus, sizeof(long),
ASN_INTEGER, WATCHER_FIXED_SIZE);
if (netsnmp_register_watched_scalar( reg, winfo ) < 0 ) {
snmp_log( LOG_ERR, "Failed to register watched webcatSubStatus" );
}
DEBUGMSGTL(("ionline",
"Done initalizing ionline module\n"));
}
int handle_diskp(netsnmp_mib_handler *handler,netsnmp_handler_registration
*reginfo,
netsnmp_agent_request_info *reqinfo,netsnmp_request_info
*requests)
{
/* We are never called for a GETNEXT if it's registered as a
"instance", as it's "magically" handled for us. */
/* a instance handler also only hands us one request at a time, so
we don't need to loop over a list of requests; we'll only get one. */
switch(reqinfo->mode)
{
int data=20;
case MODE_GET:
snmp_set_var_typed_value(requests->requestvb,
ASN_INTEGER,
// XXX: a pointer to the scalar's data
(u_char *) data,
// XXX: the length of the data in bytes
sizeof(data)
);
break;
default:
// we should never get here, so this is a really bad error
snmp_log(LOG_ERR, "unknown mode (%d) in handle_diskp\n",
reqinfo->mode );
printf("error to getting value\n");
return SNMP_ERR_GENERR;
}
return SNMP_ERR_NOERROR;
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users