Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 555862 - net-analyzer/nrpe Allow multiple instances
Summary: net-analyzer/nrpe Allow multiple instances
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Sysadmin Bugs
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2015-07-25 11:24 UTC by Marcel Pennewiß
Modified: 2018-08-23 18:02 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch to allow multiple nrpe-instances (nrpe.init.patch,763 bytes, patch)
2015-07-25 11:25 UTC, Marcel Pennewiß
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel Pennewiß 2015-07-25 11:24:14 UTC
For some circumstances it would be nice to have multiple nrpe services started. This can easily be achieved by linking init-script (as known from net.lo) e.g. nrpe.management -> nrpe. Afterwards a config file nrpe.management.cfg in /etc/nagios could be used.

Reproducible: Always
Comment 1 Marcel Pennewiß 2015-07-25 11:25:26 UTC
Created attachment 407580 [details, diff]
patch to allow multiple nrpe-instances

Patch attached allows multiple nrpe instances with linking init-scripts. The patch did not break any functionality, so it's just an enhancement.
Comment 2 Marcel Pennewiß 2015-12-29 22:15:51 UTC
Any news on this?
Comment 3 Tomáš Mózes 2017-06-22 14:27:02 UTC
I would suggest opening a PR and mentioning mjo.
Comment 4 Virgil Dupras (RETIRED) gentoo-dev 2018-08-06 22:13:20 UTC
Marcel: sorry, this looks like a case of maintainership failure. None of the members of the "Sysadmin Bugs" have been touching this package in years. Michael (adding in CC) seems to be the de-facto maintainer because he's the only one who's been committing lately (or proxy-committing Tomas).

If Michael isn't interested in taking over maintainership, maybe that this package would be better taken care of by you or Tomas as proxied maintainers?
Comment 5 Michael Orlitzky gentoo-dev 2018-08-06 23:07:30 UTC
This is/was already possible. OpenRC automatically sources /etc/conf.d/${RC_SVCNAME} in the init script, so if you symlink the init script to e.g. "nrpe.management", then you would want to override the config file name in /etc/conf.d/nrpe.management.

The fact that your setting won't be clobbered is a little more obvious in the latest version of NRPE, but this:

  ${CFGFILE:=/etc/nagios/nrpe.cfg}

will actually only set CFGFILE if it doesn't already exist -- meaning that you could set it in the conf.d file and have everything work like you wanted it to. 


The names of things have changed in newer versions of NRPE, so I'll be explicit. The init script for the latest version of NRPE has,

  command_args="--config=${NRPE_CFG} ${NRPE_OPTS}"

and the value of NRPE_CFG comes from the associated conf.d file. By default, that's /etc/conf.d/nrpe, but if you symlink the init script to "nrpe.management", then in /etc/conf.d/nrpe.management you would put (for example),

  # The configuration file to use.
  NRPE_CFG="/etc/nagios/nrpe-management.cfg"

When OpenRC starts your "nrpe.management" service, the value of NRPE_CFG will be obtained from that file (and not /etc/conf.d/nrpe), and everything will work like you want it to.

@vdupras: thanks for noticing this... I don't really want to maintain NRPE because I don't use it, but here we are. The sysadmin project should probably drop this to maintainer-needed, or a better idea would be to convince Tomáš to become a developer =)
Comment 6 Peter Große 2018-08-21 17:06:02 UTC
I'm afraid I have to slightly disagree.

Yes, the config is read from conf.d/nrpe.<symlinkname>, where I can set CFGFILE to the path of my config file.

But $command is still /usr/libexec/${SVCNAME}, which then will try to start an executable, which doesn't exist.
So changing the init file like this would still be required:

--- a/net-analyzer/nrpe/files/nrpe.init
+++ b/net-analyzer/nrpe/files/nrpe.init
@@ -13,7 +13,7 @@ get_config() {
 
 extra_started_commands="reload"
 
-command=/usr/libexec/${SVCNAME}
+command=/usr/libexec/${SVCNAME%%.*}
 command_args="-c ${CFGFILE} --daemon"
 pidfile=$(get_config pid_file)

In my pull request [0] I also included a service file for non-OpenRC systems, to add the same functionality there.

Does this make it worth to reopen the bug?

[0] https://github.com/gentoo/gentoo/pull/9079
Comment 7 Michael Orlitzky gentoo-dev 2018-08-23 17:49:47 UTC
(In reply to Peter Große from comment #6)
> 
> But $command is still /usr/libexec/${SVCNAME}, which then will try to start
> an executable, which doesn't exist.

You're right, but you're still looking at the old version of the init script. The modern version that comes with nrpe-3.2.1 is at,

 https://github.com/NagiosEnterprises/nrpe/blob/master/startup/openrc-init.in

and the problem with the executable name has been fixed:

 command="@sbindir@/nrpe"


> In my pull request [0] I also included a service file for non-OpenRC systems, to add the same functionality there.

I think this is a good idea, but our newer versions of nrpe install the upstream systemd service file from,

 https://github.com/NagiosEnterprises/nrpe/blob/master/startup/default-service.in

so your pull request should probably be directed there. Then it will automatically be included in the next version of nrpe.
Comment 8 Peter Große 2018-08-23 18:02:08 UTC
Ah, yes, I was talking about the current stable nrpe version.
The newer version is still masked as unstable, so I don't use that in a production environment.

Okay, will file a bug upstream.