ASN_OCTET_STRING type is OK, but in order to see the string as ASCII with snmptrapd
you should have defined the MIB with the trap you are sending and the string itself.
In the example notification.c, the definition of the trap is included at
NET-SNMP-EXAMPLES-MIB:
netSnmpExampleNotification OBJECT-TYPE
SYNTAX SnmpAdminString
MAX-ACCESS accessible-for-notify
STATUS current
DESCRIPTION
"This is a boring example that is used in the
agent/mibgroup/examples/notification.c to send out a
notification every 30 seconds. The actual notification means
nothing other than 30 seconds has elapsed since the last time
one was sent."
::= { netSnmpExampleNotifications 1 }
If you want to add a string to this trap you can do:
netSnmpExampleNotification OBJECT-TYPE
SYNTAX SnmpAdminString
MAX-ACCESS accessible-for-notify
OBJECTS { netSnmpExampleString } -- This is where we specify that a string is
included
STATUS current
DESCRIPTION
"This is a boring example that is used in the
agent/mibgroup/examples/notification.c to send out a
notification every 30 seconds. The actual notification means
nothing other than 30 seconds has elapsed since the last time
one was sent."
::= { netSnmpExampleNotifications 1 }
And you should also define the string (netSnmpExampleString):
netSnmpExampleString OBJECT-TYPE
SYNTAX OCTET STRING (SIZE (0..10))
MAX-ACCESS accessible-for-notify
STATUS current
DESCRIPTION
"This is a simple object which is used to send a string into a trap.
This example object is not implemented anywhere."
::= { netSnmpExampleScalars 3 }
> -----Original Message-----
> Sent: Saturday, June 12, 2004 6:48 PM
> To: [EMAIL PROTECTED]
> Subject: A small problem in usage of method
> snmp_varlist_add_variable()
>
>
> Hi,
>
>
> My aim was to programatically send a trap with some string
> parameter value.
> (like a parameter with type 's' when using the snmptrap utility)
>
> I referred the example in notification.c and put some code that uses
> snmp_varlist_add_variable() to add more variables to the trap.
> But it appears that the 4th parameter of this function has to
> be one of the ASN
> types defined in asn1.h.
> If I use ASN_OCTET_STR as type to send my string text then in
> trap that is
> received and displayed by the snmptrapd the string is
> displayed in a Hex format.
>
> I want to display the string in the ASCII style (the way it
> is displayed when
> 's' is used as the parameter type for a trap sent using snmptrap )
>
> Is there a corresponding type I can use as the 4th param in the method
> snmp_varlist_add_variable()?
> Or is there some other method/way for that?
>
> Thanks & regards,
> Viren
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the new InstallShield X.
> From Windows to Linux, servers to mobile, InstallShield X is the
> one installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> _______________________________________________
> 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
>
-------------------------------------------------------------------------------------------------------------------
Este correo electr�nico y, en su caso, cualquier fichero anexo al mismo, contiene
informaci�n de car�cter confidencial exclusivamente dirigida a su destinatario o
destinatarios. Queda prohibida su divulgaci�n, copia o distribuci�n a terceros sin la
previa autorizaci�n escrita de Indra. En el caso de haber recibido este correo
electr�nico por error, se ruega notificar inmediatamente esta circunstancia mediante
reenv�o a la direcci�n electr�nica del remitente.
The information in this e-mail and in any attachments is confidential and solely for
the attention and use of the named addressee(s). You are hereby notified that any
dissemination, distribution or copy of this communication is prohibited without the
prior written consent of Indra. If you have received this communication in error,
please, notify the sender by reply e-mail
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
>From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504
_______________________________________________
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