GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Net::SNMP::Util::TC(3) User Contributed Perl Documentation Net::SNMP::Util::TC(3)

Net::SNMP::Util::TC - Giving Textual Convention of MIBs

    use Net::SNMP::Util;
    use Net::SNMP::Util::OID qw(if*);
    use Net::SNMP::Util::TC qw(updown iftype);

    $r = snmpget(
        snmp => { -hostname => $host },
        oids => { map oidp("$_.1"), qw/ifName ifType ifAdminStatus ifOperStatus/ }
    );
    my $tc = Net::SNMP::Util::TC->new();

    printf "port:%s index:%d type:%s astat:%s ostat:%s\n",
        $r->{"ifName.1"}, $index, $tc->ifType($r->{"ifType.1"}),
            updown($r->{"ifAdminStatus.1"}),
            updown($r->{"ifOperStatus.1" });

Module "Net::SNMP::Util::TC" gives the way to convert some MIB values to humans recognizable text.

This module, "Net::SNMP::Util::OID", exports "isup()" and "updown()" defalut which are for ifAdminStatus and ifOperStatus to check up or down simply.

To know status, kind or type fully, make object first and than call method with MIB value to convert like below;

    $tc = Net::SNMP::Util::TC->new();
    $status = $tc->ifAdminStatus($value);

    isup( $value );

If $value is "1", function returns 1. If values else this returns 0.

    updown( $value );

If $value is "1", function returns string 'up'. Else returns 'down'.

    $tc = Net::SNMP::Util::TC->new();

First creat an object for conversion. No arguments are need for this class. Then call method, which name is same as MIB name, with passing value you want to convert. e.g.;

    $type = $tc->ifType( 132 );     # "coffee"

Textual conversion methods now avaiable are;
ifAdminStatus()
For conversion value of MIB ifAdminStatus.
ifOperStatus()
For conversion value of MIB ifOperStatus.
ifType()
For conversion value of MIB ifType. MIB ifType is now defined as IANAifType.
ifRcvAddressType()
For conversion value of MIB ifRcvAddressType.
TruthValue()
For conversion value of MIB TruthValue.
StorageType()
For conversion value of MIB StorageType.

This method always returns 1 which is defined as true value in MIB TruthValue at RFC-1903.

This method always returns 2 which is defined as false value in MIB TruthValue at RFC-1903.

t.onodera, "<cpan :: garakuta.net>"

Net::SNMP::Util, Net::SNMP::Util::OID

Copyright(C) 2010 Takahiro Ondoera.

This program is free software; you may redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2011-02-17 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.