Two unrelated questions: NRPE port and a plugin issue
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Two unrelated questions: NRPE port and a plugin issue
Ok, so I have 2 unrelated questions, but didn't want to create 2 separate posts for them. If I should do that instead, just let me know.
First question: we have an app here that uses port 5666, so we need to change all of our nrpe.cfg files to a different port on our unix hosts. Since it appears that our windows hosts are all using port 12489, I figured I would just change it to that. So I know how to change it in nrpe.cfg on the hosts, but where would I change this on the nagios server? I assume it would need to be changed somewhere, but I have no idea where.
Second question: I tried running the Solaris monitoring wizard to add a service check for a specific process and I got this: NRPE: Command 'check_init_service' not defined. So I checked the nrpe.cfg and sure enough there's no command definition for check_init_service, which is what the wizard puts in for a command. I also checked the plugins folder and there's a lot of plugins in there, but I don't know if any of them are the right one. So the question is, which plugin does the Solaris Monitoring wizard look for when looking for stats on a specific process?
First question: we have an app here that uses port 5666, so we need to change all of our nrpe.cfg files to a different port on our unix hosts. Since it appears that our windows hosts are all using port 12489, I figured I would just change it to that. So I know how to change it in nrpe.cfg on the hosts, but where would I change this on the nagios server? I assume it would need to be changed somewhere, but I have no idea where.
Second question: I tried running the Solaris monitoring wizard to add a service check for a specific process and I got this: NRPE: Command 'check_init_service' not defined. So I checked the nrpe.cfg and sure enough there's no command definition for check_init_service, which is what the wizard puts in for a command. I also checked the plugins folder and there's a lot of plugins in there, but I don't know if any of them are the right one. So the question is, which plugin does the Solaris Monitoring wizard look for when looking for stats on a specific process?
Re: Two unrelated questions: NRPE port and a plugin issue
If you are using xinet, you can change the port in the "/etc/xinetd.d/nrpe" file from:First question: we have an app here that uses port 5666, so we need to change all of our nrpe.cfg files to a different port on our unix hosts. Since it appears that our windows hosts are all using port 12489, I figured I would just change it to that. So I know how to change it in nrpe.cfg on the hosts, but where would I change this on the nagios server? I assume it would need to be changed somewhere, but I have no idea where.
Code: Select all
port = 5666Code: Select all
port = <your new port>Code: Select all
service xinetd restartIf you are using NRPE as a standalone daemon, you will have to modify the "server_port= " line in the nrpe.cfg file and restart the service.
Your windows hosts are probably NOT using 12489 port with check_nrpe. It is used with check_nt. I would NOT recommend using 12489. Try using a different port.
How did you install the linux agent on the client? Did you use our installer?Second question: I tried running the Solaris monitoring wizard to add a service check for a specific process and I got this: NRPE: Command 'check_init_service' not defined. So I checked the nrpe.cfg and sure enough there's no command definition for check_init_service, which is what the wizard puts in for a command. I also checked the plugins folder and there's a lot of plugins in there, but I don't know if any of them are the right one. So the question is, which plugin does the Solaris Monitoring wizard look for when looking for stats on a specific process?
http://assets.nagios.com/downloads/nagi ... _Agent.pdf
If you did, you should have a file named "common.cfg". The "check_init_service" is defined in it:
Code: Select all
command[check_init_service]=/opt/nagios/libexec/check_init_service $ARG1$Be sure to check out our Knowledgebase for helpful articles and solutions!
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: Two unrelated questions: NRPE port and a plugin issue
Ok, I will look at that for the port change, thank you. I'm assuming the "/etc/xinetd.d/nrpe" change is for the Nagios server and the "modify the "server_port= " line in the nrpe.cfg file and restart the service" change is done on the monitored host correct?
Our windows hosts aren't using nrpe, they're using nsclient++ so that's why I thought it was using port 12489. As for the unix hosts using nrpe, I'll pick a different port somewhere up there in the 12,000s for those.
I was brought in to this project after nagios was installed and after nrpe had been setup, but I do not believe it was installed using that process. I think there was some sort of incompatibility with our solaris boxes that wouldn't allow us to use that install process. All of our Unix servers have the nagios agent installed in a /vendor/nagios directory, so maybe that's why it was done that way? I'm not exactly sure, but the consultant we had install it was recently diagnosed with thyroid cancer, so he's helpful but sparingly (for good reason). I'm going through our nrpe.cfg file now trying to modify it so that it will accept inputs from the wizard and I have everything working except for this one check. It appears that he had just hard coded some commands in for Mem, CPU, Root, and Swap checks and then left it at that, so running the wizard didn't work on anything until I went through and modified the nrpe.cfg file. I'm kind of learning on the fly here...heh.
Our windows hosts aren't using nrpe, they're using nsclient++ so that's why I thought it was using port 12489. As for the unix hosts using nrpe, I'll pick a different port somewhere up there in the 12,000s for those.
I was brought in to this project after nagios was installed and after nrpe had been setup, but I do not believe it was installed using that process. I think there was some sort of incompatibility with our solaris boxes that wouldn't allow us to use that install process. All of our Unix servers have the nagios agent installed in a /vendor/nagios directory, so maybe that's why it was done that way? I'm not exactly sure, but the consultant we had install it was recently diagnosed with thyroid cancer, so he's helpful but sparingly (for good reason). I'm going through our nrpe.cfg file now trying to modify it so that it will accept inputs from the wizard and I have everything working except for this one check. It appears that he had just hard coded some commands in for Mem, CPU, Root, and Swap checks and then left it at that, so running the wizard didn't work on anything until I went through and modified the nrpe.cfg file. I'm kind of learning on the fly here...heh.
Re: Two unrelated questions: NRPE port and a plugin issue
If you don't have the common.cfg, most probably you haven't used our installer. That's OK - you can define this command in the nrpe.cfg:
Test the command on the Nagios XI server from the CLI:
Code: Select all
command[check_init_service]=/opt/nagios/libexec/check_init_service $ARG1$Code: Select all
/usr/local/nagios/libexec/check_nrpe -H <client ip> -c check_init_service -a <your service>Be sure to check out our Knowledgebase for helpful articles and solutions!
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: Two unrelated questions: NRPE port and a plugin issue
Yeah, we don't have the common.cfg file. And the problem with adding that to our nrpe.cfg file, is that our plugins aren't in that directory (/opt/nagios/libexec/) and the directory our plugins are in doesn't have that script.
Where our plugins are stored on our Unix servers is here: /opt/csw/libexec/nagios-plugins/
Where our plugins are stored on our Unix servers is here: /opt/csw/libexec/nagios-plugins/
Code: Select all
kenapps11g$ ls /opt/csw/libexec/nagios-plugins/
check_apt check_http check_mrtgtraf check_pgsql check_time
check_breeze check_icmp check_mysql check_ping check_udp
check_by_ssh check_ifoperstatus check_mysql_query check_pop check_ups
check_clamd check_ifstatus check_nagios check_procs check_users
check_cluster check_imap check_nntp check_real check_wave
check_dhcp check_ircd check_nntps check_rpc check_zone_cpu.sh
check_dig check_jabber check_nrpe check_sensors check_zone_mem.sh
check_disk check_ldap check_nrpe_1k check_simap check_zpool_fs
check_disk_smb check_ldaps check_nrpe_8k check_smtp negate
check_dns check_load check_nt check_snmp pst3
check_dummy check_log check_ntp check_solaris_cpu_usage.sh urlize
check_file_age check_mailq check_ntp_peer check_spop utils.pm
check_flexlm check_mem.pl check_ntp_time check_ssh utils.sh
check_fping check_mem.pl.megabyte check_nwstat check_ssmtp
check_ftp check_mem.pl.orig check_oracle check_swap
check_hpjd check_mrtg check_overcr check_tcp
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: Two unrelated questions: NRPE port and a plugin issue
Is this the check_init_services script that Nagios is looking for when it creates this service check?
https://github.com/bryanwb/chef-nagios/ ... it_service
https://github.com/bryanwb/chef-nagios/ ... it_service
Re: Two unrelated questions: NRPE port and a plugin issue
It doesn't seem you have this plugin. You can create a new file in your plugins directory:
Copy and paste the following text:
Set the permissions:
Then you can set up your command in the nrpe.cfg:
Code: Select all
cd /opt/csw/libexec/nagios-plugins
vi check_init_serviceCode: Select all
#!/bin/sh
PROGNAME=`basename $0`
print_usage() {
echo "Usage: $PROGNAME"
}
print_help() {
echo ""
print_usage
echo ""
echo "This plugin checks the status of services normally started by the init process."
echo ""
support
exit 0
}
case "$1" in
--help)
print_help
exit 0
;;
-h)
print_help
exit 0
;;
*)
if [ $# -eq 1 ]; then
/sbin/service $1 status
ret=$?
case "$ret" in
0)
exit $ret
;;
*)
exit 2
;;
esac
else
echo "ERROR: No service name specified on command line"
exit 3
fi
;;
esacCode: Select all
chown root:nagios check_init_service
chmod 755 check_init_service
chmod u+s check_init_serviceCode: Select all
command[check_init_service]=/opt/csw/libexec/nagios-plugins/check_init_service $ARG1$Be sure to check out our Knowledgebase for helpful articles and solutions!
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: Two unrelated questions: NRPE port and a plugin issue
K, we did that and retried running the script. We got an error when trying to read /sbin/services. Did some looking with one of our Unix admins and it looks like /sbin/services is a linux directory. Our boxes are solaris, and /sbin/services doesn't exist. The Unix equivalent seems to be /etc/services, so we changed the script to reflect that. Running the script (from the client, not the nagios server) again we get this:
Looking at the script again, it appears the script is trying to execute something in /sbin/services. I'm not sure what it's trying to execute or if whatever it's trying to execute exists in /etc/services in Solaris. This script appears to be for linux, not unix. Is there anyway to modify this to make it work with unix, or is there another script we should use?
Code: Select all
kenapps11g$ ./check_init_service SSH
/dev/fd/3: /etc/services: cannot execute
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Two unrelated questions: NRPE port and a plugin issue
Well, if you just changed the: to it would be executing /etc/service SSH status, which I think you mentioned is actually a directory? Do you maybe want to use instead? That would be standard linux services without the service command, so it still might be different for solaris, sorry I don't have one around to test on.
Code: Select all
/sbin/service $1 statusCode: Select all
/etc/service $1 statusCode: Select all
/etc/init.d/$1 statusNagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: Two unrelated questions: NRPE port and a plugin issue
/etc/service is not a directory, I miss-read the email that the Unix admin sent me. He says it's not a directory, but it's not an executable file either. This file basically just gives names to ports. If I run a netstat command instead of showing me port 22, it shows me ssh for example. Are there any plugins that can check the output of a 'ps' command and use that to see if a process is running? The only ones I've found that use 'ps' need to read PID numbers or PID files, but that won't work for us because if the service is restarted it gets a different PID number (from what I understand), and some of our processes don't create PID files.