NagiosEnterprises / nrpe

NRPE Agent
GNU General Public License v2.0
259 stars 133 forks source link

Populating services file #151

Open box293 opened 7 years ago

box293 commented 7 years ago

In the install documentation: https://support.nagios.com/kb/article.php?id=515

You need to populate the services file, for example:

echo >> /etc/services
echo '# Nagios services' >> /etc/services
echo 'nrpe    5666/tcp' >> /etc/services

It would be nice if there was a script that detected if this is required and add it.

mskadu commented 7 years ago

Good idea. Should it not also happen with the server install?

box293 commented 7 years ago

The remote machine running the NRPE client is where it is needed from what I understand.

I assume when you say "server" you mean the Nagios server, I'm not sure if check_nrpe has any specific requirements or uses the services file.

mskadu commented 7 years ago

Surely this would also be required on the server which would communicate with monitored clients on the same port? Unless i am completely mistaken?

Happy to be corrected, of course.

box293 commented 7 years ago

After your input I wanted to investigate some more, I had come across issues in the past when I had experienced build problems when the entry did not exist in /etc/services, so I wanted to thoroughly understand why.

A quick search of the code indicates that Makefile.in does a check for it at line 169. This appears to be part of the install-inetd function.

I assume then that the entry in /etc/services is only required for the build process to complete (without failure) when performing a make install-inetd.

I'm unsure though if the actual NRPE code requires the entry in /etc/services.

ericloyd commented 7 years ago

It does not. /etc/services is like a DNS for service-to-port number mappings. So if you issued a command like:

tcpdump port ssh

It would look it up to find port 22. Almost nothing needs entries in the file to actually run.

mskadu commented 7 years ago

Fair enough.

On Tue, Jul 18, 2017, 4:40 PM Eric Loyd notifications@github.com wrote:

It does not. /etc/services is like a DNS for service-to-port number mappings. So if you issued a command like:

tcpdump port ssh

It would look it up to find port 22. Almost nothing needs entries in the file to actually run.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/NagiosEnterprises/nrpe/issues/151#issuecomment-316031882, or mute the thread https://github.com/notifications/unsubscribe-auth/AABbBOSeYq-PtxCboL291Ex3f313HgKiks5sPJJQgaJpZM4OZes6 .

--

-- Mayuresh

ericloyd commented 7 years ago

I should have said "it should not." I haven't actually looked at the code, but the NRPE daemon itself should have no reason to try to translate "nrpe" to "5666" unless it's trying to communicate with itself using the service name "nrpe." Which I doubt, since the port number is right there in the configuration file if it wants to use it.

box293 commented 6 years ago

I wanted to clarify that an entry in /etc/services is required for xinetd to correctly function. If this entry does not exist then then xinetd does not provide nrpe as a functioning open port. I was testing NRPE on a custom tcp port using xinetd and I went down a troubleshooting rabbithole to discover this.

hedenface commented 6 years ago

Oh. Did I mention we got IANA approved - this is our service officially now?

https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?&page=94