problem with newly created checkcommandandservice
Kaplan, Andrew H.
AHKAPLAN at PARTNERS.ORG
Wed Nov 23 17:38:14 CET 2011
Hi there --
I found the answer to the problem. Working in conjunction with you and another
colleague, I noticed the checkcommands.cfg and commands.cfg files were both
present
in the objects directory. Additionally the two files were found to have the same
command syntax with the exception of the former having the command reference in
it.
I then checked the nagios.cfg file, and there was a line referring to
commands.cfg but not the checkcommands.cfg file. I changed the reference to
point to the latter file,
and that solved the problem.
Thanks for the help in any event.
________________________________
From: Claudio Kuenzler [mailto:ck at claudiokuenzler.com]
Sent: Wednesday, November 23, 2011 10:22 AM
To: Nagios Users List
Subject: Re: [Nagios-users] problem with newly created checkcommandandservice
Did you replace the $ARGX$ options by <database> etc or did you really write
them like this?
The command definition should look like this:
define command {
command_name database_connection-time
command_line /usr/local/nagios/libexec/check_mssql_health
--server=$HOSTADDRESS$ --username=$ARG1$ --password=$ARG2$ --port=$ARG3$
--mode=connection-time
}
And the service should then pass the arguments to the command:
define service {
service_description Database Connection Time
check_command database_connection-time!username!mypasswd!1433
host_name <database server>
check_period 24x7
contact_groups nt-admins,linux-admins,admins
event_handler_enabled 0
active_checks_enabled 1
passive_checks_enabled 0
notifications_enabled 1
check_freshness 0
freshness_threshold 86400
use generic-service
}
With this you're passing three arguments to the command (username, password and
port). The value for --server is automatically using the IP-Address (or DNS
name) of your defined host ($HOSTADDRESS$).
On Wed, Nov 23, 2011 at 2:35 PM, Kaplan, Andrew H. <AHKAPLAN at partners.org>
wrote:
Hi there --
The command definition for database_connection-time is the following:
define command {
command_name
database_connection-time
command_line
/usr/local/nagios/libexec/check_mssql_health --server=<database>
--username=<username> --password=<password> --port=<port> --mode=connection-time
There are arguments that are passed to the command. I did not remove the
exclamation point due to another command that also has
arguments passed to it. For example:
define command {
command_name check_nis_server
command_line
/usr/local/nagios/libexec/check_nis -H <server> -d <domainname>
has the following definition in the services.cfg file:
define service {
service_description Check NIS Service
check_command check_nis_server!
host_name <server>
check_period 24x7
notification_period 24x7
contact_groups linux-admins
event_handler_enabled 0
active_checks_enabled 1
passive_checks_enabled 0
notifications_enabled 1
check_freshness 0
freshness_threshold 86400
use generic-service
One thing I came across so far. I had imported the configuration files
into the NConf utility database of the Nagios server. Among the files that were
imported was the
commands.cfg file. During the importation process, the commands.cfg file
data was imported into a field called checkcommands. When the NConf utility was
subsequently
used to generate new files, a checkcommands.cfg file was among the them.
This file, along with the original commands.cfg file, is located in the
/usr/local/nagios/etc/objects directory. However, the nagios.cfg file does not
reference it. One idea that
I had was to remove the reference within nagios.cfg to commands.cfg, and
replace it with a reference to checkcommands.cfg, and see what are the results.
What do you think?
________________________________
From: Claudio Kuenzler [mailto:ck at claudiokuenzler.com]
Sent: Wednesday, November 23, 2011 2:26 AM
To: Nagios Users List
Subject: Re: [Nagios-users] problem with newly created checkcommand
andservice
Hi,
Please show the command definition of database_connection-time.
Furthermore in the service definition you use the following line:
check_command database_connection-time!
Didn't you want to pass arguments to the command? If they're already
hardcoded in the command definition you can leave the exclamation mark off.
On Tue, Nov 22, 2011 at 7:29 PM, Kaplan, Andrew H.
<AHKAPLAN at partners.org> wrote:
Hi there --
I am going through the motions of adding a new checkcommand, and
service to the Nagios server. The command involves
the check_mssql_health plugin which runs on the Nagios server.
The plugin gets in information via queries to a particular
port on the Microsoft SQL server. Here are its particulars:
/usr/local/nagios/libexec/check_mssql_health --server=<database
server> --username=<username> --password=<password> --port=<port>
--mode=connection-time
The name of the checkcommand is: database_connection-time
Once the checkcommand was created, so was the service. The
configuration of the service in question, taken from the
services.cfg file, is shown below:
define service {
service_description Database Connection Time
check_command database_connection-time!
host_name <database server>
check_period 24x7
contact_groups
nt-admins,linux-admins,admins
event_handler_enabled 0
active_checks_enabled 1
passive_checks_enabled 0
notifications_enabled 1
check_freshness 0
freshness_threshold 86400
use generic-service
}
To verify the new configuration would work, the command:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
was run to verify the configuration. It was here the error
message:
Checking services...
Error: Service check command
'<database>_connection-time' specified in service 'Database Connection Time' for
host '<database server>' not defined anywhere!
I verified the syntax of the command in the checkcommands.cfg
file, including the name given to the command. Why would Nagios
think the service check command is not defined, and return this
error?
The information in this e-mail is intended only for the person
to whom it is
addressed. If you believe this e-mail was sent to you in error
and the e-mail
contains patient information, please contact the Partners
Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent
to you in error
but does not contain patient information, please contact the
sender and properly
dispose of the e-mail.
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application
performance,
security threats, fraudulent activity, and more. Splunk takes
this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS
when reporting any issue.
::: Messages without supporting info will risk being sent to
/dev/null
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20111123/cf5db37f/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list