Re: Would it be ok practice to put sequence OID elements to traps?
Janne Paalijarvi <[email protected]> Sat, 4 Dec 2021 20:03:51 +0200
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <CA+-shPfYypePEmg6qOhXUHscaaS2Mt_5-pmH6ivC6pxOtOAvew@mail.gmail.com> |
Ok gentlemen, finally. I will not spam the MIB file here. I hope it
retains itself at these locations:
https://gist.github.com/usvi/82c85be18c9014a49d2d108525cb9658
or
https://gist.githubusercontent.com/usvi/82c85be18c9014a49d2d108525cb9658/raw/fbfaf260260cf96edebd00b9d2034a51ff91fa4b/TemporaryResearchMib.txt
I was finally able to make it pass smilint -l 6
But maybe I will post the snmptranslate here. Yes:
src/mibs$ snmptranslate -Tp TEMPORARY-RESEARCH-MIB::exampleCorp -m
./TemporaryResearchMib.txt
+--exampleCorp(55555)
|
+--theSystem(10)
|
+--mibMeta(1)
| |
| +--productObjects(1)
| +--productNotifications(2)
| +--productCompliances(3)
|
+--productTypeOne(2)
|
+--trapsOne(0)
| |
| +--problemsTrap(1)
|
+--trapDataTable(1)
|
+--trapDataTableEntry(1)
| Index: devIndex
|
+-- ---- Integer32 devIndex(1)
| Range: 1..5
+-- -R-- Integer32 devTempAlarm(2)
| Range: 0..1
+-- -R-- Integer32 devVoltAlarm(3)
Range: 0..1
So, given this, I was gonna do something like this in C code:
netsnmp_variable_list *notification_vars = NULL;
oid oid_generic_snmptrap[] = { 1, 3, 6, 1, 6, 3, 1, 1, 4, 1, 0 };
oid oid_dev_problems_trap[] = { 1, 3, 6, 1, 4, 1, 55555, 10, 2, 0, 1 };
oid oid_dev5_temp_alarm[] = { 1, 3, 6, 1, 4, 1, 55555, 10, 2, 1, 1, 2, 5 };
int i_dev5_temp_alarm_state = 1;
snmp_varlist_add_variable(¬ification_vars,
oid_generic_snmptrap, OID_LENGHT(oid_generic_snmptrap),
(u_char *)ASN_OBJECT_ID,
oid_dev_problems_trap, OID_LENGHT(oid_dev_problems_trap) * sizeof(oid));
snmp_varlist_add_variable(¬ification_vars,
oid_dev5_temp_alarm, OID_LENGHT(oid oid_dev5_temp_alarm),
ASN_INTEGER,
(u_char *)&i_dev5_temp_alarm_state, sizeof(i_dev5_temp_alarm_state));
send_v2trap(notification_vars);
Does this look feasible in any sense?
Regards,
Mr. Janne Paalijarvi
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users