#800 gather and report SNMP Chassis ID http://oid-info.com/cgi-bin/display?oid=1.3.6.1.4.1.9.3.6.3&a=display
This commit is contained in:
@@ -11,7 +11,7 @@ __PACKAGE__->load_namespaces(
|
||||
);
|
||||
|
||||
our # try to hide from kwalitee
|
||||
$VERSION = 65; # schema version used for upgrades, keep as integer
|
||||
$VERSION = 66; # schema version used for upgrades, keep as integer
|
||||
|
||||
use Path::Class;
|
||||
use File::ShareDir 'dist_dir';
|
||||
|
||||
@@ -41,6 +41,8 @@ __PACKAGE__->add_columns(
|
||||
{ data_type => "macaddr", is_nullable => 1 },
|
||||
"serial",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"chassis_id",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"model",
|
||||
{ data_type => "text", is_nullable => 1 },
|
||||
"ps1_type",
|
||||
|
||||
@@ -358,6 +358,8 @@ The following fields are inspected for a match:
|
||||
|
||||
=item serial
|
||||
|
||||
=item chassis_id
|
||||
|
||||
=item module serials (exact)
|
||||
|
||||
=item location
|
||||
@@ -415,6 +417,7 @@ sub search_fuzzy {
|
||||
-or => [
|
||||
'me.contact' => { '-ilike' => $q },
|
||||
'me.serial' => { '-ilike' => $q },
|
||||
'me.chassis_id' => { '-ilike' => $q },
|
||||
'me.location' => { '-ilike' => $q },
|
||||
'me.name' => { '-ilike' => $q },
|
||||
'me.description' => { '-ilike' => $q },
|
||||
|
||||
@@ -15,7 +15,7 @@ register_search_tab({
|
||||
api_endpoint => 1,
|
||||
api_parameters => [
|
||||
q => {
|
||||
description => 'Partial match of Device contact, serial, module serials, location, name, description, dns, or any IP alias',
|
||||
description => 'Partial match of Device contact, serial, chassis ID, module serials, location, name, description, dns, or any IP alias',
|
||||
},
|
||||
name => {
|
||||
description => 'Partial match of the Device name',
|
||||
@@ -67,7 +67,7 @@ get '/ajax/content/search/device' => require_login sub {
|
||||
if ($has_opt) {
|
||||
$rs = schema('netdisco')->resultset('Device')->columns(
|
||||
[ "ip", "dns", "name",
|
||||
"location", "model", "os_ver", "serial"
|
||||
"location", "model", "os_ver", "serial", "chassis_id"
|
||||
]
|
||||
)->with_times->search_by_field( scalar params );
|
||||
}
|
||||
@@ -77,7 +77,7 @@ get '/ajax/content/search/device' => require_login sub {
|
||||
|
||||
$rs = schema('netdisco')->resultset('Device')->columns(
|
||||
[ "ip", "dns", "name",
|
||||
"location", "model", "os_ver", "serial"
|
||||
"location", "model", "os_ver", "serial", "chassis_id"
|
||||
]
|
||||
)->with_times->search_fuzzy($q);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,10 @@ register_worker({ phase => 'early', driver => 'snmp' }, sub {
|
||||
|
||||
(my $model = Encode::decode('UTF-8', ($snmp->model || ''))) =~ s/\s+$//;
|
||||
(my $serial = Encode::decode('UTF-8', ($snmp->serial || ''))) =~ s/\s+$//;
|
||||
(my $chassis_id = Encode::decode('UTF-8', ($snmp->serial1 || ''))) =~ s/\s+$//;
|
||||
$device->set_column( model => $model );
|
||||
$device->set_column( serial => $serial );
|
||||
$device->set_column( chassis_id => (($chassis_id ne $serial) ? $chassis_id : '') );
|
||||
$device->set_column( contact => Encode::decode('UTF-8', $snmp->contact) );
|
||||
$device->set_column( location => Encode::decode('UTF-8', $snmp->location) );
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE device ADD COLUMN "chassis_id" text;
|
||||
|
||||
COMMIT;
|
||||
@@ -62,6 +62,10 @@
|
||||
<td>Serial Number</td>
|
||||
<td>[% d.serial | html_entity %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Chassis ID</td>
|
||||
<td>[% d.chassis_id | html_entity %]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Description</td>
|
||||
<td>[% d.description | html_entity | html_line_break %]</td>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<th>Model</th>
|
||||
<th>OS Version</th>
|
||||
<th>Management IP</th>
|
||||
<th>Serial</th>
|
||||
<th>Serial / Chassis ID</th>
|
||||
<th>First Seen</th>
|
||||
<th>Last Discovered</th>
|
||||
</tr>
|
||||
@@ -53,7 +53,7 @@ $(document).ready(function() {
|
||||
}, {
|
||||
"data": 'serial',
|
||||
"render": function(data, type, row, meta) {
|
||||
return he.encode(data || '');
|
||||
return he.encode(row.serial || '') + (row.chassis_id ? ('<br />' + he.encode(row.chassis_id || '')) : '');
|
||||
}
|
||||
}, {
|
||||
"data": 'first_seen_stamp',
|
||||
|
||||
Reference in New Issue
Block a user