From 70f45f393a56269bf8e82f2fee23d147d36f416b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 1 Feb 2016 10:40:35 +0200 Subject: [PATCH] new, version 1.0 --- check_file_exists.cfg | 20 ++++++++++++ monitoring-plugin-check_file_exists.spec | 41 ++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 check_file_exists.cfg create mode 100644 monitoring-plugin-check_file_exists.spec diff --git a/check_file_exists.cfg b/check_file_exists.cfg new file mode 100644 index 0000000..6d1a913 --- /dev/null +++ b/check_file_exists.cfg @@ -0,0 +1,20 @@ +# Usage: +# check_file_exists!/path/to/file +define command { + command_name check_file_exists + command_line /usr/lib/nagios/plugins/check_file_exists $ARG1$ +} + +define service { + use generic-service + name file_exists + service_description file_exists + register 0 + + normal_check_interval 5 + retry_check_interval 1 + + notification_interval 10 + + check_command check_file_exists +} diff --git a/monitoring-plugin-check_file_exists.spec b/monitoring-plugin-check_file_exists.spec new file mode 100644 index 0000000..4c1ce14 --- /dev/null +++ b/monitoring-plugin-check_file_exists.spec @@ -0,0 +1,41 @@ +%define plugin check_file_exists +Summary: Monitoring plugin to check if a file exists or not +Name: monitoring-plugin-%{plugin} +Version: 1.0 +Release: 1 +License: GPL +Group: Networking +Source0: https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=2330&cf_id=24&/%{plugin}.sh +# Source0-md5: 388097c05f6e58f4eeaca2cdf132331e +Source1: %{plugin}.cfg +URL: https://exchange.nagios.org/directory/Plugins/System-Metrics/File-System/check_file_exists/details +BuildRequires: rpmbuild(macros) >= 1.654 +Requires: nagios-common +Requires: nagios-plugins-libs +BuildArch: noarch +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%define _sysconfdir /etc/nagios/plugins +%define nrpeddir /etc/nagios/nrpe.d +%define plugindir %{_prefix}/lib/nagios/plugins + +%description +Monitoring plugin to check if a file exists or not. + +%prep +%setup -qcT +cp -p %{SOURCE0} %{plugin} + +%install +rm -rf $RPM_BUILD_ROOT +install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{nrpeddir},%{plugindir}} +install -p %{plugin} $RPM_BUILD_ROOT%{plugindir}/%{plugin} +cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/%{plugin}.cfg + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(644,root,root,755) +%attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{plugin}.cfg +%attr(755,root,root) %{plugindir}/%{plugin} -- 2.44.0