no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Last revision
sdk:scripts:snmp-trap [2015/05/05 15:04] – external edit 127.0.0.1
Line 1: Line 1:
 +====== SDK Script snmp-trap.are ======
 +<code c snmp-trap.are>
 +/* DESC: This script can be used to send SNMP traps
 + * Copyright (C) 2014 NetModule AG, Switzerland
 + */
 +
 +/* use SNMPv1 */
 +rc = nb_snmp_traphost("192.168.1.254", 162, 1, "public");
 +
 +if (rc != 0) {
 +    printf("unable to set traphost\n");
 +    exit(1);
 +}
 +
 +/* send null trap */
 +if (nb_snmp_trap(".1.2.3.4.5", "n", "") != 0) {
 +    printf("unable to send null trap");
 +}
 +
 +/* send an integer trap */
 +if (nb_snmp_trap(".1.2.3.4.5", "i", 1) != 0) {
 +    printf("unable to send integer trap");
 +}
 +
 +/* send an octet string trap */
 +if (nb_snmp_trap(".1.2.3.4.5", "s", "test") != 0) {
 +    printf("unable to send octet string trap");
 +}
 +
 +
 +exit(0);
 +
 +</code>