Shell script to generate nagios data for nrdp transfer
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.