Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Commit

Permalink
NMIS Release 8.6.6G
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Zangerl committed Jun 5, 2018
1 parent 6d2c637 commit 12f6183
Show file tree
Hide file tree
Showing 22 changed files with 700 additions and 343 deletions.
73 changes: 47 additions & 26 deletions admin/interface_util_alerts.pl
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,33 @@
my $syslog_facility = 'local3';
my $syslog_server = 'localhost:udp:514';

my $nmisEventProcessing = 0;

my $threshold_period = "-5 minutes";

# A set of regular thresholds, uncomment these and comment out the next section to use these
#my $thresholds = {
# 'fatal' => 90,
# 'critical' => 80,
# 'major' => 60,
# 'minor' => 20,
# 'warning' => 10,
# 'normal' => 10,
# };

# to only use fatal, change normal and fatal to be the same, and all others to 0
# convienently this can be done using the fatalThreshold variable
my $fatalThreshold = 50;
my $thresholds = {
'fatal' => '90',
'critical' => '80',
'major' => '60',
'minor' => '20',
'warning' => '10'
'fatal' => $fatalThreshold,
'critical' => 0,
'major' => 0,
'minor' => 0,
'warning' => 0,
'normal' => $fatalThreshold,
};

my $event = "Proactive Interface Utilisation";
my $eventName = "Proactive Interface Utilisation";

# set this to 1 to include group in the message details, 0 to exclude.
my $includeGroup = 1;
Expand Down Expand Up @@ -110,6 +127,8 @@
for my $ifIndex (sort keys %{$IF}) {
if ( exists $IF->{$ifIndex}{collect} and $IF->{$ifIndex}{collect} eq "true") {

my $event = $eventName;

# get the summary stats
my $stats = getSummaryStats(sys=>$S,type=>"interface",start=>$threshold_period,end=>'now',index=>$ifIndex);

Expand All @@ -133,11 +152,11 @@
my $element = $IF->{$ifIndex}{ifDescr};

# apply the thresholds
if ( $util < $thresholds->{warning} ) { $level = "Normal"; $reset = $thresholds->{warning}; $thrvalue = $thresholds->{warning}; }
elsif ( $util >= $thresholds->{warning} and $util < $thresholds->{minor} ) { $level = "Warning"; $thrvalue = $thresholds->{warning}; }
elsif ( $util >= $thresholds->{minor} and $util < $thresholds->{major} ) { $level = "Minor"; $thrvalue = $thresholds->{minor}; }
elsif ( $util >= $thresholds->{major} and $util < $thresholds->{critical} ) { $level = "Major"; $thrvalue = $thresholds->{major}; }
elsif ( $util >= $thresholds->{critical} and $util < $thresholds->{fatal} ) { $level = "Critical"; $thrvalue = $thresholds->{critical}; }
if ( $util < $thresholds->{normal} ) { $level = "Normal"; $reset = $thresholds->{normal}; $thrvalue = $thresholds->{normal}; }
elsif ( $thresholds->{warning} > 0 and $util >= $thresholds->{warning} and $util < $thresholds->{minor} ) { $level = "Warning"; $thrvalue = $thresholds->{warning}; }
elsif ( $thresholds->{minor} > 0 and $util >= $thresholds->{minor} and $util < $thresholds->{major} ) { $level = "Minor"; $thrvalue = $thresholds->{minor}; }
elsif ( $thresholds->{major} > 0 and $util >= $thresholds->{major} and $util < $thresholds->{critical} ) { $level = "Major"; $thrvalue = $thresholds->{major}; }
elsif ( $thresholds->{critical} > 0 and $util >= $thresholds->{critical} and $util < $thresholds->{fatal} ) { $level = "Critical"; $thrvalue = $thresholds->{critical}; }
elsif ( $util >= $thresholds->{fatal} ) { $level = "Fatal"; $thrvalue = $thresholds->{fatal}; }

# if the level is normal, make sure there isn't an existing event open
Expand Down Expand Up @@ -171,9 +190,15 @@
if ( $eventExists and $level =~ /Normal/i) {
# Proactive Closed.
$condition = 1;
eventDelete(event => { node => $node,
event => $event,
element => $element });

if ( getbool($nmisEventProcessing) ) {
checkEvent(sys=>$S,event=>$event,level=>$level,element=>$element,details=>$details,value=>$util,reset=>$reset);
}
else {
eventDelete(event => { node => $node,
event => $event,
element => $element });
}
$event = "$event Closed" if $event !~ /Closed/;
$sendSyslog = 1;
}
Expand All @@ -184,10 +209,15 @@
elsif ( not $eventExists and $level !~ /Normal/i) {
$condition = 3;
$event =~ s/ Closed//g;

eventAdd(node=>$node,event=>$event,level=>$level,element=>$element,details=>$details);
# new event send the syslog.
$sendSyslog = 1;

if ( getbool($nmisEventProcessing) ) {
notify(sys=>$S,event=>$event,level=>$level,element=>$element,details=>$details);
}
else {
eventAdd(node=>$node,event=>$event,level=>$level,element=>$element,details=>$details);
}
}
elsif ( $eventExists and $level !~ /Normal/i) {
$condition = 4;
Expand All @@ -214,17 +244,8 @@
}
}

# This section will enable normal NMIS processing of the event in addition to the custom syslog above.
#if ( $level =~ /Normal/i ) {
# checkEvent(sys=>$S,event=>$event,level=>$level,element=>$element,details=>$details,value=>$util,reset=>$reset);
#}
#else {
# notify(sys=>$S,event=>$event,level=>$level,element=>$element,details=>$details);
#}


#\t$IF->{$ifIndex}{collect}\t$IF->{$ifIndex}{Description}
print " $element: condition=$condition ifIndex=$IF->{$ifIndex}{ifIndex} util=$util level=$level thrvalue=$thrvalue\n" if $info;
print " $element: $event condition=$condition ifIndex=$IF->{$ifIndex}{ifIndex} util=$util level=$level thrvalue=$thrvalue\n" if $info;

}
}
Expand Down
2 changes: 1 addition & 1 deletion admin/migrate_rrd_locations.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#
# nmis collection is disabled while this operation is performed, and a record
# of operations is kept for rolling back in case of problems.
our $VERSION = "8.6.5G";
our $VERSION = "8.6.6G";

use strict;
use File::Copy;
Expand Down
4 changes: 2 additions & 2 deletions admin/support.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# http://support.opmantek.com/users/
#
# *****************************************************************************
our $VERSION = "1.9.0";
our $VERSION = "1.9.1";
use strict;
use Data::Dumper;
use File::Basename;
Expand Down Expand Up @@ -417,7 +417,7 @@ sub collect_evidence
}
}
File::Path::make_path("$targetdir/conf/scripts",
"$targetdir/conf/nodeconf"
"$targetdir/conf/nodeconf",
"$targetdir/conf/plugins", { chmod => 0755 });

# copy all of conf/ and models/ but NOT any stray stuff beneath
Expand Down
35 changes: 24 additions & 11 deletions admin/update_config_defaults.pl
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
# http://support.opmantek.com/users/
#
# *****************************************************************************
our $VERSION = "8.6.6G";
use strict;
our $VERSION = "8.6.5G";

# Auto configure to the <nmis-base>/lib
use List::Util 1.33;

use FindBin;
use lib "$FindBin::Bin/../lib";

Expand Down Expand Up @@ -73,14 +74,26 @@

backupFile(file => $ARGV[0], backup => "$ARGV[0].backup");

# patch in outages as the after status
my @curfields = split(/,/, $conf->{system}->{network_viewNode_field_list});
if (!grep($_ eq "outage", @curfields))
# patch in outages after status, and host_addr_backup after host_addr
for (["outage","status"],["host_addr_backup","host_addr"])
{
$conf->{system}->{network_viewNode_field_list} = join("," ,
$curfields[0],
"outage",
@curfields[1..$#curfields]);
my ($want, $after) = @$_;

my @curfields = split(/,/,
$conf->{system}->{network_viewNode_field_list});
if (!List::Util::any { $_ eq $want } @curfields)
{
my $wheretoputit = List::Util::first { $curfields[$_] eq $after } (0..$#curfields);
if (defined $wheretoputit)
{
@curfields = (@curfields[0..$wheretoputit], $want, @curfields[$wheretoputit+1..$#curfields]);
}
else
{
push @curfields, $want;
}
$conf->{system}->{network_viewNode_field_list} = join(",", @curfields);
}
}

$conf->{"system"}->{"nmis_executable"} = '(/(bin|admin|install/scripts|conf/scripts)/[a-zA-Z0-9_\\.-]+|\\.pl|\\.sh)$';
Expand All @@ -107,7 +120,7 @@
$conf->{'javascript'}{'highstock'} = "";
$conf->{'javascript'}{'jquery'} = "<menu_url_base>/js/jquery-1.8.3.min.js";
$conf->{'javascript'}{'jquery_ui'} = "<menu_url_base>/js/jquery-ui-1.9.2.custom.js";

$conf->{'css'}{'jquery_ui_css'} = "<menu_url_base>/css/smoothness/jquery-ui-1.9.2.custom.css";

$conf->{'metrics'}{'weight_availability'} = "0.1";
Expand All @@ -120,7 +133,7 @@
if ( $conf->{'authentication'}{'auth_method_1'} eq "apache" ) {
print "You are using Apache Authentication, please update your system to use htpasswd or other authentication\n";
print "Details @ https://community.opmantek.com/display/NMIS/Configuring+NMIS+to+use+Internal+Authentication\n";

}

writeHashtoFile(file=>$ARGV[0],data=>$conf);
Expand Down
4 changes: 2 additions & 2 deletions admin/upgrade_models.pl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# *****************************************************************************
#
# this helper upgrades model files where safe to do so
our $VERSION="8.6.5G";
our $VERSION="8.6.6G";

use strict;
use Digest::MD5; # good enough
Expand Down Expand Up @@ -71,7 +71,7 @@
# also complain if the purportedly known good new file doesn't match any of the known signatures
$newsig{$file} = compute_signature("$newdir/$file");
die "error: signature state ($newsig{$file}) for $newdir/$file not part of a known release!\n"
if (!grep($_ eq $newsig{$file}, @sigs) and
if (!grep($_ eq $newsig{$file}, @sigs) and
(!$opts{n} or $file !~ qr{$opts{n}}));
}

Expand Down
10 changes: 5 additions & 5 deletions admin/upgrade_tables.pl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# *****************************************************************************
#
# this helper upgrades table files where safe to do so
our $VERSION="8.6.5G";
our $VERSION="8.6.6G";

use strict;
use Digest::MD5; # good enough
Expand Down Expand Up @@ -66,14 +66,14 @@
{
my ($file,@sigs) = split(/\s+/);
$knownsigs{$file} = \@sigs;

# complain if a known install file is missing completely - not terminal in general
warn "warning: $newdir/$file is missing!\n" if (!-f "$newdir/$file");

# and bail out if the purportedly known good new file doesn't match any of the known signatures
$newsig{$file} = compute_signature("$newdir/$file");
die "error: signature state ($newsig{$file}) for $newdir/$file not part of a known release!\n"
if (!grep($_ eq $newsig{$file}, @sigs) and
if (!grep($_ eq $newsig{$file}, @sigs) and
(!$opts{n} or $file !~ qr{$opts{n}}));
}

Expand Down Expand Up @@ -190,7 +190,7 @@ sub compute_signature
Table-Links.nmis 485da1859e3cc036 3f6a43471d7e4cfe
Table-Locations.nmis 2d63c7fa7954e92a bd24e107f8158818 2e2e263c0c08d268
Table-Logs.nmis e70cc904a9d923e5
Table-Nodes.nmis 6cf38465b6dec232 32815befe46ad8e6 c536bfe56a073e41 703420fa55f06eb6 5b144d5f598eb815 013e95cef5802716 80d4c960b5570f70 a8c9b78dd1ad3910 ef34b637d02ba140 948b836801802bf9 7f1a618619af76f7
Table-Nodes.nmis 78693ff40aba93fb 32815befe46ad8e6 c536bfe56a073e41 703420fa55f06eb6 5b144d5f598eb815 013e95cef5802716 80d4c960b5570f70 a8c9b78dd1ad3910 ef34b637d02ba140 948b836801802bf9 7f1a618619af76f7 6cf38465b6dec232
Table-Polling-Policy.nmis 7abb03f496c1943f
Table-Portal.nmis f092a05f0f7a2bbb
Table-PrivMap.nmis dccc46beb3506fa8
Expand Down
Loading

0 comments on commit 12f6183

Please sign in to comment.