LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-11-2009, 09:55 AM   #1
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Rep: Reputation: 40
Rebuild Nagios-packages for RHEL 5


Hi all.


I'd like to rebuild (from source RPM) a few RHEL 5 Nagios-plugins found in the EPEL repo. Examples of such plugins are "nagios-plugins-load" and "nagios-plugins-disk".

The only relevant source RPM I've found is the "nagios-plugins" package. This package seems to include all plugins. Should I use this package to build the above mentioned plugins? If so, does anyone know how to stip the spec file down to just a selected few plugins? I'm quite new to building RPMs, and could use some guidance.

Regards,
kenneho

PS. I posted this on the red hat mailing list, but since I didn't get any replies I'm posting it here.
 
Old 06-11-2009, 11:22 AM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
compile the nagios plugins source package and then remove unwanted plugins.
 
Old 06-11-2009, 02:51 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
The 'nagios-plugins.spec' file has a file list.
( At least the 2 examples I have seen, have a list.)

The list can be edited to leave out the plugins,
you don't want, from the file list / install list.

Example file : nagios-plugins-1.4.11-4.fc9.src.rpm
http://download.fedora.redhat.com/pu.../source/SRPMS/
.... ~ ~ 67 plugins in the install list.
.....
 
Old 06-12-2009, 05:27 AM   #4
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Original Poster
Rep: Reputation: 40
Thanks for the replies.

I've actually allready tried to strip down the spec file to include only a selected few plugins, but with no luck - there seems to be a lot of details in there that causes problems. Would you guys mind looking through the attached file, and give me some pointers to what can be removed? In my modified versions of this file I've removed a lot of lines from the "packages" and "files" sections, and some from the "install" section, but I still have problems..

Any help would be appreciated.
Attached Files
File Type: txt nagios-plugins_spec_original.txt (26.9 KB, 17 views)
 
Old 06-12-2009, 06:41 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If you want only those two plugins, wouldn't it be easier to D/L the plugin sources from the Nagios plugins exchange site and RPM-ify those?
 
Old 06-15-2009, 07:26 AM   #6
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by unSpawn View Post
If you want only those two plugins, wouldn't it be easier to D/L the plugin sources from the Nagios plugins exchange site and RPM-ify those?
I'm sure it would, but I'd prefer to use the (source) packages found in EPEL, and as far as I can see the only relevant Nagios source package there is the "nagios-plugins" source...
 
Old 06-17-2009, 08:03 AM   #7
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Original Poster
Rep: Reputation: 40
I've decided to go for kirukan's advice, and compile the whole package. Now I'm getting a very strange error:

Code:
error: Could not open /home/rpmbuild/SRPMS/nagios-plugins-1.4.13-11.src.rpm: No such file or directory

Why is the build process expecting to find the source RPM there? And second: The source RPM I'm compiling _from_ has a slightly different name, as it has "el5" in there somewhere. Anyone knows why the build process is looking for the source RPM in the first place, and why it's looking for the wrong RPM in a directory that doesn't exists?

Sorry if these are very basic questions, but I'm new to the RPM building process..
 
Old 06-17-2009, 08:45 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by kenneho View Post
Why is the build process expecting to find the source RPM there? And second: The source RPM I'm compiling _from_ has a slightly different name, as it has "el5" in there somewhere. Anyone knows why the build process is looking for the source RPM in the first place, and why it's looking for the wrong RPM in a directory that doesn't exists?
Rebuilding from a .src.rpm should be as easy as 'rpmbuild --rebuild /path/to/nagios-plugins-1.4.13-11.src.rpm'. Since you didn't show us what you actually did and my ESP is way low only guessing remains.


Quote:
Originally Posted by kenneho View Post
Sorry if these are very basic questions, but I'm new to the RPM building process..
Nothing http://www.rpm.org/max-rpm/ can't fix.
 
Old 06-18-2009, 06:33 AM   #9
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Original Poster
Rep: Reputation: 40
I guess it's time for me to elaborate a bit on what I'm acutally doing.


I'm playing around with RHEL 5 on IBM System Z (mainframe), also known as z/Linux. We use Nagios on our existing x86 infrastructure, and would like to be using Nagios on z/Linux. And we'd prefer to fetch everything from EPEL.

So I've fetched the package nagios-plugins-1.4.13-11.el5.src.rpm from EPEL, and would like to compile it on z/Linux. I guess I have these options:
  1. Modify the specs-file to complie only the plugins I'm gonna use
  2. Compile the whole source code, and extract only the wanted plugins
  3. Don't know if this would work, but I could possibly extract the plugins from a running x86 instance, but this would only work for scripts (and not compiled plugins).

This is what I've done so far:
Regarding modifying the specs-file: I've tried to comment out as much as possible from the specs file, hoping that I'd end up with only the plugins I want. But this has proven more difficult than I expected. I can provide more details if needed.

Compiling the whole source code by issuing "rpmbuild --rebuild <package>" leaves me with these errors:
Code:
error: Failed build dependencies: 
        /usr/sbin/fping is needed by nagios-plugins-1.4.13-11.s390x 
        perl(Net::SNMP) is needed by nagios-plugins-1.4.13-11.s390x 
        radiusclient-ng-devel is needed by nagios-plugins-1.4.13-11.s390x 
        /usr/bin/qstat is needed by nagios-plugins-1.4.13-11.s390x
These packages doesn't seem to exist in the offical RHEL repo, which is the only repo for z/Linux I know about. They exist in EPEL, but I beilieve that woun't help me much...

So I think that my best option is alternative 1, modifying the specs file...
 
Old 06-18-2009, 11:43 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
There's another solution being somewhat similar to post #5: if you extract the .src.rpm, configure the extracted tarball and run 'make check_load' in the plugins directory you'll see it requires making in ../lib, running 'make check_load' again shows it requires making in ../gl as well. Since neither check_load or check_disk (your OP examples) requires anything else in the sense of build or installation dependencies the .src.rpm requires, 'make -n install' should then show you you could adapt %install in terms of install commands, and manual pages, examples or docs to be copied over and how to fill %files. If you agree that is a usable and efficient approach, figure out the configure, make and install commands you need, supply any .spec specs you require plus a files listing and we'll build you a .spec file based on that.
 
Old 06-22-2009, 03:44 AM   #11
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Original Poster
Rep: Reputation: 40
Quote:
Originally Posted by unSpawn View Post
There's another solution being somewhat similar to post #5: if you extract the .src.rpm, configure the extracted tarball and run 'make check_load' in the plugins directory you'll see it requires making in ../lib, running 'make check_load' again shows it requires making in ../gl as well. Since neither check_load or check_disk (your OP examples) requires anything else in the sense of build or installation dependencies the .src.rpm requires, 'make -n install' should then show you you could adapt %install in terms of install commands, and manual pages, examples or docs to be copied over and how to fill %files. If you agree that is a usable and efficient approach, figure out the configure, make and install commands you need, supply any .spec specs you require plus a files listing and we'll build you a .spec file based on that.
Thanks for the suggestion. I've tried to follow your repecipe, but got stuck at the "make -n install" part - I'm not sure what to include in the specs-file's %install section. I've piped the output of "make -n install" to a file and attached it. Could you please take a quick look and advice me on what to look for?
 
Old 06-22-2009, 05:31 AM   #12
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Sure, if you attach it ;-p
 
Old 06-22-2009, 07:45 AM   #13
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Original Poster
Rep: Reputation: 40
Sorry, we've suffered from some network problems today, so my upload crashed. But it's attached to this post.
Attached Files
File Type: txt make_install.out.txt (60.5 KB, 8 views)
 
Old 06-22-2009, 08:24 AM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
vi +342 make_install.out.txt
This should be in your %install section
Code:
echo "%%install"
mkdir -p -- "${RPM_BUILD_ROOT}/usr/lib64/nagios/plugins"
echo "%%files"
echo "%%defattr(-,root,root)"
list='check_disk check_load'; for p in $list; do
 /usr/bin/install -m 0755  "$p" "${RPM_BUILD_ROOT}/usr/lib64/nagios/plugins/$p"
 echo "%%attr(755,root,root) /usr/lib64/nagios/plugins/$p"
done
- I didn't see no docs for the %doc section
- The echoes should give you an idea what should be in your %files section
- IIRC I have to double the percent signs else it gets interpreted in the .spec file.
 
Old 07-07-2009, 02:34 AM   #15
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Original Poster
Rep: Reputation: 40
Other things have come up, so I'll have to put this issue on halt for a while. Thanks for the help so far.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure Nagios 2.0 in Rhel 5 sudheshpn Linux - Newbie 1 11-26-2008 11:32 PM
Rebuild RHEL 5 from source almahdi Red Hat 1 06-15-2008 12:58 PM
how to show up all available packages in system-config-packages (RHEL 5) sean_zhang Linux - Newbie 1 03-10-2008 05:05 AM
Rebuild A Server Installation Disk from RHEL of CentOS Source RPm kenwee Red Hat 2 05-09-2006 04:36 AM
Debian packages for Nagios-2 shawnbishop Linux - Software 2 03-16-2006 01:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration