SDK Script snmp-trap.are

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);