LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-26-2020, 06:16 AM   #1
eashleyfl
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Rep: Reputation: 3
Shell script to generate nagios data for nrdp transfer


Greetings all,

I'm new to the world of Nagios. I used Big Brother forever and rather than restart it after some system rebuilds, I thought I'd catch up to the modern world. My configurations won't run nagiosxi so I'm using core + plugins + nrdp on a Fedora32 virtual host. Nagiosxi on Linux is very particular about the platforms and the eval VMware virtual host won't run on any of my Fedora boxes or my Win10 systems. (It's VMware that won't run on my Win10 hosts, actually, as it says that I have Hyper-V installed when I don't. M$ always creates some Hyper-V network resources that VMware seems to be seeing and assuming the Hyper-V is installed. I don't run virtual hosts under Windows and haven't since WinNT 4.x.)

After wasting a couple of days falling down the nrpe, nsca, nscp and nrds rabbit holes, I finally found nrdp. Now I want to use a bash script to collect all the quivalent data as running nagios core on each of my Fedora hosts. I don't see any value of running nagios core on each machine when I can collect the same data with a cron executed script and transfer it all in a single XML result set with nrdp.

I've found the check_linux_stats.pl script and it is the basics of what I'm after, but I would rather use bash to directly collect the data since I will generate a single xml file containing all the core stats then transfer the file. It's a lot of churning to spin up the perl script 8 or 10 times when all the data is available without using perl. I can grep and awk my way to such a script, but I thought I'd ask if anyone has one that I can start from. I also see the nagiosxi plugins for cpu stats, file, services and procs.

Thanks in advance,
Eric
 
Old 10-26-2020, 07:16 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Maybe someone has a reference matching what you're looking for, but I feel you could start with that pearl script which does some of the basics and convert relevant parts to bash.

Or if you have a logic flow within your own thoughts, suggest you write that flow of operations down, and use that to construct a script.

I have no idea what your expertise is with bash scripting, but there are plenty of guides, I also have one in my signature which is a blog I wrote. What does show in that is at least one example of bash function use, which is the creation of utility functions of your own design, coupled with how to invoke them. If you've not done bash functions before, they help a lot, much like other programs, they provide modularity, re-use, and a cleaner total script.

If you get to a point where you have a script and wish to have people help with it, or help with an example similar to your goal, please post and I'm sure somebody, if not myself, will have some helpful thoughts about it.
 
Old 10-26-2020, 08:56 AM   #3
eashleyfl
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Original Poster
Rep: Reputation: 3
Thanks for the input. I wasn't looking for help with the script, just asking if anyone has one to share so I don't have to start at 0. I'm quite comfortable with bash. I started back in the dark ages when AT&T still owned SVR4 and curses, SCO owned the Intel *ix market and every other CPU came with the manufacturer's version of UNIX installed. I ported a multi-user RDMS (and the curses library from AT&T source) across 23 flavors of *ix, in addition to DOS, DOSPM, Win16, Win32 and even OS/2 all in console mode. I left the GUI products to another team. Before bash came along I prefered ksh because of it's command history controls.

I can handle this task. I just thought I'd see if anyone wants to share for this community supported package on a community supported OS.

Best regards,
Eric
 
Old 10-26-2020, 03:08 PM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,794

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
You can download my Nagios plugins
https://www.unix.com/infrastructure-...s-plugins.html
I did them in shell, because I know it best.
For this task perl is actually faster than shell because you hardly need to spawn any helper tools.
 
Old 10-27-2020, 06:51 AM   #5
eashleyfl
LQ Newbie
 
Registered: Nov 2004
Posts: 13

Original Poster
Rep: Reputation: 3
Quote:
Originally Posted by MadeInGermany View Post
You can download my Nagios plugins
https://www.unix.com/infrastructure-...s-plugins.html
I did them in shell, because I know it best.
For this task perl is actually faster than shell because you hardly need to spawn any helper tools.
Except the overhead of loading and unloading the perl environment for each service check is a waste of resources. I bit the bullet and built my own script already. I collect all the data I want to see on a given host into a single xml checkresults set and upload the single file to nrdp.

Now I'm trying to determine why the results are being bit bucketed on me. I think it's because the hosts were initially defined as active hosts. I would ideally like to have some active (network service) checks by the nagios core/nrdp host with additional items reported passively through nrdp.

I think I've missed something in the core+nrdp config but all the doc on NRDP that I can find is specific to xi and uses NRDS to achieve what I'm after. Any pointers on where to look? The object definitions look correct to me but they aren't working.

Thanks,
Eric
 
  


Reply

Tags
bash, nagios



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
Shell script, sftp script logfile not showing transfer information enid Linux - General 3 08-15-2016 10:12 AM
Script to generate EXCEL sheet by shell script dani1234 Linux - Newbie 15 09-14-2014 07:36 PM
nagios not working (http://localhost/nagios or http://ip/nagios) 404 error connect2janu Linux - Server 1 11-18-2012 02:06 AM
shell script to auto process ten random files and generate logs novice82 Linux - Newbie 4 10-05-2009 07:08 AM
Generate a random number from a bourne shell script lothario Linux - Software 2 03-01-2007 11:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:43 AM.

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