Freeside:1.9:Documentation:Developer/FS/part export/snmp
From Freeside
Contents
FS::part_export::snmp
This export sends SNMP SETs to a router using the Net::SNMP package. It requires the following custom fields to be defined on a router. If any of the required custom fields are not present, then the export will exit quietly.
Required custom fields
- snmp_address - IP address (or hostname) of the router/agent; snmp_comm - R/W SNMP community of the router/agent; snmp_version - SNMP version of the router/agent
Optional custom fields
- snmp_cmd_insert - SNMP SETs to perform on insert. See "Formatting"; snmp_cmd_replace - SNMP SETs to perform on replace. See "Formatting"; snmp_cmd_delete - SNMP SETs to perform on delete. See "Formatting"; snmp_cmd_suspend - SNMP SETs to perform on suspend. See "Formatting"; snmp_cmd_unsuspend - SNMP SETs to perform on unsuspend. See "Formatting"
Formatting
The values for the snmp_cmd_* fields should be formatted as follows:
<OID>||<expr>[||<OID>|<Data Type>|<expr>[...]]
- OID - SNMP object ID (ex. 1.3.6.1.4.1.1.20). If the OID string starts with a '.', then the Private Enterprise OID (1.3.6.1.4.1) is prepended.; Data Type - SNMP data types understood by Net::SNMP, as well as HEX_STRING for convenience. ex. INTEGER, OCTET_STRING, IPADDRESS, ...; expr - Expression to be eval'd by freeside. By default, the expression is double quoted and eval'd with all FS::svc_broadband fields available as scalars (ex. $svcnum, $ip_addr, $speed_up). However, if the expression contains a non-escaped double quote, the expression is eval'd without being double quoted. In this case, the expression must be a block of valid perl code that returns the desired value.
- You must escape non-delimiter pipes ("|") with a backslash.
Examples
This is an example for exporting to a Trango Access5830 AP. Newlines inserted for clarity.
- snmp_cmd_delete -
- 1.3.6.1.4.1.5454.1.20.3.5.1|INTEGER|50|| 1.3.6.1.4.1.5454.1.20.3.5.8|INTEGER|1|
- snmp_cmd_insert -
- 1.3.6.1.4.1.5454.1.20.3.5.1|INTEGER|50|| 1.3.6.1.4.1.5454.1.20.3.5.2|HEX_STRING|join("",$radio_addr =~ /[0-9a-fA-F]{2}/g)|| 1.3.6.1.4.1.5454.1.20.3.5.7|INTEGER|1|
- snmp_cmd_replace -
- 1.3.6.1.4.1.5454.1.20.3.5.1|INTEGER|50|| 1.3.6.1.4.1.5454.1.20.3.5.8|INTEGER|1||1.3.6.1.4.1.5454.1.20.3.5.1|INTEGER|50|| 1.3.6.1.4.1.5454.1.20.3.5.2|HEX_STRING|join("",$new_radio_addr =~ /[0-9a-fA-F]{2}/g)|| 1.3.6.1.4.1.5454.1.20.3.5.7|INTEGER|1|
BUGS
Plenty, I'm sure.