SNMP get from ASL in IONIX OI or SAM

Following on from a question that I have been asked recently, this posting is an addendum to "SNMP Get from ASL", and gives an example of invoking SNMP Get from an ASL script running against SAM or OI. This approach uses only the ACT_SNMP class, and does not depend on SNMPAgent or ICF_TopologyManager objects.

The code below should be self explanatory in the context of the earlier post.

oid = ".1.3.6.1.2.1.43.8.2.1.14.1.2";
ip = "192.168.0.6";
community = "public";
START { .. eol } do {
        snmp = create("ACT_SNMP", "ACT_SNMP-my-snmp");
        snmp->stop()?IGNORE;
        snmp->start(2000, 3);
        target = list(
                ip,              // address
                161,             // port
                "V1",            // version
                community,       // community
                "",              // username (V3)
                "",              // auth protocol (V3)
                "",              // priv protocol (V3)
                "",              // auth password (V3)
                "",              // priv password (V3)
                ""               // context name (V3)
        );
        result = snmp->get(target, oid);
        print(result);
}
Scroll to Top