From e08e06d33787004fe5c60b2b35a1bb5a36e6ce7f Mon Sep 17 00:00:00 2001 From: Gerhard Lausser Date: Tue, 11 Feb 2014 21:44:18 +0100 Subject: [PATCH] more rewrite --- plugins-scripts/Classes/Cisco.pm | 3 +-- plugins-scripts/Classes/Device.pm | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/plugins-scripts/Classes/Cisco.pm b/plugins-scripts/Classes/Cisco.pm index 8e0c66c9..a8122bf0 100644 --- a/plugins-scripts/Classes/Cisco.pm +++ b/plugins-scripts/Classes/Cisco.pm @@ -39,7 +39,6 @@ sub i_can_handle_this { sub init { my $self = shift; my %params = @_; - $self->SUPER::init(%params); if ($self->{productname} =~ /Cisco NX-OS/i) { bless $self, 'Classes::CiscoNXOS'; $self->debug('using Classes::CiscoNXOS'); @@ -62,6 +61,6 @@ sub init { bless $self, 'Classes::CiscoCCM'; $self->debug('using Classes::CiscoCCM'); } - $self->init(); + $self->SUPER::init(%params); } diff --git a/plugins-scripts/Classes/Device.pm b/plugins-scripts/Classes/Device.pm index 72255e1c..6273e152 100644 --- a/plugins-scripts/Classes/Device.pm +++ b/plugins-scripts/Classes/Device.pm @@ -35,7 +35,24 @@ sub new { if (! ($self->opts->hostname || $self->opts->snmpwalk)) { $self->add_message(UNKNOWN, 'either specify a hostname or a snmpwalk file'); } else { - $self->check_snmp_and_model(); + if ($self->opts->servertype && $self->opts->servertype eq 'linuxlocal') { + } elsif ($self->opts->port && $self->opts->port == 49000) { + $self->{productname} = 'upnp'; + } else { + $self->check_snmp_and_model(); + } + if ($self->opts->servertype) { + $self->{productname} = 'cisco' if $self->opts->servertype eq 'cisco'; + $self->{productname} = 'huawei' if $self->opts->servertype eq 'huawei'; + $self->{productname} = 'hp' if $self->opts->servertype eq 'hp'; + $self->{productname} = 'brocade' if $self->opts->servertype eq 'brocade'; + $self->{productname} = 'netscreen' if $self->opts->servertype eq 'netscreen'; + $self->{productname} = 'linuxlocal' if $self->opts->servertype eq 'linuxlocal'; + $self->{productname} = 'procurve' if $self->opts->servertype eq 'procurve'; + $self->{productname} = 'bluecoat' if $self->opts->servertype eq 'bluecoat'; + $self->{productname} = 'checkpoint' if $self->opts->servertype eq 'checkpoint'; + $self->{productname} = 'ifmib' if $self->opts->servertype eq 'ifmib'; + } if (! $self->check_messages()) { if ($self->opts->verbose && $self->opts->verbose) { printf "I am a %s\n", $self->{productname};