18
18
#include <net-snmp/agent/table_dataset.h>
19
19
#include "notification_log.h"
22
* column number definitions for table nlmLogTable
25
#define COLUMN_NLMLOGINDEX 1
26
#define COLUMN_NLMLOGTIME 2
27
#define COLUMN_NLMLOGDATEANDTIME 3
28
#define COLUMN_NLMLOGENGINEID 4
29
#define COLUMN_NLMLOGENGINETADDRESS 5
30
#define COLUMN_NLMLOGENGINETDOMAIN 6
31
#define COLUMN_NLMLOGCONTEXTENGINEID 7
32
#define COLUMN_NLMLOGCONTEXTNAME 8
33
#define COLUMN_NLMLOGNOTIFICATIONID 9
36
* column number definitions for table nlmLogVariableTable
38
#define COLUMN_NLMLOGVARIABLEINDEX 1
39
#define COLUMN_NLMLOGVARIABLEID 2
40
#define COLUMN_NLMLOGVARIABLEVALUETYPE 3
41
#define COLUMN_NLMLOGVARIABLECOUNTER32VAL 4
42
#define COLUMN_NLMLOGVARIABLEUNSIGNED32VAL 5
43
#define COLUMN_NLMLOGVARIABLETIMETICKSVAL 6
44
#define COLUMN_NLMLOGVARIABLEINTEGER32VAL 7
45
#define COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL 8
46
#define COLUMN_NLMLOGVARIABLEIPADDRESSVAL 9
47
#define COLUMN_NLMLOGVARIABLEOIDVAL 10
48
#define COLUMN_NLMLOGVARIABLECOUNTER64VAL 11
49
#define COLUMN_NLMLOGVARIABLEOPAQUEVAL 12
21
51
static u_long num_received = 0;
22
52
static u_long num_deleted = 0;
24
54
static u_long max_logged = 1000; /* goes against the mib default of infinite */
25
55
static u_long max_age = 1440; /* 1440 = 24 hours, which is the mib default */
27
netsnmp_table_data_set *nlmLogTable;
28
netsnmp_table_data_set *nlmLogVarTable;
57
static netsnmp_table_data_set *nlmLogTable;
58
static netsnmp_table_data_set *nlmLogVarTable;
31
61
netsnmp_notif_log_remove_oldest(int count)
33
63
netsnmp_table_row *deleterow, *tmprow, *deletevarrow;
306
336
netsnmp_create_handler_registration ("nlmLogVariableTable",
307
nlmLogVariableTable_handler,
308
338
nlmLogVariableTable_oid,
309
339
nlmLogVariableTable_oid_len,
310
340
HANDLER_CAN_RWRITE);
316
346
/** Initialize the nlmLogTable table by defining its contents and how it's structured */
318
348
initialize_table_nlmLogTable(const char * context)
320
350
static oid nlmLogTable_oid[] = { 1, 3, 6, 1, 2, 1, 92, 1, 3, 1 };
419
449
* the request, change nlmLogTable_handler to "NULL"
422
netsnmp_create_handler_registration("nlmLogTable", nlmLogTable_handler,
452
netsnmp_create_handler_registration("nlmLogTable", NULL,
424
454
nlmLogTable_oid_len,
425
455
HANDLER_CAN_RWRITE);
434
464
snmp_alarm_register(300, SA_REPEAT, check_log_size, NULL);
438
468
notification_log_config_handler(netsnmp_mib_handler *handler,
439
469
netsnmp_handler_registration *reginfo,
440
470
netsnmp_agent_request_info *reqinfo,
683
713
col = COLUMN_NLMLOGVARIABLEOCTETSTRINGVAL;
718
col = COLUMN_NLMLOGVARIABLEIPADDRESSVAL;
723
col = COLUMN_NLMLOGVARIABLECOUNTER64VAL;
728
col = COLUMN_NLMLOGVARIABLEOPAQUEVAL;
690
735
DEBUGMSGTL(("notification_log",
691
736
"skipping type %d\n", vptr->type));
737
(void)netsnmp_table_dataset_delete_row(myrow);
694
740
netsnmp_set_row_column(myrow, COLUMN_NLMLOGVARIABLEVALUETYPE,
710
756
check_log_size(0, NULL);
711
757
DEBUGMSGTL(("notification_log", "done logging something\n"));
714
/** handles requests for the nlmLogTable table, if anything else needs to be done */
716
nlmLogTable_handler(netsnmp_mib_handler *handler,
717
netsnmp_handler_registration *reginfo,
718
netsnmp_agent_request_info *reqinfo,
719
netsnmp_request_info *requests)
722
* perform anything here that you need to do. The requests have
723
* already been processed by the master table_dataset handler, but
724
* this gives you chance to act on the request in some other way if
727
return SNMP_ERR_NOERROR;
730
/** handles requests for the nlmLogVariableTable table, if anything else needs to be done */
732
nlmLogVariableTable_handler(netsnmp_mib_handler *handler,
733
netsnmp_handler_registration *reginfo,
734
netsnmp_agent_request_info *reqinfo,
735
netsnmp_request_info *requests)
738
* perform anything here that you need to do. The requests have
739
* already been processed by the master table_dataset handler, but
740
* this gives you chance to act on the request in some other way if
743
return SNMP_ERR_NOERROR;