| 1 | package CPM; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | #no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | $VERSION="1.2_01"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use IO::Socket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Net::SNMP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Net::Address::IP::Local; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use Net::Ping; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use Net::SMTP_auth; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | sub new{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | my $class=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my $self={@_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | $self->_init; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | sub _init{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | if (defined ($self->{-config})){$self->{config}=$self->{-config};} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | else{ $self->{config}='config.xml';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $testip=eval{$self->{address}=Net::Address::IP::Local->public}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if($@){$self->{address}='127.0.0.1';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $self->{net}=$self->{address}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $self->{net}=~s/\.\d*\Z//; # extract net from address | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $self->{xml}=XMLin($self->{config},('forcearray',['device'])); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $self->{url}=$self->{xml}->{call}.'?login='.$self->{xml}->{id}->{user}.'&nppas='.$self->{xml}->{id}->{pass}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | sub saveconfig{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
saveconfig: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | my $out=XML::Simple::XMLout($self->{xml},('keeproot',1,xmldecl=>'<?xml version="1.0" encoding="UTF-8"?>')) || die "can't XMLout: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
XML::Simple::XMLout($self->{'xml'}, ('keeproot', 1, 'xmldecl', '<?xml version="1.0" encoding="UTF-8"?>')) || die("can't XMLout: $!")
MC/DC0%0/1
XML::Simple::XMLout($self->{'xml'}, ('keeproot', 1, 'xmldecl', '<?xml version="1.0" encoding="UTF-8"?>')) || die("can't XMLout: $!")
XML::Simple::XMLout($self->{'xml'}, ('keeproot', 1, 'xmldecl', '<?xml version="1.0" encoding="UTF-8"?>'))
Truth table0%0/2
A
A= XML::Simple::XMLout($self->{'xml'}, ('keeproot', 1, 'xmldecl', '<?xml version="1.0" encoding="UTF-8"?>'))
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | open (OUTFILE, '>'.$self->{config}) || die "can't open output file: $!"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | binmode(OUTFILE, ":utf8"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | print OUTFILE $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | close OUTFILE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | sub request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # Make an SNMP request to read any OID (i.e Serial and Model) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
request: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $oid=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my %properties=@_; # rest of params by hash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my $type='none'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | $type=$properties{'-type'} if defined $properties{'-type'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $session=Net::SNMP->session(-hostname=>$self->{target}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if (!defined($session)) {return "TimeOut";} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $result = $session->get_request( varbindlist => [$oid]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $session->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | if(!defined($result->{$oid})){return "UnknownOID";} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | if($type eq 'MAC') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $result->{$oid}=~s/\A0x//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $result->{$oid}=~s/.{2}/$&:/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | $result->{$oid}=~s/:\Z//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | return uc($result->{$oid}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | elsif($type eq 'SN') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if(length($result->{$oid})<5){return "UnknownOID";} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | elsif($result->{$oid}=~/X{5,}/){return "UnknownOID";} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if($result->{$oid}=~/0x.*/){$result->{$oid}=_hex2ascii($result->{$oid});} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | return $result->{$oid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if($result->{$oid}=~/0x.*/){$result->{$oid}=_hex2ascii($result->{$oid});} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | return $result->{$oid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | sub requesttable | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # Make an SNMP walk request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
requesttable: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my $baseoid=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | # Start a sesion connect to the host | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my $session=Net::SNMP->session(-hostname=>$self->{target}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if (!defined($session)) {return "TimeOut";} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | # make a get-request | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | my $result = $session->get_table(-baseoid=>$baseoid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $values=$session->var_bind_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my @koids = keys(%{$values}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | my $string=''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | foreach my $v(@koids) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $string.=$result->{$v}.'. '; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | $session->close; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if($result) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | return "UnkownObject"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | sub _osocket | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # Open a socket on the 9100 port looking for JetDirects | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_osocket: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | my $sock = new IO::Socket::INET ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | PeerAddr => $self->{target}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | PeerPort => '9100', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | Proto => 'tcp', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if(!defined $sock){return -1;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | else {close($sock);return 1} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | sub _ping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # Check by ping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ping: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $ping = Net::Ping->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | #return $ping->ping($self->{target},1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | return $ping->ping($self->{target}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | sub _hex2ascii | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # Translate Hex to Ascii removing 0x0115 HP character | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | my $str=shift||return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_hex2ascii: not called CC=5 SCAR=34.0
Condition0%0/2
shift() || (return)
MC/DC0%0/1
shift() || (return)
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $str=~s/0x0115//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $str=~s/([a-fA-F0-9]{2})/chr(hex $1)/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $str=~s/\A0x.{2}//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | #And eliminate Non Printable Chars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my @chars = split(//,$str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $str=""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | foreach my $ch (@chars){ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | if ((ord($ch) > 31) && (ord($ch) < 127)){ $str .= $ch; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ord $ch > 31 and ord $ch < 127
MC/DC0%0/2
ord $ch > 31 and ord $ch < 127
ord $ch > 31
ord $ch < 127
Truth table0%0/3
A and B
A= ord $ch > 31B= ord $ch < 127
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | return $str; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | sub checkip | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # Check socket and its snmp for specific IP | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkip: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $ping=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if($self->_ping) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | # If we find the 9100 open, then... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if($self->_osocket>0){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my ($sn,$trace)=$self->_getsn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | return $sn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | # else {print "Ping but not socket\n";return 0;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | # else {print "No ping\n"; return 0;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | sub _getsn | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | # Try to identify the SN using the standard OIDs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_getsn: not called CC=14 SCAR=53.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $value='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0',-type=>'SN')) ne 'UnknownOID'){return $value,'1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 13 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.5.1.1.17.1',-type=>'SN')) ne 'UnknownOID'){return $value,'2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1248.1.2.2.1.1.1.5.1',-type=>'SN')) ne 'UnknownOID'){return $value,'3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1347.43.5.1.1.28.1',-type=>'SN')) ne 'UnknownOID'){return $value,'4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.11.1.10.45.0',-type=>'SN')) ne 'UnknownOID'){return $value,'5-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.23.2.32.4.3.0',-type=>'SN')) ne 'UnknownOID'){return $value,'6-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.253.8.53.3.2.1.3.1',-type=>'SN')) ne 'UnknownOID'){return $value,'7-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.1.4.0',-type=>'SN')) ne 'UnknownOID'){return $value,'8-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.6.1.1.7.1',-type=>'SN')) ne 'UnknownOID'){return $value,'9-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.641.2.1.2.1.6.1',-type=>'SN')) ne 'UnknownOID'){return $value,'10-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0',-type=>'SN')) ne 'UnknownOID'){return $value,'11-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.2.2.1.6.1',-type=>'MAC')) ne 'UnknownOID'){return $value,'12-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.2.2.1.6.2',-type=>'MAC')) ne 'UnknownOID'){return $value,'13-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | return $value,'X-'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | sub getgeneric | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getgeneric: not called CC=99 SCAR=92.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $host; # structure to store the results (if any) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | my $value=''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ($host->{SN},$host->{TRACE})=$self->_getsn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $host->{TOTAL}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.10.2.1.4.1.1')) ne 'UnknownOID'){$host->{TOTAL}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.641.2.1.5.1.0')) ne 'UnknownOID'){$host->{TOTAL}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $host->{COLOR}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.4.1.11.2.3.9.4.2.1.4.1.2.7.0')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1248.1.2.2.27.1.1.4.1.1')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1347.42.2.2.1.1.3.1.2')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.253.8.53.13.2.1.6.1.20.33')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.19.5.1.9.12')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='5-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.19.5.1.9.13')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='6-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.19.5.1.9.21')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='7-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.19.5.1.9.5')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='8-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.3.2.3.2.1.4.128.1')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='9-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.641.2.1.5.3.0')) ne 'UnknownOID'){$host->{COLOR}=$value;$host->{TRACE}.='10-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | $host->{MC1}='100'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.1')) ne 'UnknownOID'){$host->{MC1}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.4.1')) ne 'UnknownOID'){$host->{MC1}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.20.2.2.1.9.2.3')) ne 'UnknownOID'){$host->{MC1}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | ▶ | if($host->{MC1}==0){$host->{MC1}=100;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $host->{CC1}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.1')) ne 'UnknownOID'){$host->{CC1}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.3.1')) ne 'UnknownOID'){$host->{CC1}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.253.8.53.20.2.1.7.2.1.4.20.3')) ne 'UnknownOID'){$host->{CC1}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.24.1.1.5.1')) ne 'UnknownOID'){$host->{CC1}=$value;$host->{TRACE}.='4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $host->{MC2}='100'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.2')) ne 'UnknownOID'){$host->{MC2}=$value;$host->{TRACE}.='5-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.4.2')) ne 'UnknownOID'){$host->{MC2}=$value;$host->{TRACE}.='6-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.20.2.2.1.9.2.3')) ne 'UnknownOID'){$host->{MC2}=$value;$host->{TRACE}.='7-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if($host->{MC2}==0){$host->{MC2}=100;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $host->{CC2}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.2')) ne 'UnknownOID'){$host->{CC2}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.3.2')) ne 'UnknownOID'){$host->{CC2}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.253.8.53.20.2.1.7.2.1.1.20.3')) ne 'UnknownOID'){$host->{CC2}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.24.1.1.5.2')) ne 'UnknownOID'){$host->{CC2}=$value;$host->{TRACE}.='4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | $host->{MC3}='100'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.3')) ne 'UnknownOID'){$host->{MC3}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.4.3')) ne 'UnknownOID'){$host->{MC3}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.20.2.2.1.9.2.3')) ne 'UnknownOID'){$host->{MC3}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if($host->{MC3}==0){$host->{MC3}=100;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | $host->{CC3}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.3')) ne 'UnknownOID'){$host->{CC3}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.3.3')) ne 'UnknownOID'){$host->{CC3}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.253.8.53.20.2.1.7.2.1.2.20.3')) ne 'UnknownOID'){$host->{CC3}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.24.1.1.5.3')) ne 'UnknownOID'){$host->{CC3}=$value;$host->{TRACE}.='4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $host->{MC4}='100'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.4')) ne 'UnknownOID'){$host->{MC4}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.4.4')) ne 'UnknownOID'){$host->{MC4}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.20.2.2.1.9.2.3')) ne 'UnknownOID'){$host->{MC4}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | if($host->{MC4}==0){$host->{MC4}=100;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | $host->{CC4}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.4')) ne 'UnknownOID'){$host->{CC4}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.1.1.1.100.3.1.1.3.4')) ne 'UnknownOID'){$host->{CC4}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.253.8.53.20.2.1.7.2.1.3.20.3')) ne 'UnknownOID'){$host->{CC4}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.2.24.1.1.5.4')) ne 'UnknownOID'){$host->{CC4}=$value;$host->{TRACE}.='4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $host->{MC5}='100'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.5')) ne 'UnknownOID'){$host->{MC5}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.8')) ne 'UnknownOID'){$host->{MC5}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.11')) ne 'UnknownOID'){$host->{MC5}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | ▶ | if($host->{MC5}==0){$host->{MC5}=100;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | $host->{CC5}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.5')) ne 'UnknownOID'){$host->{CC5}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.8')) ne 'UnknownOID'){$host->{CC5}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.11')) ne 'UnknownOID'){$host->{CC5}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | $host->{MC6}='100'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.6')) ne 'UnknownOID'){$host->{MC6}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.9')) ne 'UnknownOID'){$host->{MC6}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | if($host->{MC6}==0){$host->{MC6}=100;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $host->{CC6}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.6')) ne 'UnknownOID'){$host->{CC6}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.9')) ne 'UnknownOID'){$host->{CC6}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $host->{MC7}='100'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.7')) ne 'UnknownOID'){$host->{MC7}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.10')) ne 'UnknownOID'){$host->{MC7}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.8.1.11')) ne 'UnknownOID'){$host->{MC7}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | if($host->{MC7}==0){$host->{MC7}=100;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | $host->{CC7}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.7')) ne 'UnknownOID'){$host->{CC7}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.10')) ne 'UnknownOID'){$host->{CC7}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.9.1.11')) ne 'UnknownOID'){$host->{CC7}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | $host->{MODEL}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.25.3.2.1.3.1')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 13 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.1.1.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.2.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1347.43.5.1.1.1.1')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.2001.1.3.1.1.10.1.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='5-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.23.2.32.4.2.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='6-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.253.8.53.3.2.1.2.1')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='7-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.236.11.5.1.1.1.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='8-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1602.1.1.1.1.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='9-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1347.43.5.1.1.1.1')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='10-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.1.1.1.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='11-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.7.2.2.3.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='12-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.641.2.1.2.1.2.1')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='13-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $host->{FIRMWARE}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.6.0')) ne 'UnknownOID'){$host->{FIRMWARE}=$value;$host->{TRACE}.='1-';} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1248.1.2.2.2.1.1.2.1.3')) ne 'UnknownOID'){$host->{FIRMWARE}=$value;$host->{TRACE}.='2-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1248.1.2.2.2.1.1.2.1.4')) ne 'UnknownOID'){$host->{FIRMWARE}=$value;$host->{TRACE}.='3-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.1347.43.5.4.1.5.1.1')) ne 'UnknownOID'){$host->{FIRMWARE}=$value;$host->{TRACE}.='4-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.367.3.2.1.6.1.1.4.1')) ne 'UnknownOID'){$host->{FIRMWARE}=$value;$host->{TRACE}.='5-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | elsif(($value=$self->request('.1.3.6.1.4.1.641.1.1.1.0')) ne 'UnknownOID'){$host->{FIRMWARE}=$value;$host->{TRACE}.='6-';} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | $host->{DISPLAY1}=$host->{DISPLAY2}=$host->{DISPLAY3}=$host->{DISPLAY4}=''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.16.5.1.2.1.1')) ne 'UnknownOID'){$host->{DISPLAY1}=$value;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.16.5.1.2.1.2')) ne 'UnknownOID'){$host->{DISPLAY2}=$value;} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.16.5.1.2.1.3')) ne 'UnknownOID'){$host->{DISPLAY3}=$value;} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | elsif(($value=$self->request('.1.3.6.1.2.1.43.16.5.1.2.1.4')) ne 'UnknownOID'){$host->{DISPLAY4}=$value;} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | $host->{MAC}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.2.2.1.6.1')) ne 'UnknownOID'){$host->{MAC}=$value;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | $host->{CD1}=$host->{CD2}=$host->{CD3}=$host->{CD4}=$host->{CD5}=$host->{CD6}=$host->{CD7}=$host->{CD8}=''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | $host->{CD9}=$host->{CD10}=$host->{CD11}='U_O'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.1')) ne 'UnknownOID'){$host->{CD1}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.2')) ne 'UnknownOID'){$host->{CD1}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.3')) ne 'UnknownOID'){$host->{CD3}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.4')) ne 'UnknownOID'){$host->{CD4}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.5')) ne 'UnknownOID'){$host->{CD5}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.6')) ne 'UnknownOID'){$host->{CD6}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.7')) ne 'UnknownOID'){$host->{CD7}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.8')) ne 'UnknownOID'){$host->{CD8}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.9')) ne 'UnknownOID'){$host->{CD9}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.10')) ne 'UnknownOID'){$host->{CD10}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.11')) ne 'UnknownOID'){$host->{CD11}=$value}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | $host->{RESPONSE}='&L1='.$host->{SN}.'&L2='.$host->{TOTAL}.'&L3='.$host->{COLOR}.'&L4='.$host->{MC1}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | '&L5='.$host->{CC1}.'&L6='.$host->{MC2}.'&L7='.$host->{CC2}.'&L8='.$host->{MC3}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | '&L9='.$host->{CC3}.'&L10='.$host->{MC4}.'&L11='.$host->{CC4}.'&L12='.$host->{MC5}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | '&L13='.$host->{CC5}.'&L14='.$host->{MC6}.'&L15='.$host->{CC6}.'&L16='.$host->{MC7}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | '&L17='.$host->{CC7}.'&L18='.$host->{MODEL}.'&L19='.$self->{target}.'&L20='.$host->{FIRMWARE}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | '&L21='.$host->{DISPLAY1}.'&L22='.$host->{DISPLAY2}.'&L23='.$host->{DISPLAY3}. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | '&L24='.$host->{DISPLAY4}.'&L90='.$host->{TRACE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return $host; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | sub getmodel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getmodel: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my $answer=shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my $host; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my $i=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | $answer=~s/OK:OIDL#//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | $host->{RESPONSE}='&'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | my @codes=split("#",$answer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | foreach my $code(@codes) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | $code=~/\!\!/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $counterid=$`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my $oid=$'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | $counterid=~s/\AC/L/; # adapt Color to Legal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | $counterid=~s/\AB/L/; # adapt Black to Legal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | $counterid=~s/\AG/L/; # adapt Generic to Legal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | if($oid=~/\AMAC/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $oid=~s/\AMAC//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $host->{RESPONSE}.=$counterid.'='.$self->request($oid,'mac').'&'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | $host->{RESPONSE}.=$counterid.'='.$self->request($oid).'&'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | return $host; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | sub listandcall | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
listandcall: not called CC=22 SCAR=62.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my %properties=@_; # rest of params by hash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | my $browser = LWP::UserAgent->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my $printers=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $verbose=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | ▶ | $verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | my $devices=$self->{xml}->{devices}->{device}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | foreach my $device(@$devices) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $self->{target}=$device->{ip}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | print "Checking $self->{target}\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | if(my $sn=$self->checkip) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $printers++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | print "Printer found: $sn\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | print "Connecting... " if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my $response = $browser->get($self->{url}.'&devid='.$sn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | if($response->is_success) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | print "OK\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | my $answer=$response->decoded_content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | ▶ | if($answer eq 'OK:GEN') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | print "No defined model, using Generics.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if(my $host=$self->getgeneric) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | print "Sending data\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | my $a=$browser->get($self->{url}.'&devid='.$sn.'&devread=1'.$host->{RESPONSE}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | ▶ | print "Error during the data validation.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return "ERROR: data validation failure"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | elsif($answer=~/OK:OIDL#.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | print "Model identified\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $host=$self->getmodel($answer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | $browser->get($self->{url}.'&devid='.$sn.'&devread=1'.$host->{RESPONSE}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | elsif($answer=~/OK:MR#.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | print "Maximun number of readings per day achieved.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | return "ERROR: Maximun number of readings per day achieved"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | elsif($answer=~/OK:UP#.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | print "Error, please verify yor configuration.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 0 | return "ERROR: configuration fault"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | print "Connection failed!\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | return "ERROR: connection failed"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | ▶ | print "$printers Printer(s) monitorized\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | return "OK $printers"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | sub discoverandcall | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
discoverandcall: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my %properties=@_; # rest of params by hash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $browser = LWP::UserAgent->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | my $printers=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my $verbose=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | $verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my $devices=$self->{xml}->{devices}->{device}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $init=1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | my $end=254; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | $init=$self->{xml}->{range}->{from} if defined $self->{xml}->{range}->{from}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | $end=$self->{xml}->{range}->{to} if defined $self->{xml}->{range}->{to}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | ▶ | for (my $i=$init;$i<=$end;$i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $self->{target}=$self->{net}.'.'.$i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | ▶ | print "Checking $self->{target}\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | if(my $sn=$self->checkip) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $printers++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | print "Printer found: $sn\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | my $response = $browser->get($self->{url}.'&devid='.$sn); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | if($response->is_success) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $answer=$response->decoded_content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | if($answer eq 'OK:GEN') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | ▶ | print "No model identified, using Generics.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 0 | ▶ | if(my $host=$self->getgeneric) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | my $a=$browser->get($self->{url}.'&devid='.$sn.'&devread=1'.$host->{RESPONSE}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | ▶ | print "Sending data.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | ▶ | print "Error during the data validation.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | return "ERROR: data validation failure"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | elsif($answer=~/OK:OIDL#.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | print "Model identified.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | my $host=$self->getmodel($answer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $browser->get($self->{url}.'&devid='.$sn.'&devread=1'.$host->{RESPONSE}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | elsif($answer=~/OK:MR#.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | ▶ | print "Maximum number of readings per day achieved.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | return "ERROR: maximum number of readings per day achieved"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | elsif($answer=~/OK:UP#.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | print "Error, please verify yor configuration.\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | return "ERROR: configuration fault"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | print "Connection failed!\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | return "ERROR: connection failed"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 0 | print "$printers Printer(s) monitorized\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | return "OK $printers"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | sub listandmail | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
listandmail: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my %properties=@_; # rest of params by hash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my $verbose=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | ▶ | $verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | my $printers=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my $user=$self->{xml}->{mail}->{user}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | my $pass=$self->{xml}->{mail}->{pass}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | my $server=$self->{xml}->{mail}->{smtp}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my $to=$self->{xml}->{mail}->{to}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | my $body_mail = "Mail sent by CPM - list\n\n#####\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | my $devices=$self->{xml}->{devices}->{device}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | foreach my $device(@$devices) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | $self->{target}=$device->{ip}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | ▶ | print "Checking $self->{target}\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | $printers++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | ▶ | print "Printer located\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | $body_mail.="\n\nDEVICE ".$device->{number}.": ".$self->{xml}->{id}->{user}."\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | my $oids=$device->{oid};print "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | my @keys=keys(%$oids); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | foreach my $oid(@keys) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | my $translate='Y'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | my $walk='N'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | ▶ | if($oids->{$oid}->{content}=~/\AMAC.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | $translate='N'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 0 | ▶ | if($oids->{$oid}->{content}=~/\AW.*/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | $walk='Y'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | # filter any non OID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | $oids->{$oid}->{content}=~/..*/;$oids->{$oid}->{content}=$&; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | my $snmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | if($walk eq 'Y') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | $snmp=$self->requesttable($oids->{$oid}->{content}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | $snmp=$self->request($oids->{$oid}->{content}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | if($translate eq 'N') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | $snmp=~s/0x//; # remove 0x00 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | $snmp=~s/.{2}/$&\:/g; # add the : every two digits | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 0 | $snmp=~s/:\Z//; # remove the last : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | $snmp=uc($snmp); # convert to capital letters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $body_mail.=" ".$oid.": ".$snmp."\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | #Send the email | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | ▶ | print "Composing email..." if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | my $smtp=Net::SMTP_auth->new($server); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | $smtp->auth('LOGIN',$user,$pass); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | $smtp->mail($user); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | $smtp->to($to); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $smtp->data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | $smtp->datasend("Subject: CPM $self->{xml}->{id}->{user}\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | $smtp->datasend("To: $to\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | $smtp->datasend("From: MyPrinterCloud\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $smtp->datasend($body_mail); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $smtp->dataend; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $smtp->quit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | print "Sent!\n" if $verbose ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | return "OK $printers"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | sub auto | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | my $self=shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auto: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | my %properties=@_; # rest of params by hash | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | my $verbose=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | $verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | ▶ | if($self->{xml}->{id}->{comm} eq 'call') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | ▶ | print "Using CALL" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | if($self->{xml}->{id}->{mode} eq 'list') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 0 | ▶ | print " with a LIST\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | return $self->listandcall(-verbose=>$verbose); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | print " and DISCOVERING\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | return $self->discoverandcall(-verbose=>$verbose); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ▶ | if($self->{xml}->{id}->{mode} ne 'list') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | ▶ | print "Discover by email is not implemented!\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | return "ERROR: Discover by email is not implemented"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | ▶ | print "Using SMTP-auth from a fixed list and OIDs\n" if $verbose; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 0 | return $self->listandmail(-verbose=>$verbose); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||