osc copypac from project:server:monitoring package:nagios-plugins-tftp revision:4
OBS-URL: https://build.opensuse.org/package/show/server:monitoring/monitoring-plugins-tftp?expand=0&rev=1
This commit is contained in:
commit
eb18dfb533
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
|
110
check_tftp.pl
Normal file
110
check_tftp.pl
Normal file
@ -0,0 +1,110 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# ============================== SUMMARY =====================================
|
||||
#
|
||||
# Program : check_tftp.pl
|
||||
# Version : 0.11
|
||||
# Date : Nov 24 2006
|
||||
# (added all the top comments you see, no code changes since 2005?)
|
||||
# Author : William Leibzon - william@leibzon.org
|
||||
# Summary : This is a nagios plugin that verifies TFTP server is working
|
||||
# Licence : GPL - summary below, full text at http://www.fsf.org/licenses/gpl.txt
|
||||
#
|
||||
# =========================== PROGRAM LICENSE =================================
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# ===================== INFORMATION ABOUT THIS PLUGIN =========================
|
||||
#
|
||||
# This is a very simple nagios plugin that checks if TFTP server is up
|
||||
# It is using Net::TFTP perl module for protocol support
|
||||
# There are two required parameters/arguments:
|
||||
# $1 - HOSTNAME to check
|
||||
# $2 - file to retrieve for this check
|
||||
# An example of how to use this is as follows:
|
||||
#
|
||||
#define command{
|
||||
# command_name check_tftp
|
||||
# command_line $USER1$/check_tftp.pl $HOSTADDRESS$ X86PC/UNDI/linux-install
|
||||
# }
|
||||
#
|
||||
#define service{
|
||||
# use generic-service
|
||||
# hostgroup_name dhcpserv
|
||||
# service_description TFTP
|
||||
# check_command check_tftp
|
||||
# }
|
||||
# =================================== TODO ===================================
|
||||
#
|
||||
# 1. Using GetOpt::Long for specifying parameters including timeout &
|
||||
# number of retries
|
||||
# 2. Check to make sure file is writable rather then just read-only check
|
||||
#
|
||||
# Note: I'm unlikely to work on this plugin unless somebody writes me they
|
||||
# actually want "tftp write" or similar feature.
|
||||
#
|
||||
# ========================== START OF PROGRAM CODE ===========================
|
||||
|
||||
use strict;
|
||||
use Net::TFTP;
|
||||
use FileHandle;
|
||||
|
||||
# Nagios specific
|
||||
# use lib "/usr/local/nagios/libexec";
|
||||
# use utils qw(%ERRORS $TIMEOUT);
|
||||
my $TIMEOUT = 20;
|
||||
my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);
|
||||
|
||||
sub print_usage {
|
||||
print "TFTP Monitor for Nagios by william(at)leibzon.org\n\n";
|
||||
print "Usage: check_tftp.pl hostname filename\n";
|
||||
}
|
||||
|
||||
# Get the alarm signal (just in case)
|
||||
$SIG{'ALRM'} = sub {
|
||||
print ("ERROR: Alarm signal (Nagios time-out)\n");
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
};
|
||||
|
||||
if (!defined($ARGV[0]) || !defined($ARGV[1])) {
|
||||
print_usage();
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
|
||||
my $HOSTNAME = $ARGV[0];
|
||||
my $FILENAME = $ARGV[1];
|
||||
|
||||
alarm($TIMEOUT);
|
||||
|
||||
my $tftp = Net::TFTP->new($HOSTNAME, Port => 69, Retries => 2);
|
||||
my $err=$tftp->error();
|
||||
my $fh=$tftp->get($FILENAME);
|
||||
|
||||
if (!$fh || $err) {
|
||||
print "CRITICAL ERROR - could not retrieve $FILENAME from $HOSTNAME using tftp - $err\n";
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
else {
|
||||
my $data = $fh->getline;
|
||||
$err = $tftp->error();
|
||||
if (defined($data) && !$err) {
|
||||
print "TFTP OK - file $FILENAME present on server $HOSTNAME\n";
|
||||
exit $ERRORS{"OK"};
|
||||
}
|
||||
else {
|
||||
print "CRITICAL ERROR - could not retrieve $FILENAME from $HOSTNAME using tftp - $err\n";
|
||||
exit $ERRORS{"CRITICAL"};
|
||||
}
|
||||
}
|
17
nagios-plugins-tftp.changes
Normal file
17
nagios-plugins-tftp.changes
Normal file
@ -0,0 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 13 12:26:41 UTC 2012 - lars@linux-schulserver.de
|
||||
|
||||
- update to 0.11:
|
||||
+ use Net::TFTP and FileHandle perl modules now
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jul 12 21:09:39 UTC 2012 - lars@linux-schulserver.de
|
||||
|
||||
- use nagios-rpm-macros
|
||||
- specfile cleanup
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 23 18:16:36 CEST 2009 - lars@linux-schulserver.de
|
||||
|
||||
- initial version v0.1.2
|
||||
|
61
nagios-plugins-tftp.spec
Normal file
61
nagios-plugins-tftp.spec
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# spec file for package nagios-plugins-tftp
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
|
||||
|
||||
Name: nagios-plugins-tftp
|
||||
Version: 0.11
|
||||
Release: 1
|
||||
License: GPL-2.0+
|
||||
Summary: Nagios plugin to check a tftp server
|
||||
Url: http://isle.wumpus.org/nagios/
|
||||
Group: System/Monitoring
|
||||
Source0: check_tftp.pl
|
||||
%if 0%{?suse_version} > 1010
|
||||
# nagios can execute the script with embedded perl
|
||||
Recommends: perl
|
||||
%endif
|
||||
BuildRequires: nagios-rpm-macros
|
||||
Requires: perl(FileHandle)
|
||||
Requires: perl(Net::TFTP)
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
This plugin checks for availability of a TFTP Server,
|
||||
which is normaly used for booting clients over the network.
|
||||
|
||||
It downloads a test file from the TFTP server and checks its size against a
|
||||
given value.
|
||||
|
||||
%prep
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/%{nagios_plugindir}
|
||||
sed -e "s|/usr/local/libexec/nagios|%{nagios_plugindir}|g; \
|
||||
s|/usr/local/bin/perl|%{_bindir}/perl|g" %{SOURCE0} > %{buildroot}/%{nagios_plugindir}/check_tftp
|
||||
chmod +x %{buildroot}/%{nagios_plugindir}/check_tftp
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
# avoid build dependecy of nagios - own the dirs
|
||||
%dir %{nagios_libdir}
|
||||
%dir %{nagios_plugindir}
|
||||
%{nagios_plugindir}/check_tftp
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user