Skip to content

Commit

Permalink
[Core] Make nagios severities configurable (github issue #32 by Chris…
Browse files Browse the repository at this point in the history
…toph Anton Mitterer @calestyo).
  • Loading branch information
liske committed Sep 3, 2016
1 parent 67e1a31 commit 1e987b9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ needrestart (2.9) unstable; urgency=medium
(Debian Bug#826220 by Wolfgang Karall-Ahlborn <lists+debian-bugs@karall-edv.at>)
- [Core] Use $(MAKE) instead of make for parallel make.
(github issue #34 by Craig Andrews @candrews)
- [Core] Make nagios severities configurable.
(github issue #32 by Christoph Anton Mitterer @calestyo)
* Features:
- [Core] Sys-V: use chkconfig tags if LSB tags are missing.
(github issue #33 by Evgenii Terechkov @evgkrsk)
Expand Down
16 changes: 11 additions & 5 deletions needrestart
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ our %nrconf = (
override_cont => [],
interpscan => 1,
kernelhints => 1,
q(nagios-severity) => {
services => 1,
kernel => 2,
sessions => 2,
containers => 1,
},
);

# backup ARGV (required for Debconf)
Expand Down Expand Up @@ -733,12 +739,12 @@ if(defined($opt_k)) {
$nagios{kstr} = $kvars{KVERSION};
if($kresult == NRK_VERUPGRADE) {
$nagios{kstr} .= "!=$kvars{EVERSION} (!)";
$nagios{kret} = 1;
$nagios{kret} = $nrconf{q(nagios-severity)}->{kernel};
$nagios{kperf} = 2;
}
elsif($kresult == NRK_ABIUPGRADE) {
$nagios{kstr} .= " (!)";
$nagios{kret} = 1;
$nagios{kret} = $nrconf{q(nagios-severity)}->{kernel};
$nagios{kperf} = 1;
}
elsif($kresult == NRK_NOUPGRADE) {
Expand Down Expand Up @@ -807,7 +813,7 @@ if(defined($opt_l) && !$uid) {
$ui->notice(__ 'Restarting services...') if($opt_r eq 'a');
if($opt_p) {
$nagios{sstr} = (scalar keys %restart).' (!)';
$nagios{sret} = 2;
$nagios{sret} = $nrconf{q(nagios-severity)}->{services};
$nagios{sperf} = (scalar keys %restart);
}

Expand Down Expand Up @@ -930,7 +936,7 @@ if(defined($opt_l) && !$uid) {
$ui->notice(__ 'Restarting containers...') if($opt_r eq 'a');
if($opt_p) {
$nagios{cstr} = (scalar keys %conts).' (!)';
$nagios{cret} = 2;
$nagios{cret} = $nrconf{q(nagios-severity)}->{containers};
$nagios{cperf} = (scalar keys %conts);
}

Expand Down Expand Up @@ -999,7 +1005,7 @@ if(defined($opt_l) && !$uid) {
}
if($opt_p) {
$nagios{ustr} = (scalar keys %sessions).' (!)';
$nagios{uret} = 1;
$nagios{uret} = $nrconf{q(nagios-severity)}->{sessions};
$nagios{uperf} = (scalar keys %sessions);
}
unless($opt_p || $opt_b) {
Expand Down

0 comments on commit 1e987b9

Please sign in to comment.