Custom monitoring using Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kgopiramesh_25
Posts: 2
Joined: Fri Sep 04, 2020 10:16 am

Custom monitoring using Nagios

Post by kgopiramesh_25 »

Hi everyone,

We have created custom monitor and it will take host name / IP address as argument and while running manually it is working fine but when configuring as service, it is throwing error and Nagios is not getting started. PFB details.

command definition :

define command {

command_name check_proc_count
command_line /usr/local/nagios/libexec/check_proc_count_nt $ARG1$
}

service definition :

define service {
use generic-service
host_name testhost
service_description testing
check_command check_proc_count testhost
}
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Custom monitoring using Nagios

Post by gormank »

Nagios runs checks as the nagios user by default so when running manually you want to do so as nagios.
It would help if we could see output of the check run manually on the test host and via nrpe/ncpa from the nagios host, including the command prompt and command.
snapier3
Posts: 144
Joined: Tue Apr 23, 2019 7:12 pm

Re: Custom monitoring using Nagios

Post by snapier3 »

Make sure the file is executable and owned by the nagios user.
"chmod +x yourscript.sh'
"chown nagios:nagios yourscript.sh"

When testing on the system you will want to run this as the nagios user.
"su nagios"

Now you will execute the command
"./yourscript.sh arg"

If the script functions properly you will receive 1 line of output on the console.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Custom monitoring using Nagios

Post by benjaminsmith »

@snapier3 and @gormank Thanks!

@ kgopiramesh_25 Did you get it working? Let us know.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked