line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPM; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
13400
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
4
|
|
|
|
|
|
|
#no strict 'refs'; |
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
6
|
1
|
|
|
1
|
|
3
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION="1.2_01"; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
433
|
use IO::Socket; |
|
1
|
|
|
|
|
15426
|
|
|
1
|
|
|
|
|
2
|
|
11
|
1
|
|
|
1
|
|
1034
|
use Net::SNMP; |
|
1
|
|
|
|
|
49514
|
|
|
1
|
|
|
|
|
87
|
|
12
|
1
|
|
|
1
|
|
431
|
use Net::Address::IP::Local; |
|
1
|
|
|
|
|
6056
|
|
|
1
|
|
|
|
|
21
|
|
13
|
1
|
|
|
1
|
|
542
|
use Net::Ping; |
|
1
|
|
|
|
|
14434
|
|
|
1
|
|
|
|
|
45
|
|
14
|
1
|
|
|
1
|
|
422
|
use Net::SMTP_auth; |
|
1
|
|
|
|
|
54058
|
|
|
1
|
|
|
|
|
42
|
|
15
|
1
|
|
|
1
|
|
530
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
32701
|
|
|
1
|
|
|
|
|
27
|
|
16
|
1
|
|
|
1
|
|
692
|
use XML::Simple; |
|
1
|
|
|
|
|
6019
|
|
|
1
|
|
|
|
|
7
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new{ |
20
|
0
|
|
|
0
|
1
|
|
my $class=shift; |
21
|
0
|
|
|
|
|
|
my $self={@_}; |
22
|
0
|
|
|
|
|
|
bless($self, $class); |
23
|
0
|
|
|
|
|
|
$self->_init; |
24
|
0
|
|
|
|
|
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _init{ |
28
|
0
|
|
|
0
|
|
|
my $self=shift; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
if (defined ($self->{-config})){$self->{config}=$self->{-config};} |
|
0
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
else{ $self->{config}='config.xml';} |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $testip=eval{$self->{address}=Net::Address::IP::Local->public}; |
|
0
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if($@){$self->{address}='127.0.0.1';} |
|
0
|
|
|
|
|
|
|
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
|
|
|
0
|
1
|
|
my $self=shift; |
45
|
0
|
|
0
|
|
|
|
my $out=XML::Simple::XMLout($self->{xml},('keeproot',1,xmldecl=>'')) || die "can't XMLout: $!"; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
open (OUTFILE, '>'.$self->{config}) || die "can't open output file: $!"; |
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
|
|
|
0
|
1
|
|
my $self=shift; |
58
|
0
|
|
|
|
|
|
my $oid=shift; |
59
|
0
|
|
|
|
|
|
my %properties=@_; # rest of params by hash |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
my $type='none'; |
62
|
0
|
0
|
|
|
|
|
$type=$properties{'-type'} if defined $properties{'-type'}; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $session=Net::SNMP->session(-hostname=>$self->{target}); |
65
|
0
|
0
|
|
|
|
|
if (!defined($session)) {return "TimeOut";} |
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
my $result = $session->get_request( varbindlist => [$oid]); |
67
|
0
|
|
|
|
|
|
$session->close; |
68
|
0
|
0
|
|
|
|
|
if(!defined($result->{$oid})){return "UnknownOID";} |
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
else{ |
70
|
0
|
0
|
|
|
|
|
if($type eq 'MAC') |
|
|
0
|
|
|
|
|
|
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
|
0
|
|
|
|
|
if(length($result->{$oid})<5){return "UnknownOID";} |
|
0
|
0
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
elsif($result->{$oid}=~/X{5,}/){return "UnknownOID";} |
81
|
|
|
|
|
|
|
else{ |
82
|
0
|
0
|
|
|
|
|
if($result->{$oid}=~/0x.*/){$result->{$oid}=_hex2ascii($result->{$oid});} |
|
0
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return $result->{$oid}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
else{ |
87
|
0
|
0
|
|
|
|
|
if($result->{$oid}=~/0x.*/){$result->{$oid}=_hex2ascii($result->{$oid});} |
|
0
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
return $result->{$oid}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub requesttable |
94
|
|
|
|
|
|
|
# Make an SNMP walk request |
95
|
|
|
|
|
|
|
{ |
96
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
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
|
0
|
|
|
|
|
if (!defined($session)) {return "TimeOut";} |
|
0
|
|
|
|
|
|
|
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}); |
|
0
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $string=''; |
106
|
0
|
|
|
|
|
|
foreach my $v(@koids) |
107
|
|
|
|
|
|
|
{ |
108
|
0
|
|
|
|
|
|
$string.=$result->{$v}.'. '; |
109
|
|
|
|
|
|
|
} |
110
|
0
|
|
|
|
|
|
$session->close; |
111
|
0
|
0
|
|
|
|
|
if($result) |
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
|
|
|
0
|
|
|
my $self=shift; |
125
|
|
|
|
|
|
|
my $sock = new IO::Socket::INET ( |
126
|
|
|
|
|
|
|
PeerAddr => $self->{target}, |
127
|
0
|
|
|
|
|
|
PeerPort => '9100', |
128
|
|
|
|
|
|
|
Proto => 'tcp', |
129
|
|
|
|
|
|
|
); |
130
|
0
|
0
|
|
|
|
|
if(!defined $sock){return -1;} |
|
0
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
else {close($sock);return 1} |
|
0
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
sub _ping |
135
|
|
|
|
|
|
|
# Check by ping |
136
|
|
|
|
|
|
|
{ |
137
|
0
|
|
|
0
|
|
|
my $self=shift; |
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
|
|
0
|
0
|
|
|
my $str=shift||return; |
147
|
0
|
|
|
|
|
|
$str=~s/0x0115//; |
148
|
0
|
|
|
|
|
|
$str=~s/([a-fA-F0-9]{2})/chr(hex $1)/eg; |
|
0
|
|
|
|
|
|
|
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
|
0
|
0
|
|
|
|
if ((ord($ch) > 31) && (ord($ch) < 127)){ $str .= $ch; } |
|
0
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
} |
156
|
0
|
|
|
|
|
|
return $str; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub checkip |
160
|
|
|
|
|
|
|
# Check socket and its snmp for specific IP |
161
|
|
|
|
|
|
|
{ |
162
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
163
|
0
|
|
|
|
|
|
my $ping=shift; |
164
|
|
|
|
|
|
|
|
165
|
0
|
0
|
|
|
|
|
if($self->_ping) |
166
|
|
|
|
|
|
|
{ |
167
|
|
|
|
|
|
|
# If we find the 9100 open, then... |
168
|
0
|
0
|
|
|
|
|
if($self->_osocket>0){ |
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
|
|
|
0
|
|
|
my $self=shift; |
181
|
0
|
|
|
|
|
|
my $value='U_O'; |
182
|
|
|
|
|
|
|
|
183
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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
|
|
|
0
|
1
|
|
my $self=shift; |
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
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
212
|
0
|
|
|
|
|
|
$host->{COLOR}='U_O'; |
213
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
|
224
|
0
|
|
|
|
|
|
$host->{MC1}='100'; |
225
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
228
|
0
|
0
|
|
|
|
|
if($host->{MC1}==0){$host->{MC1}=100;} |
|
0
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
|
230
|
0
|
|
|
|
|
|
$host->{CC1}='U_O'; |
231
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
$host->{MC2}='100'; |
237
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
240
|
0
|
0
|
|
|
|
|
if($host->{MC2}==0){$host->{MC2}=100;} |
|
0
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
|
242
|
0
|
|
|
|
|
|
$host->{CC2}='U_O'; |
243
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
|
248
|
0
|
|
|
|
|
|
$host->{MC3}='100'; |
249
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
252
|
0
|
0
|
|
|
|
|
if($host->{MC3}==0){$host->{MC3}=100;} |
|
0
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
254
|
0
|
|
|
|
|
|
$host->{CC3}='U_O'; |
255
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
|
260
|
0
|
|
|
|
|
|
$host->{MC4}='100'; |
261
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
264
|
0
|
0
|
|
|
|
|
if($host->{MC4}==0){$host->{MC4}=100;} |
|
0
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
|
266
|
0
|
|
|
|
|
|
$host->{CC4}='U_O'; |
267
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
272
|
0
|
|
|
|
|
|
$host->{MC5}='100'; |
273
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
276
|
0
|
0
|
|
|
|
|
if($host->{MC5}==0){$host->{MC5}=100;} |
|
0
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
$host->{CC5}='U_O'; |
279
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
|
283
|
0
|
|
|
|
|
|
$host->{MC6}='100'; |
284
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
286
|
0
|
0
|
|
|
|
|
if($host->{MC6}==0){$host->{MC6}=100;} |
|
0
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
|
$host->{CC6}='U_O'; |
289
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
|
292
|
0
|
|
|
|
|
|
$host->{MC7}='100'; |
293
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
296
|
0
|
0
|
|
|
|
|
if($host->{MC7}==0){$host->{MC7}=100;} |
|
0
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
$host->{CC7}='U_O'; |
299
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
|
$host->{MODEL}='U_O'; |
304
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
305
|
0
|
|
|
|
|
|
elsif(($value=$self->request('.1.3.6.1.2.1.1.1.0')) ne 'UnknownOID'){$host->{MODEL}=$value;$host->{TRACE}.='2-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
|
318
|
0
|
|
|
|
|
|
$host->{FIRMWARE}='U_O'; |
319
|
0
|
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-';} |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
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-';} |
|
0
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
|
326
|
0
|
|
|
|
|
|
$host->{DISPLAY1}=$host->{DISPLAY2}=$host->{DISPLAY3}=$host->{DISPLAY4}=''; |
327
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.16.5.1.2.1.1')) ne 'UnknownOID'){$host->{DISPLAY1}=$value;} |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
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
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.2.2.1.6.1')) ne 'UnknownOID'){$host->{MAC}=$value;} |
|
0
|
|
|
|
|
|
|
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
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.1')) ne 'UnknownOID'){$host->{CD1}=$value}; |
|
0
|
|
|
|
|
|
|
338
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.2')) ne 'UnknownOID'){$host->{CD1}=$value}; |
|
0
|
|
|
|
|
|
|
339
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.3')) ne 'UnknownOID'){$host->{CD3}=$value}; |
|
0
|
|
|
|
|
|
|
340
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.4')) ne 'UnknownOID'){$host->{CD4}=$value}; |
|
0
|
|
|
|
|
|
|
341
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.5')) ne 'UnknownOID'){$host->{CD5}=$value}; |
|
0
|
|
|
|
|
|
|
342
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.6')) ne 'UnknownOID'){$host->{CD6}=$value}; |
|
0
|
|
|
|
|
|
|
343
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.7')) ne 'UnknownOID'){$host->{CD7}=$value}; |
|
0
|
|
|
|
|
|
|
344
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.8')) ne 'UnknownOID'){$host->{CD8}=$value}; |
|
0
|
|
|
|
|
|
|
345
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.9')) ne 'UnknownOID'){$host->{CD9}=$value}; |
|
0
|
|
|
|
|
|
|
346
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.10')) ne 'UnknownOID'){$host->{CD10}=$value}; |
|
0
|
|
|
|
|
|
|
347
|
0
|
0
|
|
|
|
|
if(($value=$self->request('.1.3.6.1.2.1.43.11.1.1.6.1.11')) ne 'UnknownOID'){$host->{CD11}=$value}; |
|
0
|
|
|
|
|
|
|
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
|
|
|
0
|
1
|
|
my $self=shift; |
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
|
0
|
|
|
|
|
if($oid=~/\AMAC/) |
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
|
|
|
0
|
1
|
|
my $self=shift; |
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
|
0
|
|
|
|
|
$verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; |
400
|
|
|
|
|
|
|
|
401
|
0
|
|
|
|
|
|
my $devices=$self->{xml}->{devices}->{device}; |
402
|
0
|
|
|
|
|
|
foreach my $device(@$devices) |
403
|
|
|
|
|
|
|
{ |
404
|
0
|
|
|
|
|
|
$self->{target}=$device->{ip}; |
405
|
0
|
0
|
|
|
|
|
print "Checking $self->{target}\n" if $verbose; |
406
|
0
|
0
|
|
|
|
|
if(my $sn=$self->checkip) |
407
|
|
|
|
|
|
|
{ |
408
|
0
|
|
|
|
|
|
$printers++; |
409
|
0
|
0
|
|
|
|
|
print "Printer found: $sn\n" if $verbose; |
410
|
0
|
0
|
|
|
|
|
print "Connecting... " if $verbose; |
411
|
0
|
|
|
|
|
|
my $response = $browser->get($self->{url}.'&devid='.$sn); |
412
|
0
|
0
|
|
|
|
|
if($response->is_success) |
413
|
|
|
|
|
|
|
{ |
414
|
0
|
0
|
|
|
|
|
print "OK\n" if $verbose; |
415
|
0
|
|
|
|
|
|
my $answer=$response->decoded_content; |
416
|
0
|
0
|
|
|
|
|
if($answer eq 'OK:GEN') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
417
|
|
|
|
|
|
|
{ |
418
|
0
|
0
|
|
|
|
|
print "No defined model, using Generics.\n" if $verbose; |
419
|
0
|
0
|
|
|
|
|
if(my $host=$self->getgeneric) |
420
|
|
|
|
|
|
|
{ |
421
|
0
|
0
|
|
|
|
|
print "Sending data\n" if $verbose; |
422
|
0
|
|
|
|
|
|
my $a=$browser->get($self->{url}.'&devid='.$sn.'&devread=1'.$host->{RESPONSE}); |
423
|
|
|
|
|
|
|
} |
424
|
|
|
|
|
|
|
else |
425
|
|
|
|
|
|
|
{ |
426
|
0
|
0
|
|
|
|
|
print "Error during the data validation.\n" if $verbose; |
427
|
0
|
|
|
|
|
|
return "ERROR: data validation failure"; |
428
|
|
|
|
|
|
|
} |
429
|
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
elsif($answer=~/OK:OIDL#.*/) |
431
|
|
|
|
|
|
|
{ |
432
|
0
|
0
|
|
|
|
|
print "Model identified\n" if $verbose; |
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
|
0
|
|
|
|
|
print "Maximun number of readings per day achieved.\n" if $verbose; |
439
|
0
|
|
|
|
|
|
return "ERROR: Maximun number of readings per day achieved"; |
440
|
|
|
|
|
|
|
} |
441
|
|
|
|
|
|
|
elsif($answer=~/OK:UP#.*/) |
442
|
|
|
|
|
|
|
{ |
443
|
0
|
0
|
|
|
|
|
print "Error, please verify yor configuration.\n" if $verbose; |
444
|
0
|
|
|
|
|
|
return "ERROR: configuration fault"; |
445
|
|
|
|
|
|
|
} |
446
|
|
|
|
|
|
|
} |
447
|
|
|
|
|
|
|
else |
448
|
|
|
|
|
|
|
{ |
449
|
0
|
0
|
|
|
|
|
print "Connection failed!\n" if $verbose; |
450
|
0
|
|
|
|
|
|
return "ERROR: connection failed"; |
451
|
|
|
|
|
|
|
} |
452
|
|
|
|
|
|
|
} |
453
|
|
|
|
|
|
|
} |
454
|
0
|
0
|
|
|
|
|
print "$printers Printer(s) monitorized\n" if $verbose; |
455
|
0
|
|
|
|
|
|
return "OK $printers"; |
456
|
|
|
|
|
|
|
} |
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
sub discoverandcall |
459
|
|
|
|
|
|
|
{ |
460
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
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
|
0
|
|
|
|
|
$verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; |
467
|
|
|
|
|
|
|
|
468
|
0
|
|
|
|
|
|
my $devices=$self->{xml}->{devices}->{device}; |
469
|
0
|
|
|
|
|
|
my $init=1; |
470
|
0
|
|
|
|
|
|
my $end=254; |
471
|
0
|
0
|
|
|
|
|
$init=$self->{xml}->{range}->{from} if defined $self->{xml}->{range}->{from}; |
472
|
0
|
0
|
|
|
|
|
$end=$self->{xml}->{range}->{to} if defined $self->{xml}->{range}->{to}; |
473
|
0
|
|
|
|
|
|
for (my $i=$init;$i<=$end;$i++) |
474
|
|
|
|
|
|
|
{ |
475
|
0
|
|
|
|
|
|
$self->{target}=$self->{net}.'.'.$i; |
476
|
0
|
0
|
|
|
|
|
print "Checking $self->{target}\n" if $verbose; |
477
|
0
|
0
|
|
|
|
|
if(my $sn=$self->checkip) |
478
|
|
|
|
|
|
|
{ |
479
|
0
|
|
|
|
|
|
$printers++; |
480
|
0
|
0
|
|
|
|
|
print "Printer found: $sn\n" if $verbose; |
481
|
0
|
|
|
|
|
|
my $response = $browser->get($self->{url}.'&devid='.$sn); |
482
|
0
|
0
|
|
|
|
|
if($response->is_success) |
483
|
|
|
|
|
|
|
{ |
484
|
0
|
|
|
|
|
|
my $answer=$response->decoded_content; |
485
|
0
|
0
|
|
|
|
|
if($answer eq 'OK:GEN') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
486
|
|
|
|
|
|
|
{ |
487
|
0
|
0
|
|
|
|
|
print "No model identified, using Generics.\n" if $verbose; |
488
|
0
|
0
|
|
|
|
|
if(my $host=$self->getgeneric) |
489
|
|
|
|
|
|
|
{ |
490
|
0
|
|
|
|
|
|
my $a=$browser->get($self->{url}.'&devid='.$sn.'&devread=1'.$host->{RESPONSE}); |
491
|
0
|
0
|
|
|
|
|
print "Sending data.\n" if $verbose; |
492
|
|
|
|
|
|
|
} |
493
|
|
|
|
|
|
|
else |
494
|
|
|
|
|
|
|
{ |
495
|
0
|
0
|
|
|
|
|
print "Error during the data validation.\n" if $verbose; |
496
|
0
|
|
|
|
|
|
return "ERROR: data validation failure"; |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
} |
499
|
|
|
|
|
|
|
elsif($answer=~/OK:OIDL#.*/) |
500
|
|
|
|
|
|
|
{ |
501
|
0
|
0
|
|
|
|
|
print "Model identified.\n" if $verbose; |
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
|
0
|
|
|
|
|
print "Maximum number of readings per day achieved.\n" if $verbose; |
508
|
0
|
|
|
|
|
|
return "ERROR: maximum number of readings per day achieved"; |
509
|
|
|
|
|
|
|
} |
510
|
|
|
|
|
|
|
elsif($answer=~/OK:UP#.*/) |
511
|
|
|
|
|
|
|
{ |
512
|
0
|
0
|
|
|
|
|
print "Error, please verify yor configuration.\n" if $verbose; |
513
|
0
|
|
|
|
|
|
return "ERROR: configuration fault"; |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
else |
517
|
|
|
|
|
|
|
{ |
518
|
0
|
0
|
|
|
|
|
print "Connection failed!\n" if $verbose; |
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
|
|
|
0
|
1
|
|
my $self=shift; |
530
|
0
|
|
|
|
|
|
my %properties=@_; # rest of params by hash |
531
|
0
|
|
|
|
|
|
my $verbose=0; |
532
|
0
|
0
|
|
|
|
|
$verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; |
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
|
0
|
|
|
|
|
print "Checking $self->{target}\n" if $verbose; |
546
|
0
|
|
|
|
|
|
$printers++; |
547
|
0
|
0
|
|
|
|
|
print "Printer located\n" if $verbose; |
548
|
0
|
|
|
|
|
|
$body_mail.="\n\nDEVICE ".$device->{number}.": ".$self->{xml}->{id}->{user}."\n"; |
549
|
0
|
|
|
|
|
|
my $oids=$device->{oid};print "\n"; |
|
0
|
|
|
|
|
|
|
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
|
0
|
|
|
|
|
if($oids->{$oid}->{content}=~/\AMAC.*/) |
556
|
|
|
|
|
|
|
{ |
557
|
0
|
|
|
|
|
|
$translate='N'; |
558
|
|
|
|
|
|
|
} |
559
|
0
|
0
|
|
|
|
|
if($oids->{$oid}->{content}=~/\AW.*/) |
560
|
|
|
|
|
|
|
{ |
561
|
0
|
|
|
|
|
|
$walk='Y'; |
562
|
|
|
|
|
|
|
} |
563
|
|
|
|
|
|
|
# filter any non OID |
564
|
0
|
|
|
|
|
|
$oids->{$oid}->{content}=~/..*/;$oids->{$oid}->{content}=$&; |
|
0
|
|
|
|
|
|
|
565
|
0
|
|
|
|
|
|
my $snmp; |
566
|
0
|
0
|
|
|
|
|
if($walk eq 'Y') |
567
|
|
|
|
|
|
|
{ |
568
|
0
|
|
|
|
|
|
$snmp=$self->requesttable($oids->{$oid}->{content}); |
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
else |
571
|
|
|
|
|
|
|
{ |
572
|
0
|
|
|
|
|
|
$snmp=$self->request($oids->{$oid}->{content}); |
573
|
|
|
|
|
|
|
} |
574
|
0
|
0
|
|
|
|
|
if($translate eq 'N') |
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
|
0
|
|
|
|
|
print "Composing email..." if $verbose; |
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
|
0
|
|
|
|
|
print "Sent!\n" if $verbose ; |
598
|
0
|
|
|
|
|
|
return "OK $printers"; |
599
|
|
|
|
|
|
|
} |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
sub auto |
602
|
|
|
|
|
|
|
{ |
603
|
0
|
|
|
0
|
1
|
|
my $self=shift; |
604
|
0
|
|
|
|
|
|
my %properties=@_; # rest of params by hash |
605
|
0
|
|
|
|
|
|
my $verbose=0; |
606
|
0
|
0
|
|
|
|
|
$verbose=$properties{'-verbose'} if defined $properties{'-verbose'}; |
607
|
0
|
0
|
|
|
|
|
if($self->{xml}->{id}->{comm} eq 'call') |
608
|
|
|
|
|
|
|
{ |
609
|
0
|
0
|
|
|
|
|
print "Using CALL" if $verbose; |
610
|
0
|
0
|
|
|
|
|
if($self->{xml}->{id}->{mode} eq 'list') |
611
|
|
|
|
|
|
|
{ |
612
|
0
|
0
|
|
|
|
|
print " with a LIST\n" if $verbose; |
613
|
0
|
|
|
|
|
|
return $self->listandcall(-verbose=>$verbose); |
614
|
|
|
|
|
|
|
} |
615
|
|
|
|
|
|
|
else |
616
|
|
|
|
|
|
|
{ |
617
|
0
|
0
|
|
|
|
|
print " and DISCOVERING\n" if $verbose; |
618
|
0
|
|
|
|
|
|
return $self->discoverandcall(-verbose=>$verbose); |
619
|
|
|
|
|
|
|
} |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
else |
622
|
|
|
|
|
|
|
{ |
623
|
0
|
0
|
|
|
|
|
if($self->{xml}->{id}->{mode} ne 'list') |
624
|
|
|
|
|
|
|
{ |
625
|
0
|
0
|
|
|
|
|
print "Discover by email is not implemented!\n" if $verbose; |
626
|
0
|
|
|
|
|
|
return "ERROR: Discover by email is not implemented"; |
627
|
|
|
|
|
|
|
} |
628
|
0
|
0
|
|
|
|
|
print "Using SMTP-auth from a fixed list and OIDs\n" if $verbose; |
629
|
0
|
|
|
|
|
|
return $self->listandmail(-verbose=>$verbose); |
630
|
|
|
|
|
|
|
} |
631
|
|
|
|
|
|
|
} |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
1; |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
__END__ |