]> git.pld-linux.org Git - packages/nagios-plugin-check_raid.git/blob - nagios-plugin-check_raid.spec
make scriptlets debian compatible (via alien)
[packages/nagios-plugin-check_raid.git] / nagios-plugin-check_raid.spec
1 # TODO
2 # - see and adopt: http://gist.github.com/359890
3 %define         plugin  check_raid
4 %include        /usr/lib/rpm/macros.perl
5 Summary:        Nagios plugin to check current server's RAID status
6 Name:           nagios-plugin-%{plugin}
7 Version:        4.0.6
8 Release:        1
9 License:        GPL v2
10 Group:          Applications
11 Source0:        https://github.com/glensc/nagios-plugin-check_raid/archive/%{version}/%{name}-%{version}.tar.gz
12 # Source0-md5:  72ec3dba022e4c1483828a0610c629a1
13 Patch0:         maxcache.patch
14 URL:            https://github.com/glensc/nagios-plugin-check_raid
15 BuildRequires:  perl-ExtUtils-MakeMaker-CPANfile
16 BuildRequires:  perl-Module-Pluggable >= 5.1
17 BuildRequires:  perl-Monitoring-Plugin >= 0.37
18 BuildRequires:  rpm-perlprov >= 4.1-13
19 BuildRequires:  rpmbuild(macros) >= 1.685
20 Requires:       grep
21 Requires:       nagios-common
22 Requires:       perl-base >= 1:5.8.0
23 Requires:       sed >= 4.0
24 Requires:       sudo >= 1:1.8.7-2
25 Suggests:       CmdTool2
26 Suggests:       arcconf
27 Suggests:       areca-cli
28 Suggests:       cciss_vol_status
29 Suggests:       hpacucli
30 Suggests:       lsscsi
31 Suggests:       megacli-sas
32 Suggests:       megarc-scsi
33 Suggests:       mpt-status
34 Suggests:       mvcli
35 Suggests:       smartmontools
36 Suggests:       tw_cli-9xxx
37 # cciss_vol_status 1.10 can process /dev/sdX instead of only /dev/sgX
38 Conflicts:      cciss_vol_status < 1.10
39 Conflicts:      nagios-nrpe < 2.15-5
40 BuildArch:      noarch
41 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
42
43 %define         _sysconfdir     /etc/nagios/plugins
44 %define         nrpeddir        /etc/nagios/nrpe.d
45 %define         plugindir       %{_prefix}/lib/nagios/plugins
46
47 %description
48 This plugin chekcs Check all RAID volumes (hardware and software) that
49 can be identified.
50
51 Supports:
52 - AIX software RAID via lsvg
53 - Adaptec AAC RAID via aaccli or afacli or arcconf
54 - Areca SATA RAID Support
55 - HP Smart Array (MSA1500) via serial line
56 - HP Smart Array Controllers and MSA Controllers via hpacucli (see
57   hapacucli readme)
58 - HP/Compaq Smart Array via cciss_vol_status (hpsa supported too)
59 - LSI Logic MegaRAID SAS series via MegaCli
60 - LSI MegaRaid via lsraid
61 - Linux 3ware SATA RAID via tw_cli
62 - Linux DPT/I2O hardware RAID controllers via /proc/scsi/dpt_i2o
63 - Linux GDTH hardware RAID controllers via /proc/scsi/gdth
64 - Linux LSI MegaRaid hardware RAID via /proc/megaraid
65 - Linux LSI MegaRaid hardware RAID via CmdTool2
66 - Linux LSI MegaRaid hardware RAID via megarc
67 - Linux MPT hardware RAID via mpt-status
68 - Linux Device Mapper
69 - Linux MegaIDE hardware RAID controllers via /proc/megaide
70 - Linux software RAID (md) via /proc/mdstat
71 - SAS2IRCU support
72 - Serveraid IPS via ipssend
73 - Solaris software RAID via metastat
74
75 %prep
76 %setup -qc
77 mv nagios-plugin-check_raid-*/* .
78 %patch0 -p1
79
80 %build
81 # version check exits with "3", here's explanation:
82 # https://github.com/monitoring-plugins/monitoring-plugins/pull/1363
83 ver=$(./%{plugin}.sh -V || :)
84 test "$(echo "$ver" | awk '{print $NF}')" = %{version}-dev
85
86 LC_ALL=en_US.utf8 \
87 %{__perl} Makefile.PL \
88         INSTALLVENDORSCRIPT=%{plugindir} \
89         INSTALLDIRS=vendor
90 %{__make}
91
92 %install
93 rm -rf $RPM_BUILD_ROOT
94 install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{nrpeddir},%{plugindir},/etc/sudoers.d}
95 %{__make} install \
96         DESTDIR=$RPM_BUILD_ROOT
97
98 cp -p %{plugin}.cfg $RPM_BUILD_ROOT%{_sysconfdir}
99 touch $RPM_BUILD_ROOT%{nrpeddir}/%{plugin}.cfg
100 touch $RPM_BUILD_ROOT/etc/sudoers.d/check_raid
101
102 # remove .pl extension
103 mv $RPM_BUILD_ROOT%{plugindir}/%{plugin}{.pl,}
104
105 # cleanup
106 %{__rm} $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
107 %{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/auto/App/Monitoring/Plugin/CheckRaid/.packlist
108
109 %clean
110 rm -rf $RPM_BUILD_ROOT
111
112 %post
113 # setup sudo rules:
114 # - on first install
115 # - if separate config file is used
116 grep -q '^#includedir /etc/sudoers\.d' /etc/sudoers && confd=1
117
118 if [ "$1" = 1 ] || [ "$1" = "configure" ] || [ "$confd" = 1 ]; then
119         %{plugindir}/%{plugin} -S || :
120 fi
121
122 %postun
123 if [ "$1" = "0" ] || [ "$1" = "remove" ]; then
124         # remove all sudo rules related to us
125         %{__sed} -i -e '/CHECK_RAID/d' /etc/sudoers
126 fi
127
128 %triggerpostun -- %{name} < 3.1.1-0.2, sudo < 1:1.8.7-2
129 if grep -q '^#includedir /etc/sudoers\.d' /etc/sudoers; then
130         %{plugindir}/%{plugin} -S || :
131 fi
132 # remove CHECK_RAID rules from /etc/sudoers if separate config is in place
133 if [ -e /etc/sudoers.d/check_raid ]; then
134         %{__sed} -i -e '/CHECK_RAID/d' /etc/sudoers
135 fi
136
137 %triggerin -- nagios-nrpe
138 %nagios_nrpe -a %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
139
140 %triggerun -- nagios-nrpe
141 %nagios_nrpe -d %{plugin} -f %{_sysconfdir}/%{plugin}.cfg
142
143 %files
144 %defattr(644,root,root,755)
145 %attr(640,root,nagios) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{plugin}.cfg
146 %attr(755,root,root) %{plugindir}/%{plugin}
147 %ghost %{nrpeddir}/%{plugin}.cfg
148 %ghost /etc/sudoers.d/check_raid
149 %dir %{perl_vendorlib}/App/Monitoring
150 %dir %{perl_vendorlib}/App/Monitoring/Plugin
151 %{perl_vendorlib}/App/Monitoring/Plugin/CheckRaid.pm
152 %{perl_vendorlib}/App/Monitoring/Plugin/CheckRaid
This page took 0.088252 seconds and 3 git commands to generate.