1 Reply Latest reply on Jun 12, 2018 5:15 PM by Brendan Murray

    How to extract snmp_vals slot values in MRL ?

    Sameer Salve

      Hi,

       

      I was trying to extract values from snmp_vals slot  ( SNMP Trap) using strtolist function, but it does not work.

      I guess snmp_vals is not considered as a string, and hence the function fails.

       

      Is there a way to extract it in MRL ?

       

      Thanks

        • 1. Re: How to extract snmp_vals slot values in MRL ?
          Brendan Murray

          Hi Sameer,

           

          The snmp_vals slot is a LIST_OF STRING data type. That means it is a comma-separated list of string values. In MRL, lists of strings behave differently than simple strings. You can extract individual values, one at a time, from a LIST_OF STRING, using the MRL listgetelt function. You extract each value based on its numeric sequence in the list. The first item in the list is element 1. See the documentation I link to above for an example of the syntax.

           

          You can also convert the entire snmp_vals list into a regular string with the listtostr function. However, this actually makes it harder to work with for most purposes. I recommend you use listgetelt because it allows you to handle each snmp_vals element individually.

           

          Regards,

           

          Brendan