还要定义alarm的mib吗?我已经有rmon的.c了,下面的函数也有了,还要自己定义吗?
/*
* var_alarmTable():
* Handle this table separately from the scalar value case.
* The workings of this are basically the same as for var_alarm
above.
*/
unsigned char *
var_alarmTable(struct variable *vp,
oid *name,
size_t *length,
int exact,
size_t *var_len,
WriteMethod **write_method)
{
/* variables we may use later */
static long long_ret;
static unsigned char string[SPRINT_MAX_LEN];
static oid objid[MAX_OID_LEN];
static struct counter64 c64;
/*
* This assumes that the table is a 'simple' table.
* See the implementation documentation for the meaning of this.
* You will need to provide the correct value for the TABLE_SIZE
parameter
*
* If this table does not meet the requirements for a simple table,
* you will need to provide the replacement code yourself.
* Mib2c is not smart enough to write this for you.
* Again, see the implementation documentation for what is
required.
*/
if (header_simple_table(vp,name,length,exact,var_len,write_method,
1)
== MATCH_FAILED )
return NULL;
/*
if (header_generic(vp,name,length,exact,var_len,write_method)
== MATCH_FAILED )
return NULL;
*/
/*
* this is where we do the value assignments for the mib results.
*/
switch(vp->magic) {
case ALARMINDEX:
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMINTERVAL:
*write_method = write_alarmInterval;
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMVARIABLE:
*write_method = write_alarmVariable;
objid[0] = 0;
objid[1] = 0;
*var_len = 2*sizeof(oid);
return (unsigned char *) objid;
case ALARMSAMPLETYPE:
*write_method = write_alarmSampleType;
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMVALUE:
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMSTARTUPALARM:
*write_method = write_alarmStartupAlarm;
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMRISINGTHRESHOLD:
*write_method = write_alarmRisingThreshold;
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMFALLINGTHRESHOLD:
*write_method = write_alarmFallingThreshold;
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMRISINGEVENTINDEX:
*write_method = write_alarmRisingEventIndex;
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMFALLINGEVENTINDEX:
*write_method = write_alarmFallingEventIndex;
long_ret = 0;
return (unsigned char *) &long_ret;
case ALARMOWNER:
*write_method = write_alarmOwner;
*string = 0;
*var_len = strlen(string);
return (unsigned char *) string;
case ALARMSTATUS:
*write_method = write_alarmStatus;
long_ret = 0;
return (unsigned char *) &long_ret;
default:
ERROR_MSG("");
}
return NULL;
> > call, or via a kernel data variable.- Hide quoted text -
>
> - Show quoted text -