Page 1 of 1

Custom monitoring using Nagios

Posted: Tue Oct 06, 2020 8:58 am
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
}

Re: Custom monitoring using Nagios

Posted: Tue Oct 06, 2020 1:12 pm
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.

Re: Custom monitoring using Nagios

Posted: Mon Oct 19, 2020 11:22 am
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.

Re: Custom monitoring using Nagios

Posted: Wed Oct 21, 2020 4:34 pm
by benjaminsmith
@snapier3 and @gormank Thanks!

@ kgopiramesh_25 Did you get it working? Let us know.