Forum Discussion

Josh_Selinger's avatar
9 years ago

SNMP Serial Number to Info Tab

Also something we need from SNMP: From SNMP: System Name,Location,Contact,Model,Serial,Machine Type

Added to the Information Tab of each Item, so we can collect it with the API.

  • David_Lee's avatar
    David_Lee
    Former Employee

    Hi Josh,

    It's been a while since your request, sorry I didnt spot this a couple of months ago. We have propertysources now, a simple groovy script will do this for you.

    def hostname = hostProps.get("system.hostname") 
    def OID_contact = "1.3.6.1.2.1.1.4.0" // the OID we want 
    def contact = Snmp.get(hostname, OID_contact); 
    println "contact=" + contact 
    def OID_system_name = "1.3.6.1.2.1.1.5.0" // the OID we want 
    def system_name = Snmp.get(hostname, OID_system_name); 
    split_name=system_name.tokenize( '.' )
    println "system_name=" + split_name[0]
    def OID_location = "1.3.6.1.2.1.1.6.0" // the OID we want 
    def location = Snmp.get(hostname, OID_location); 
    println "location=" + location 
    return 0

    If you need any further pointers hop onto chat,

    David