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.3G
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Zangerl committed Jan 25, 2018
1 parent 02eb6d5 commit 179fd13
Show file tree
Hide file tree
Showing 23 changed files with 980 additions and 655 deletions.
2 changes: 1 addition & 1 deletion admin/check_nmis_processes.pl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
use strict;
use NMIS;
use func;
use Proc::ProcessTable;
use Proc::ProcessTable 0.53;

# load configuration table
my $C = loadConfTable(conf=>"",debug=>0);
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.2a";
our $VERSION = "8.6.3G";

use strict;
use File::Copy;
Expand Down
166 changes: 83 additions & 83 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.6.2";
our $VERSION = "1.7.0";
use strict;
use Data::Dumper;
use File::Basename;
Expand All @@ -37,9 +37,11 @@
use FindBin;
use lib "$FindBin::Bin/../lib";


print "Opmantek NMIS Support Tool Version $VERSION\n";

die "The Support Tool must be run with root privileges, terminating now.\n"
if ($> != 0);

my $usage = "Usage: ".basename($0)." action=collect [public=t/f] [node=nodeA,nodeB...]\n
action=collect: collect general support info in an archive file
if node argument given: also collect node-specific info
Expand All @@ -49,9 +51,11 @@
\n\n";

die $usage if (@ARGV == 1 && $ARGV[0] =~ /^-[h\?]/);

my %args = getArguements(@ARGV);

die $usage if ($args{action} ne "collect");

my $configname = $args{config} || "Config.nmis";
my $maxzip = $args{maxzipsize} || 10*1024*1024; # 10meg
my $maxlogsize = $args{maxlogsize} || 4*1024*1024; # 4 meg for individual log files
Expand Down Expand Up @@ -132,94 +136,90 @@

if ($args{action} eq "collect")
{
# collect evidence
my $timelabel = POSIX::strftime("%Y-%m-%d-%H%M",localtime);
my $targetdir = "$td/nmis-collect.$timelabel";
mkdir($targetdir);
print "collecting support evidence...\n";
my $status = collect_evidence($targetdir, \%args);
die "failed to collect evidence: $status\n" if ($status);

my $omkzfn;
# if omk and its support tool found, run that as well if allowed to!
if (-d "/usr/local/omk" && -f "/usr/local/omk/bin/support.pl" && !$args{no_other_tools})
{
open(LF, ">$targetdir/omk-support.log");

print "\nFound local OMK installation with OMK support tool.
# collect evidence
my $timelabel = POSIX::strftime("%Y-%m-%d-%H%M",localtime);
my $targetdir = "$td/nmis-collect.$timelabel";
mkdir($targetdir);
print "collecting support evidence...\n";
my $status = collect_evidence($targetdir, \%args);
die "failed to collect evidence: $status\n" if ($status);
my $omkzfn;
# if omk and its support tool found, run that as well if allowed to!
if (-d "/usr/local/omk" && -f "/usr/local/omk/bin/support.pl" && !$args{no_other_tools})
{
open(LF, ">$targetdir/omk-support.log");
print "\nFound local OMK installation with OMK support tool.
Please wait while we collect OMK information as well.\n";
open(F, "/usr/local/omk/bin/support.pl action=collect no_system_stats=1 no_other_tools=1 2>&1 |")
or warn "cannot execute OMK support tool: $!\n";
while (my $line = <F>)
open(F, "/usr/local/omk/bin/support.pl action=collect no_system_stats=1 no_other_tools=1 2>&1 |")
or warn "cannot execute OMK support tool: $!\n";
while (my $line = <F>)
{
print LF $line;
if ($line =~ /information is in (\S+)/)
{
print LF $line;
if ($line =~ /information is in (\S+)/)
{
$omkzfn = $1;
}
$omkzfn = $1;
}
close F;
close LF;
}

print "\nEvidence collection complete, zipping things up...\n";

# do we have zip? or only tar+gz?
my $canzip=0;
$status = system("zip --version >/dev/null 2>&1");
$canzip=1 if (POSIX::WIFEXITED($status) && !POSIX::WEXITSTATUS($status));

my $zfn = "/tmp/nmis-support-$timelabel.".($canzip?"zip":"tgz");

# zip mustn't become too large, hence we possibly tail/truncate some or all log files
opendir(D,"$targetdir/logs")
or warn "can't read $targetdir/logs dir: $!\n";
my @shrinkables = map { "$targetdir/logs/$_" } (grep($_ !~ /^\.{1,2}$/, readdir(D)));
closedir(D);
while (1)
close F;
close LF;
}

print "\nEvidence collection complete, zipping things up...\n";

# do we have zip? or only tar+gz?
my $canzip=0;
$status = system("zip --version >/dev/null 2>&1");
$canzip=1 if (POSIX::WIFEXITED($status) && !POSIX::WEXITSTATUS($status));

my $zfn = "/tmp/nmis-support-$timelabel.".($canzip?"zip":"tgz");

# zip mustn't become too large, hence we possibly tail/truncate some or all log files
opendir(D,"$targetdir/logs")
or warn "can't read $targetdir/logs dir: $!\n";
my @shrinkables = map { "$targetdir/logs/$_" } (grep($_ !~ /^\.{1,2}$/, readdir(D)));
closedir(D);
while (1)
{
# test zip, shrink logfiles, repeat until small enough or out of shrinkables
my $curdir = getcwd;
chdir($td); # so that the zip file doesn't have to whole /tmp/this/n/that/ path in it
if ($canzip)
{
# test zip, shrink logfiles, repeat until small enough or out of shrinkables
my $curdir = getcwd;
chdir($td); # so that the zip file doesn't have to whole /tmp/this/n/that/ path in it
if ($canzip)
{
$status = system("zip","-q","-r",$zfn, "nmis-collect.$timelabel");
}
else
{
$status = system("tar","-czf",$zfn,"nmis-collect.$timelabel");
}
chdir($curdir);

die "cannot create support zip file $zfn: $!\n"
if (POSIX::WEXITSTATUS($status));
last if (-s $zfn < $maxzip);

# hmm, too big: shrink the log files one by one until the size works out
unlink($zfn);
print "zipfile too big, trying to shrink some logfiles...\n";
if (my $nextfile = pop @shrinkables)
{
$status = shrinkfile($nextfile,$tail);
die "shrinking of $nextfile failed: $status\n" if ($status);
}
else
{
# nothing left to try :-(
die "\nPROBLEM: cannot reduce zip file size any further!\nPlease rerun $0 with maxzipsize=N higher than $maxzip.\n";
}
$status = system("zip","-q","-r",$zfn, "nmis-collect.$timelabel");
}


print "\nAll done.\n\nCollected system information is in $zfn\n";
print "OMK information is in $omkzfn\n\n" if ($omkzfn);
print "Please include ".($omkzfn? "these zip files": "this zip file"). " when you contact
else
{
$status = system("tar","-czf",$zfn,"nmis-collect.$timelabel");
}
chdir($curdir);

die "cannot create support zip file $zfn: $!\n"
if (POSIX::WEXITSTATUS($status));
last if (-s $zfn < $maxzip);

# hmm, too big: shrink the log files one by one until the size works out
unlink($zfn);
print "zipfile too big, trying to shrink some logfiles...\n";
if (my $nextfile = pop @shrinkables)
{
$status = shrinkfile($nextfile,$tail);
die "shrinking of $nextfile failed: $status\n" if ($status);
}
else
{
# nothing left to try :-(
die "\nPROBLEM: cannot reduce zip file size any further!\nPlease rerun $0 with maxzipsize=N higher than $maxzip.\n";
}
}


print "\nAll done.\n\nCollected system information is in $zfn\n";
print "OMK information is in $omkzfn\n\n" if ($omkzfn);
print "Please include ".($omkzfn? "these zip files": "this zip file"). " when you contact
the NMIS Community or the Opmantek Team.\n\n";
}
else
{
die "$usage\n";
}

# remove tempdir (done automatically on exit)
exit 0;
Expand Down
2 changes: 1 addition & 1 deletion admin/update_config_defaults.pl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#
# *****************************************************************************
use strict;
our $VERSION = "8.6.2G";
our $VERSION = "8.6.3G";

# Auto configure to the <nmis-base>/lib
use FindBin;
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.2a";
our $VERSION="8.6.3G";

use strict;
use Digest::MD5; # good enough
Expand Down Expand Up @@ -480,7 +480,7 @@ sub compute_signature
Model-GE-QS941.nmis 64cf727e20bfe0f5 61b3564fc34b7534 5cab506ad33ae94e
Model-Generic.nmis 9f6e87c2dced82ce e2352bb53b48d526 6421c79212254318
Model-HP-Procurve.nmis d640db73cf1a2489
Model-Huawei-MA5600.nmis daa2a0723e5e7330 9e752b89778e1542 9e232402e57166e7
Model-Huawei-MA5600.nmis c71eda97df358ee2 9e752b89778e1542 daa2a0723e5e7330 9e232402e57166e7
Model-Huawei-NetEngine.nmis 34ac1c5aaec02f3e
Model-HuaweiRouter.nmis cbcb03fd241ba9e3
Model-Juniper-ERX.nmis bad56f405ba7e1f0 d66d891e14df1c12
Expand Down
6 changes: 3 additions & 3 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.2a";
our $VERSION="8.6.3G";

use strict;
use Digest::MD5; # good enough
Expand Down Expand Up @@ -181,7 +181,7 @@ sub compute_signature
Table-Access.nmis 40fa00017376ca51
Table-BusinessServices.nmis 539adae4fed03ff2
Table-CircuitGroups.nmis 9e00f871315bd959 545ea59abb4473ad
Table-Config.nmis 3d825194acdc9597
Table-Config.nmis 2649df66dd11a020 3d825194acdc9597
Table-Contacts.nmis 50894801c64f3628 3039d313daf0209d
Table-Customers.nmis 6503aea40218241e
Table-Enterprise.nmis b954e3ca75233bce
Expand All @@ -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 948b836801802bf9 32815befe46ad8e6 c536bfe56a073e41 703420fa55f06eb6 5b144d5f598eb815 013e95cef5802716 80d4c960b5570f70 a8c9b78dd1ad3910 ef34b637d02ba140 7f1a618619af76f7
Table-Nodes.nmis 6cf38465b6dec232 32815befe46ad8e6 c536bfe56a073e41 703420fa55f06eb6 5b144d5f598eb815 013e95cef5802716 80d4c960b5570f70 a8c9b78dd1ad3910 ef34b637d02ba140 948b836801802bf9 7f1a618619af76f7
Table-Polling-Policy.nmis 7abb03f496c1943f
Table-Portal.nmis f092a05f0f7a2bbb
Table-PrivMap.nmis dccc46beb3506fa8
Expand Down
6 changes: 4 additions & 2 deletions bin/fpingd.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# http://support.opmantek.com/users/
#
# *****************************************************************************
our $VERSION = "8.6.2G";
our $VERSION = "8.6.3G";

use FindBin qw($Bin);
use lib "$FindBin::Bin/../lib";
Expand Down Expand Up @@ -83,7 +83,7 @@
# debug=0 but logging=1 implies debug level 1.
my $debug = setDebug($nvp{debug});
my $logfile = $C->{'fpingd_log'};
my $pidfile = "/var/run/nmis-fpingd.pid";
my $pidfile = $C->{'<nmis_var>'}."/nmis-fpingd.pid";

# check for any running fpingd instance
my $alreadyrunning;
Expand Down Expand Up @@ -190,6 +190,8 @@
open(PID, ">$pidfile") or die "Could not create $pidfile: $!\n";
print PID $$;
close PID;
setFileProtDiag(file => $pidfile);

debug("daemon started");
logMsg("INFO daemon fpingd started, pidfile $pidfile created with pid: $$");

Expand Down
Loading

0 comments on commit 179fd13

Please sign in to comment.