My boss give me a project with nagios and ActiveMQ and MySQL, the nagios should monitoring the message queue in ActiveMQ and for MysQL i should know the replication delay.
Okay then the adventure is begin.
After searching in google, i found very interesting plugins at exchange.nagios.org, the issue is those packages are build in source not in RPM packet. hmm then i should build it into a RPM.
the solution is rebuild the source into a rpm.
let's start.
I try this with Fedora 13 and Centos 5.5
ingredients
1. download and install.
you can use this package rpmdev-setup for auto configuration, so you no need to build the folder again
2. create folders for build the rpm package and create hidden files named rpmmacros at your home directory.
in centos
if you using Fedora you don't need to create those directory, its automatic create when you install the depedency packet.
in fedora the directory structure will become like this:
3. for example i will rebuild the check_mysql_health (need to be complie) and check_jmx (binary already) plugins
download the source.
5. build the packet
and for the check_jmx you can download it at:
http://exchange.nagios.org/directory/Plugins/Java-Applications-and-Servers/check_jmx-II/details
put it into SOURCES folder
install the unzip , cause the source is compressed by zip
repeat,start from step 4. and create the .spec file for check_jmx
copy and paste this config:
great tutorial,you can download it at:
http://www.gurulabs.com/downloads/GURULABS-RPM-LAB/GURULABS-RPM-GUIDE-v1.0.PDF
next i will explain how to use those plugins with nagios
Okay then the adventure is begin.
After searching in google, i found very interesting plugins at exchange.nagios.org, the issue is those packages are build in source not in RPM packet. hmm then i should build it into a RPM.
the solution is rebuild the source into a rpm.
let's start.
I try this with Fedora 13 and Centos 5.5
ingredients
1. download and install.
rpm-build redhat-rpm-config gcc makenote : you should use ordinary user account for build the package not using root.
you can use this package rpmdev-setup for auto configuration, so you no need to build the folder again
yum install rpmdev-setup
2. create folders for build the rpm package and create hidden files named rpmmacros at your home directory.
in centos
mkdir -p ~/rpm/{SOURCES,BUILD,SPEC,SRPMS,RPMS,tmp}
touch ~/.rpmmacros
%packager check_logfiles %_topdir /home/fazries/rpm %_tmppath /home/fazries/rpm/tmp
in fedora the directory structure will become like this:
rpmbuild/ BUILD/ BUILDROOT/ RPMS/ SOURCES/ SPEC/ SPECS/ SRPMS/ tmp/
3. for example i will rebuild the check_mysql_health (need to be complie) and check_jmx (binary already) plugins
download the source.
cd ~/rpm/SOURCES/
wget -c http://labs.consol.de/wp-content/uploads/2010/12/check_mysql_health-2.1.5.tar.gz4. next create a spec file, inside this file is a configuration for making a RPM packet.
cd ~/rpm/SPEC/touch check_mysql_health.speccopy and paste this config into check_mysql_health.spec:
Summary: Mysql check plugin for nagios Name: check_mysql_health Version: 2.1.5
Release: 1%{?dist} License: GPL Group: Applications/System URL: http://sourceforge.net/projects/check-logfiles Packager: Dag Wieers Vendor: Dag Apt Repository, http://dag.wieers.com/apt/ Source: http://labs.consol.de/wp-content/uploads/2010/12/check_mysql_health-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description check_logfiles is a plugin for Nagios which searches for patterns in mysql It is capable of scanning multiple logfiles and their rotated ancestors in a single run. %prep %setup -n %{name}-%{version} %build %configure --libexecdir=%_libdir/nagios/plugins %install %{__rm} -rf %{buildroot} %{__make} install DESTDIR="%{buildroot}" %clean %{__rm} -rf %{buildroot} %files %defattr(-, root, root, 0755) %{_libdir}/nagios/plugins/check_mysql_health %changelog * Thu Sep 16 2010 Christoph Maser - 3.4.2-1 - 9115/yury- Update to version 3.4.2. * Thu Jan 10 2008 Christoph Maser - 2.3.1.2-1- Initial package.
5. build the packet
rpmbuild -ba check_mysql_health.spec6. the your rpm packet will create an stored at ~/rpm/RPMS/check_mysql_health-2.1.5-1.x86_64.rpm
and for the check_jmx you can download it at:
http://exchange.nagios.org/directory/Plugins/Java-Applications-and-Servers/check_jmx-II/details
put it into SOURCES folder
install the unzip , cause the source is compressed by zip
# yum install unzip
repeat,start from step 4. and create the .spec file for check_jmx
touch check_jmx.spec
copy and paste this config:
Version:2 Release:1%{?dist} Summary:check_jmx
Name: check_jmx Group:Application/System License:APL 2.0 URL:http://exchange.nagios.org BuildRoot:%{_builddir}/%{name}-root BuildArch:noarch %description jmx plugins for nagios %prep rm -rf %{buildroot} rm -rf $RPM_BUILD_ROOT/* %build pwd cd %{_sourcedir}unzip -e check_jmxII.zip %install cd %{_sourcedir} ls cd jmxquery/nagios/plugin mkdir -p $RPM_BUILD_ROOT/usr/lib64/nagios/plugin scp * $RPM_BUILD_ROOT/usr/lib64/nagios/plugins %clean rm -rf $RPM_BUILD_ROOT %files %defattr(755,root,root)/usr/lib64/nagios/plugins %changelog
* Tue Jan 15 2011 Vash27- recreated * Tue Jan 10 2011 Vash27- Created initial spec file for check_jmx
great tutorial,you can download it at:
http://www.gurulabs.com/downloads/GURULABS-RPM-LAB/GURULABS-RPM-GUIDE-v1.0.PDF
next i will explain how to use those plugins with nagios
Thanks for the pointers. I'm building the check_jmx package and it looks fine. A couple of comments though:
ReplyDelete- The license in your SPEC file says GPL, though the JMX query library (from http://code.google.com/p/jmxquery/ ) is licensed as APL 2.0.
- Do you know how I can get in touch with the owner of the check_jmx II package in Nagios Exchange, because it seems that it distributes modified sources of the JMX query source code (from the project listed above) without referencing the original project.
Thanks in advance.
Hai Guss77, thank for your visit,
ReplyDelete- yes your correct, after i check the license is APL 2.0 for jmxquery. i will fix that.
- i'm sory i don't know, i got the package directly from http://exchange.nagios.org/directory/Plugins/Java-Applications-and-Servers/check_jmx-II/details