| 1 | package SNMP::Insight::MIB::HostResources; | ||
| 2 | |||
| 3 | #ABSTRACT: Support for data in UCD MIB | ||
| 4 | |||
| 5 | 2 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | ▶ | use SNMP::Insight::Moose::MIB; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 2 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 2 | our $VERSION = '0.002'; #TRIAL VERSION: | |
| 11 | |||
| 12 | 2 | mib_oid '1.3.6.1.2.1.25'; | |
| 13 | 2 | mib_name 'HOST-RESOURCES-MIB'; | |
| 14 | |||
| 15 | 2 | with 'SNMP::Insight::MIB'; | |
| 16 | |||
| 17 | 2 | has_scalar 'hrSystemUptime' => ( | |
| 18 | oid => '1.1', | ||
| 19 | ); | ||
| 20 | |||
| 21 | 2 | has_scalar 'hrSystemNumUsers' => ( | |
| 22 | oid => '1.5', | ||
| 23 | ); | ||
| 24 | |||
| 25 | 2 | has_scalar 'hrSystemProcesses' => ( | |
| 26 | oid => '1.6', | ||
| 27 | ); | ||
| 28 | |||
| 29 | 2 | has_table 'hrStorageTable' => ( | |
| 30 | oid => '2.3', | ||
| 31 | index => 'hrStorageIndex', | ||
| 32 | columns => { | ||
| 33 | 'hrStorageIndex' => 1, | ||
| 34 | 'hrStorageType' => 2, | ||
| 35 | 'hrStorageAllocationUnits' => 3, | ||
| 36 | 'hrStorageSize' => 4, | ||
| 37 | 'hrStorageUsed' => 5, | ||
| 38 | 'hrStorageAllocationFailures' => 6, | ||
| 39 | }, | ||
| 40 | ); | ||
| 41 | |||
| 42 | 2 | has_table 'hrDeviceTable' => ( | |
| 43 | oid => '3.2', | ||
| 44 | index => 'hrDeviceIndex', | ||
| 45 | columns => { | ||
| 46 | 'hrDeviceIndex' => 1, | ||
| 47 | 'hrDeviceType' => 2, | ||
| 48 | 'hrDeviceDescr' => 3, | ||
| 49 | 'hrDeviceID' => 4, | ||
| 50 | 'hrDeviceStatus' => [ 5, 'munge_device_status' ], | ||
| 51 | 'hrDeviceErrors' => 6, | ||
| 52 | }, | ||
| 53 | ); | ||
| 54 | |||
| 55 | 2 | has_table 'hrProcessorTable' => ( | |
| 56 | oid => '3.2', | ||
| 57 | index => 'hrDeviceIndex', | ||
| 58 | columns => { | ||
| 59 | 'hrProcessorFrwID' => 1, | ||
| 60 | 'hrProcessorLoad' => 2, | ||
| 61 | }, | ||
| 62 | ); | ||
| 63 | |||
| 64 | 2 | has_table 'hrDiskStorageTable' => ( | |
| 65 | oid => '3.6', | ||
| 66 | index => 'hrDiskStorageAccess', | ||
| 67 | columns => { | ||
| 68 | 'hrDiskStorageAccess' => 1, | ||
| 69 | 'hrDiskStorageMedia' => 2, | ||
| 70 | 'hrDiskStorageRemoveble' => 3, | ||
| 71 | 'hrDiskStorageCapacity' => 4, | ||
| 72 | }, | ||
| 73 | ); | ||
| 74 | |||
| 75 | #TODO hrPartitionTable | ||
| 76 | #TODO hrFSTable | ||
| 77 | |||
| 78 | 2 | has_table 'hrSWRunTable' => ( | |
| 79 | oid => '4.2', | ||
| 80 | index => 'hrSWRunIndex', | ||
| 81 | columns => { | ||
| 82 | 'hrSWRunIndex' => 1, | ||
| 83 | 'hrSWRunName' => 2, | ||
| 84 | 'hrSWRunID' => 3, | ||
| 85 | 'hrSWRunPath' => 4, | ||
| 86 | 'hrSWRunParameters' => 5, | ||
| 87 | 'hrSWRunType' => 6, | ||
| 88 | 'hrSWRunStatus' => 7, | ||
| 89 | |||
| 90 | }, | ||
| 91 | ); | ||
| 92 | |||
| 93 | # TODO hrSWRunPerl | ||
| 94 | |||
| 95 | 2 | has_table 'hrSWInstalledEntry' => ( | |
| 96 | oid => '6.3', | ||
| 97 | index => 'hrSWInstalledIndex', | ||
| 98 | columns => { | ||
| 99 | 'hrSWInstalledIndex' => 1, | ||
| 100 | 'hrSWInstalledIndex' => 2, | ||
| 101 | 'hrSWInstalledID' => 3, | ||
| 102 | 'hrSWInstalledType' => 4, | ||
| 103 | 'hrSWInstalledDate' => [ 5, 'munge_installed_date' ], | ||
| 104 | }, | ||
| 105 | ); | ||
| 106 | |||
| 107 | 0 | ▶ | sub munge_device_status { |
|
Subroutine
munge_device_status: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 108 | 0 | my $val = shift; | |
| 109 | 0 | my @stati = qw(INVALID unknown running warning testing down); | |
| 110 | 0 | return $stati[$val]; | |
| 111 | } | ||
| 112 | |||
| 113 | 0 | ▶ | sub munge_installed_date { |
|
Subroutine
munge_installed_date: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 114 | 0 | my $val = shift; | |
| 115 | |||
| 116 | 0 | my ( $y, $m, $d, $hour, $min, $sec ) = unpack( 'nCCCCC', $val ); | |
| 117 | |||
| 118 | 0 | return "$y-$m-$d $hour:$min:$sec"; | |
| 119 | |||
| 120 | } | ||
| 121 | |||
| 122 | 2 | 1; | |
| 123 | |||
| 124 | # Local Variables: | ||
| 125 | # mode: cperl | ||
| 126 | # indent-tabs-mode: nil | ||
| 127 | # cperl-indent-level: 4 | ||
| 128 | # cperl-indent-parens-as-block: t | ||
| 129 | # End: | ||
| 130 | |||
| 131 | __END__ | ||