|
|
| Example: | | Example: |
| <pre> | | <pre> |
− | perl $regat = '.1.3.6.1.4.1.8072.999'; $root_oid = new NetSNMP::OID($regat); $config_file{root_oid} = "/etc/snmpd/snmpagent.conf"; do "snmpagent.pl"; | + | perl $regat = '.1.3.6.1.4.1.8072.999'; \ |
| + | $root_oid = new NetSNMP::OID($regat); \ |
| + | $config_file{root_oid} = "/etc/snmpd/snmpagent.conf"; \ |
| + | do "snmpagent.pl"; |
| </pre> | | </pre> |
− | And referance $config_file{$root_oid} in the program. | + | And reference $config_file{$root_oid} in the program. |
| | | |
| This could be made "the official" way to pass parameters in snmpd.conf<br> | | This could be made "the official" way to pass parameters in snmpd.conf<br> |
|
|
| Giving an entry in snmpd.conf like: | | Giving an entry in snmpd.conf like: |
| <pre> | | <pre> |
− | perl $regat = '.1.3.6.1.4.1.8072.999'; setconfig($regat, "/etc/snmpd/snmpagent.conf"); do "/etc/snmpd/snmpagent.pl"; | + | perl $regat = '.1.3.6.1.4.1.8072.999'; \ |
| + | setconfig($regat, "/etc/snmpd/snmpagent.conf"); \ |
| + | do "/etc/snmpd/snmpagent.pl"; |
| </pre> | | </pre> |
| | | |
|
|
| Here is a "fun" one: walk passwd | | Here is a "fun" one: walk passwd |
| <pre> | | <pre> |
− | perl print STDERR "Perl extentsions:\n" | + | perl print STDERR "Perl extensions:\n" |
| perl $debugging = '1'; | | perl $debugging = '1'; |
| perl $verbose = '1'; | | perl $verbose = '1'; |
− | perl $regat = '.1.3.6.1.4.1.8072.999'; $extension = '1'; $mibdata = '/etc/passwd'; $delimT=''; $delimV=':'; do "/etc/snmp/snmpagent.pl"; | + | perl $regat = '.1.3.6.1.4.1.8072.999'; $extension = '1'; \ |
| + | $mibdata = '/etc/passwd'; $delimT=''; $delimV=':'; \ |
| + | do "/etc/snmp/snmpagent.pl"; |
| </pre> | | </pre> |
| Note that if $delimT="" we assume the input is ASN_OCTET_STR and only parse for values with $delimV | | Note that if $delimT="" we assume the input is ASN_OCTET_STR and only parse for values with $delimV |
|
|
| </pre> | | </pre> |
| | | |
− | ==="Code" : perl do ===
| + | == "Code" : perl do == |
| "snapshot" or see http://svn.berlios.de/wsvn/odp/trunk/bin/snmpagent.pl?op=file&rev=0&sc=0 | | "snapshot" or see http://svn.berlios.de/wsvn/odp/trunk/bin/snmpagent.pl?op=file&rev=0&sc=0 |
| <pre> | | <pre> |
|
|
| Here is some help ... | | Here is some help ... |
| | | |
− | This program should be started from snmpd.conf, an example for allowing one to walk /etc/passwd would be when this program is /etc/snmp/snmpagent.pl: | + | This program should be started from snmpd.conf, an example for allowing |
| + | one to walk /etc/passwd would be when this program is /etc/snmp/snmpagent.pl: |
| perl print STDERR \'Perl extentsions:\' . \n\" | | perl print STDERR \'Perl extentsions:\' . \n\" |
| perl $debugging = \'1\'; | | perl $debugging = \'1\'; |
| perl $verbose = \'1\'; | | perl $verbose = \'1\'; |
Exception encountered, of type "Error"