Skip to content

Commit

Permalink
more rewrite
Browse files Browse the repository at this point in the history
lausser committed Feb 11, 2014
1 parent f337685 commit e08e06d
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 1 addition & 2 deletions plugins-scripts/Classes/Cisco.pm
Original file line number Diff line number Diff line change
@@ -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);
}

19 changes: 18 additions & 1 deletion plugins-scripts/Classes/Device.pm
Original file line number Diff line number Diff line change
@@ -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};

0 comments on commit e08e06d

Please sign in to comment.