6.3.0-rc6 - Create Startup Script to enable NRPE (for nagios monitoring)


KcWeBBy

Recommended Posts

Hi there...

I'm looking for a bit of advanced help (compared to what I see on most topics here).

 

I'd like to create a custom rc.d script that installs and runs the client for nrpe as part of the boot process, so my unraid servers will be capable of reporting through my nagios installation regarding various conditions.

 

This topic from 2008 eludes to a process, but actually has no script to install packages into the bootable config folder.  I have checked and no plugin exists.  Dockers would be counter productive, as I want to run drive level / process level monitoring queries.

**LINK** https://lime-technology.com/forum/index.php?topic=1953.60

 

Anyone done this?

I have several machines I'd like to run this on.

 

I'm a good scripter, but I'm unsure how to build a script to build the tools and run them the same each time (and keep the package updated)

 

Thanks in Advance!

 

-=-

 

 

unRAIDBM - Dell 2900 8x2TB 48GB RAM 1x5TB Parity Drive 1x500GBSSD Cache

pveUnRAID - (Docker Deployment Server) ProxMox VE Machine 8 cores 48GBRAM 100GB Data/Parity Drive  (running on a 64 core 1TB RAM proxmox host)

unRAIDSuper - SuperMicro X8DT6 72GB RAM 2x5TB Parity Drives, 2x1.2TB 2.5" SSD Cache Drives, 24x2TB data Drives (48TB Array)

Unconfigured Storage:  2x Dell EqualLogic PS100E 14x 2TB SAS Drives, Dual Type 2 Controllers 28TB 4x1GB iSCSI Interfacese

 

Link to comment

Here are a few things that may be part of your puzzle. Perhaps you're already aware of these.

 

Any .txz or .tgz file in /boot/extra is automatically installed at bootup before the plugins are installed.

 

There is a User Scripts plugin that allows you to run a custom script at bootup.

 

The /boot/config/go script starts the webUI at bootup after the plugins are installed. That script can be customized.

 

Note that the unRAID OS is unpacked fresh from bzimage,bzroot into RAM at each boot so if you make any changes to the OS, you will have to reapply them each boot.

Link to comment

Yes, thank you for that.

 

I figured I would need to build a tgz file to be unpacked at startup, but what needs to be in there, and how to build it is what really perplexes me at the moment.

I am familiar with the ramdrive OS concept, and have integrated a couple of custom scenarios into the mix already for saving logfiles, etc, but I do not, as yet, understand how to build the NRPE apps into a tgz that could be reproduced on boot.

 

Thanks for the reply!

 

 

Link to comment

unRAID is a custom slackware linux. You can get the version with:

cat /etc/slackware-version

 

You could run a full slackware VM to develop code in and transfer the results to unRAID, but if your code has any dependencies you might need to include them also since unRAID may not have them by default.

 

There might also be some useful things in the NerdPack plugin for you.

Link to comment

wow, yeah, I haven't yet messed with the nerdpack, but I do have it installed.  It deserves more time exploring it than I currently have.

 

I'm not sure I have the time currently to invest in figuring it out.  I have a proxmox environment that I already monitor the vm's with nrpe.  I was hoping I could find someone who was doing it and copy/paste to my machine.

 

unRAIDBM – 16TB unRAID 6.2.4 Pro Dell 2900:2x 5160-3Ghz:48GB:SAS1068E:SmartUPS8KVA

pveUnRAID 100GB unRAID 6.3.0-rc9 Basic ProxMox VE VM:6 cores:48GB:qcow2:SmartUPS8KVA

Dockers:BindDNS:musicbrainz:mysql:nginx:phpmyadmin:plex:plexEmail:plexpy:PlexRequests:portainer:pveAD:pvePlexpy

unRAIDSuper 48TB unRAID 6.3.0-rc9 Pro SuperMicro X8DT6:2x L5630-2.13Ghz:68GB:SAS2004:SmartUPS8KVA

Link to comment

In a nutshell, building slackware packages:

[*]create a packaging directory ie /tmp/pkg, this servers like a chroot so locate everything in there.

[*]create neccessary subdirs

ie /tmp/pkg

  +- usr/bin

  +- etc

  +- share

[*]place in the files as needed. You may create symlinks if needed, keeping in mind that absolute symlinks should be done like a chroot

ie /usr/bin/myapp -> /usr/local/bin/myapp (not /tmp/pkg/usr/local/bin/myapp)

[*]create an install dir /tmp/pkg/install

[*]place an install script there named doinst.sh (needs to be executable I think)

[*]make sure the ownership is correct as well as permissions for any files

[*]chdir to /tmp/pkg then execute makepkg mypackage.tgz

[*]copy the mypackage.tgzto /boot/extra dir

[*]done.

 

Link to comment
  • 2 years later...

Resurrecting an old thread - But, wondering if anyone has successfully installed the check_npre client on Unraid? I have all my other boxes already configured. Was hoping it would be as easy as other servers, but it seems like it may be difficult to get monitoring piped into Nagios. 

 

Would love to see the Nerd Pack add the check_npre client added, but I am thinking it would be more involved than how that works.

Link to comment
On 1/31/2020 at 1:49 AM, guythnick said:

Resurrecting an old thread - But, wondering if anyone has successfully installed the check_npre client on Unraid? I have all my other boxes already configured. Was hoping it would be as easy as other servers, but it seems like it may be difficult to get monitoring piped into Nagios. 

 

Would love to see the Nerd Pack add the check_npre client added, but I am thinking it would be more involved than how that works.

Did you managed to get it running?

Link to comment
  • 2 weeks later...

UPDATE:

 

I was able to get this running using the mikenowak/nrpe docker image. I realize that this exposes the container to the whole of the system, but only /var/run is RW, and I don't expose anything over the internet.  Below are screenshots, and keep in mind when building the paths to use the R/W settings of the docker cmd line.  Also will need to add the IPC and PID parameters in the advanced view. 

 

I had to get creative with the checks in Nagios, but everything I was wanting is working, graphing, etc. correctly. 

 

docker run -d --restart unless-stopped -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys:ro -v /var/lib/docker/:/var/lib/docker:ro --privileged --net=host --ipc=host --pid=host -e NAGIOS_SERVER="1.2.3.4" mikenowak/nrpe

 

image.thumb.png.d5812348b85a89e5d22cc46299d8ca6b.png

 

image.thumb.png.c8521626dfb165cd40cbbb1d063b276b.png

 

image.thumb.png.3021687f45f1431956a01e495064c784.png

 

Example check_load:

 

image.png.5f2148c7f7fa3ef5520e200b42d865f6.png

 

Example check_docker cpu .  Note that I added '_ON' on the docker names for dockers that are always on and set to auto-start, so it doesn't alert out for containers that are usually down.

 

image.png.6555e5c13dc461d6c77b81d7e2e83731.png

Edited by guythnick
Added example checks
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.