osc copypac from project:server:monitoring package:nagios-plugins-mailstat revision:3
OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-mailstat?expand=0&rev=1
This commit is contained in:
commit
2a6e2ce6d2
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
14
check_mailstat_plugin_v0.9.1-initial_values.patch
Normal file
14
check_mailstat_plugin_v0.9.1-initial_values.patch
Normal file
@ -0,0 +1,14 @@
|
||||
Index: check_mailstat_plugin_v0.9.1/check_mailstat.pl
|
||||
===================================================================
|
||||
--- check_mailstat_plugin_v0.9.1.orig/check_mailstat.pl
|
||||
+++ check_mailstat_plugin_v0.9.1/check_mailstat.pl
|
||||
@@ -217,6 +217,9 @@ sub get_counter{
|
||||
$stat{$k} = $msgs_per_min;
|
||||
}
|
||||
}
|
||||
+ else {
|
||||
+ %stat=%stat_new;
|
||||
+ }
|
||||
|
||||
#write new stat to old file
|
||||
open(my $stath_old, ">", $stat_old) or plugin_die "Can't open file $stat_old to write: $!";
|
45
check_mailstat_plugin_v0.9.1-stat_file.patch
Normal file
45
check_mailstat_plugin_v0.9.1-stat_file.patch
Normal file
@ -0,0 +1,45 @@
|
||||
Index: check_mailstat_plugin_v0.9.1/check_mailstat.pl
|
||||
===================================================================
|
||||
--- check_mailstat_plugin_v0.9.1.orig/check_mailstat.pl
|
||||
+++ check_mailstat_plugin_v0.9.1/check_mailstat.pl
|
||||
@@ -49,7 +49,6 @@ my @warn;
|
||||
my @critical;
|
||||
|
||||
my $stat_file = '/var/tmp/mailstat';
|
||||
-my $stat_old = $stat_file. ".old";
|
||||
|
||||
sub usage;
|
||||
sub get_counter;
|
||||
@@ -73,6 +72,7 @@ $status = GetOptions(
|
||||
"V|version" => \$opt_V,
|
||||
"h|help" => \$opt_h,
|
||||
"w|warning=s" => \$opt_w,
|
||||
+ "s|statfile=s" => \$stat_file,
|
||||
"c|critical=s" => \$opt_c,);
|
||||
|
||||
if ($status == 0)
|
||||
@@ -92,6 +92,7 @@ if ($opt_h) {
|
||||
exit $ERRORS{'OK'};
|
||||
}
|
||||
|
||||
+my $stat_old = $stat_file. ".old";
|
||||
my @stat_counter = get_counter();
|
||||
$answer = stat_str(@stat_counter);
|
||||
my $perfdata = sprintf "sent=%-6.2f received=%-6.2f bounced=%-6.2f rejected=%-6.2f virus=%-6.2f spam=%-6.2f", @stat_counter;
|
||||
@@ -145,7 +146,7 @@ exit $ERRORS{$state};
|
||||
|
||||
sub usage {
|
||||
print "\nUsage:\n";
|
||||
- print "$PROGNAME -w <WARN THRESHOLD> -c <CRITICAL THRESHOLD> \n";
|
||||
+ print "$PROGNAME -w <WARN THRESHOLD> -c <CRITICAL THRESHOLD> -s $stat_file\n";
|
||||
print "THRESHOLD: sent:received:bounced:rejected:virus:spam\n";
|
||||
print " if no threshold for a specific counter, set it to 0\n";
|
||||
print " measured by messages per minute\n";
|
||||
@@ -163,6 +164,7 @@ sub print_help {
|
||||
print "\nOptions:\n";
|
||||
print " -w,--warning=THRESHOLD Return WARN if exceed the thresolds\n";
|
||||
print " -c,--critical=THRESHOLD Retrun CRITICAL if exceed the thresholds\n";
|
||||
+ print " -s,--statfile=<file> Full path to statistic file from mailgraph (default: /var/tmp/mailstat)\n";
|
||||
print " -V (--Version) Plugin version\n";
|
||||
print " -v (--verbose) Enable verbose output\n";
|
||||
print " -h (--help) Usage help \n\n";
|
3
check_mailstat_plugin_v0.9.1.zip
Normal file
3
check_mailstat_plugin_v0.9.1.zip
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2a8e8be172bd71f7b3c5b81b77b6fcddf31f8c2e765050c4b72f5d8caf930ca5
|
||||
size 5750
|
1
nagios-plugins-mailstat-rpmlintrc
Normal file
1
nagios-plugins-mailstat-rpmlintrc
Normal file
@ -0,0 +1 @@
|
||||
addFilter("non-etc-or-var-file-marked-as-conffile /usr/share/pnp4nagios/templates/check_mailstat.php");
|
7
nagios-plugins-mailstat.changes
Normal file
7
nagios-plugins-mailstat.changes
Normal file
@ -0,0 +1,7 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 19 20:00:14 UTC 2014 - lars@linux-schulserver.de
|
||||
|
||||
- initial version
|
||||
- added:
|
||||
+ check_mailstat_plugin_v0.9.1-initial_values.patch
|
||||
+ check_mailstat_plugin_v0.9.1-stat_file.patch
|
76
nagios-plugins-mailstat.spec
Normal file
76
nagios-plugins-mailstat.spec
Normal file
@ -0,0 +1,76 @@
|
||||
#
|
||||
# spec file for package nagios-plugins-mailstat
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
Name: nagios-plugins-mailstat
|
||||
Version: 0.9.1
|
||||
Release: 0
|
||||
Summary: Monitoring mail server statistics
|
||||
License: GPL-3.0+
|
||||
Group: System/Monitoring
|
||||
Url: http://linuxplayer.org/2010/12/check_mailstat-pl-a-nagios-plugin-for-monitoring-mail-server-statistics
|
||||
Source0: check_mailstat_plugin_v%{version}.zip
|
||||
Source1: nagios-plugins-mailstat-rpmlintrc
|
||||
# PATCH-FIX-UPSTREAM -- allow to configure the path name of the statistics file via -s option
|
||||
Patch1: check_mailstat_plugin_v0.9.1-stat_file.patch
|
||||
# PATCH-FIX-UPSTREAM -- write out the initial values if there is no old file instead of all zero (confuses people)
|
||||
Patch2: check_mailstat_plugin_v0.9.1-initial_values.patch
|
||||
%if 0%{?suse_version} > 1010
|
||||
# nagios can execute the script with embedded perl
|
||||
Recommends: perl
|
||||
%endif
|
||||
BuildRequires: nagios-rpm-macros
|
||||
BuildRequires: unzip
|
||||
Requires: nagios-plugins-common
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
This plugin includes a patch for mailgraph so that it will also output its
|
||||
statistics counter to an external file(plus the rra file),and a
|
||||
check_mailstat.pl which check the stat counter to see if it’s ok, emit
|
||||
WARN/CRITICAl result if not.It can run on nagios server, or on remote server
|
||||
via NRPE.
|
||||
|
||||
%prep
|
||||
%setup -q -n check_mailstat_plugin_v%{version}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
sed -i "s|
||g" README.txt
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
install -D -m755 check_mailstat.pl %{buildroot}/%{nagios_plugindir}/check_mailstat
|
||||
ln -s %{nagios_plugindir}/check_mailstat %{buildroot}/%{nagios_plugindir}/check_mailstat.pl
|
||||
install -D -m644 extra/check_mailstat.php %{buildroot}/%{pnp4nagios_templatedir}/check_mailstat.php
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc README.txt
|
||||
# avoid build dependecy of nagios - own the dirs
|
||||
%dir %{nagios_libdir}
|
||||
%dir %{nagios_plugindir}
|
||||
%{nagios_plugindir}/check_mailstat*
|
||||
%dir %{pnp4nagios_datarootdir}
|
||||
%dir %{pnp4nagios_templatedir}
|
||||
%config(noreplace) %{pnp4nagios_templatedir}/check_mailstat.php
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user