errors in config - CHECK_PGACTIVITY plugin
errors in config - CHECK_PGACTIVITY plugin
How do I integrate plugin CHECK_PGACTIVITY to Nagios?
Getting this error after restart of nagios
Checking services...
Error: Service check command 'check_pgactivity -s backends -w 80 -c 95' specified in service 'check_pgactivity' for host 'pgtest-db' not defined anywhere!
I have entered this in /etc/nagios3/objects/command.cfg
define command {
command_name check_pgactivity
command_line $USER1$/check_pgactivity -h $HOSTADDRESS$
register 1
}
And this in /etc/nagios3/objects/services/check_pgactivity.cfg
define service {
host_name pgtest-db
service_description check_pgactivity
check_command check_pgactivity -s backends -w 80 -c 95
max_check_attempts 3
check_interval 3
retry_interval 3
check_period 24x7
notification_interval 5
notification_period 24x7
contacts wolf
contact_groups db-group
register 1
}
Getting this error after restart of nagios
Checking services...
Error: Service check command 'check_pgactivity -s backends -w 80 -c 95' specified in service 'check_pgactivity' for host 'pgtest-db' not defined anywhere!
I have entered this in /etc/nagios3/objects/command.cfg
define command {
command_name check_pgactivity
command_line $USER1$/check_pgactivity -h $HOSTADDRESS$
register 1
}
And this in /etc/nagios3/objects/services/check_pgactivity.cfg
define service {
host_name pgtest-db
service_description check_pgactivity
check_command check_pgactivity -s backends -w 80 -c 95
max_check_attempts 3
check_interval 3
retry_interval 3
check_period 24x7
notification_interval 5
notification_period 24x7
contacts wolf
contact_groups db-group
register 1
}
Re: errors in config - CHECK_PGACTIVITY plugin
You'll need to make a few changes to this -
Add $ARG1$ after $HOSTADDRESS$ -
and for this one, the argument needs to be seperated. $ARG1$ will be equal to -s backends -w 80 -c 95 -
Add $ARG1$ after $HOSTADDRESS$ -
Code: Select all
I have entered this in /etc/nagios3/objects/command.cfg
define command {
command_name check_pgactivity
command_line $USER1$/check_pgactivity -h $HOSTADDRESS$ $ARG1$
register 1
}
Code: Select all
define service {
host_name pgtest-db
service_description check_pgactivity
check_command check_pgactivity!-s backends -w 80 -c 95
max_check_attempts 3
check_interval 3
retry_interval 3
check_period 24x7
notification_interval 5
notification_period 24x7
contacts wolf
contact_groups db-group
register 1
}
Former Nagios Employee
Re: errors in config - CHECK_PGACTIVITY plugin
That fixed it - thanks
Re: errors in config - CHECK_PGACTIVITY plugin
Sorry the restart worked but in Nagios under the Services it shows (Service check did not exit properly)
Re: errors in config - CHECK_PGACTIVITY plugin
Can you run the command over command line and post the result?
Former Nagios Employee
Re: errors in config - CHECK_PGACTIVITY plugin
It works from the command line but errors on monitoring output of Nagios
~# check_pgactivity -h pgtest-db -s backends -w 80% -c 95%
POSTGRES_BACKENDS OK: 2 connections on 297 | postgres=1;237;282;0;297 nagios=0;237;282;0;297 phppgadmin=0;237;282;0;297 repmgrdb=0;237;282;0;297 opm=0;237;282;0;297 test4=0;237;282;0;297 template1=1;237;282;0;297 ima=0;237;282;0;297 test2=0;237;282;0;297 test1=0;237;282;0;297 test3=0;237;282;0;297 maximum_connections=297;237;282;0;297
~# check_pgactivity -h pgtest-db -s backends -w 80% -c 95%
POSTGRES_BACKENDS OK: 2 connections on 297 | postgres=1;237;282;0;297 nagios=0;237;282;0;297 phppgadmin=0;237;282;0;297 repmgrdb=0;237;282;0;297 opm=0;237;282;0;297 test4=0;237;282;0;297 template1=1;237;282;0;297 ima=0;237;282;0;297 test2=0;237;282;0;297 test1=0;237;282;0;297 test3=0;237;282;0;297 maximum_connections=297;237;282;0;297
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: errors in config - CHECK_PGACTIVITY plugin
Can you run it as the nagios user please:
The monitoring engine executes all plugins as this account.
Code: Select all
su nagios
check_pgactivity -h pgtest-db -s backends -w 80% -c 95%As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: errors in config - CHECK_PGACTIVITY plugin
root@montwo:~# su - nagios
nagios@montwo:~$ check_pgactivity -h pgtest-db -s backends -w 80% -c 95%
POSTGRES_BACKENDS OK: 2 connections on 297 | postgres=1;237;282;0;297 nagios=0;237;282;0;297 phppgadmin=0;237;282;0;297 repmgrdb=0;237;282;0;297 opm=0;237;282;0;297 test4=0;237;282;0;297 template1=1;237;282;0;297 ima=0;237;282;0;297 test2=0;237;282;0;297 test1=0;237;282;0;297 test3=0;237;282;0;297 maximum_connections=297;237;282;0;297
nagios@montwo:~$ check_pgactivity -h pgtest-db -s backends -w 80% -c 95%
POSTGRES_BACKENDS OK: 2 connections on 297 | postgres=1;237;282;0;297 nagios=0;237;282;0;297 phppgadmin=0;237;282;0;297 repmgrdb=0;237;282;0;297 opm=0;237;282;0;297 test4=0;237;282;0;297 template1=1;237;282;0;297 ima=0;237;282;0;297 test2=0;237;282;0;297 test1=0;237;282;0;297 test3=0;237;282;0;297 maximum_connections=297;237;282;0;297
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: errors in config - CHECK_PGACTIVITY plugin
I think I found the problem. In the service we updated, the -w and -c values do not have a % sign. This should work:
Code: Select all
define service {
host_name pgtest-db
service_description check_pgactivity
check_command check_pgactivity!-s backends -w 80% -c 95%
max_check_attempts 3
check_interval 3
retry_interval 3
check_period 24x7
notification_interval 5
notification_period 24x7
contacts wolf
contact_groups db-group
register 1
}As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: errors in config - CHECK_PGACTIVITY plugin
The command works with or without % I changed it the .cfg file but still the same error
Here is the output without % from the command line
nagios@montwo:~$ check_pgactivity -h pgtest-db -s backends -w 80 -c 95
POSTGRES_BACKENDS OK: 2 connections on 297 | postgres=1;80;95;0;297 nagios=0;80;95;0;297 phppgadmin=0;80;95;0;297 repmgrdb=0;80;95;0;297 opm=0;80;95;0;297 test4=0;80;95;0;297 template1=1;80;95;0;297 ima=0;80;95;0;297 test2=0;80;95;0;297 test1=0;80;95;0;297 test3=0;80;95;0;297
Here is the output without % from the command line
nagios@montwo:~$ check_pgactivity -h pgtest-db -s backends -w 80 -c 95
POSTGRES_BACKENDS OK: 2 connections on 297 | postgres=1;80;95;0;297 nagios=0;80;95;0;297 phppgadmin=0;80;95;0;297 repmgrdb=0;80;95;0;297 opm=0;80;95;0;297 test4=0;80;95;0;297 template1=1;80;95;0;297 ima=0;80;95;0;297 test2=0;80;95;0;297 test1=0;80;95;0;297 test3=0;80;95;0;297