Re: [Nagios-users] problem with newly created checkcommandandservice

2011-11-23 Thread Kaplan, Andrew H.
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:c...@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  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   
check_period24x7
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. 
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=
--username= --password= --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  -d 
 
has the following definition in the services.cfg file:
 
define service {
service_description   Check NIS Service
check_command  check_nis_server!
host_name 
check_period  24x7
notification_period   24x7
contact_groupslinux-admins 

event_handler_enabled 0
active_checks_enabled 1
passive_checks_enabled0
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:c...@claudiokuenzler.com] 
Sent: Wednesday, November 23, 2011 2:26 AM
To: Nagios Users List
Subject: Re: [Nagios-users] problem with newly created checkcommand
andservice

 

Re: [Nagios-users] problem with newly created checkcommand andservice

2011-11-23 Thread Claudio Kuenzler
Did you replace the $ARGX$ options by  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   
check_period24x7
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. wrote:

> **
> Hi there --
>
> The command definition for database_connection-time is the following:
>
> define command {
> command_namedatabase
> _connection-time
> command_line
> /usr/local/nagios/libexec/check_mssql_health --server=--username=
>  --password= --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  -d 
>
> has the following definition in the services.cfg file:
>
> define service {
> service_description   Check NIS Service
> check_command  check_nis_server!
> host_name 
> check_period  24x7
> notification_period   24x7
> contact_groupslinux-admins
>
> event_handler_enabled 0
> active_checks_enabled 1
> passive_checks_enabled0
> 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:c...@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. 
> 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=
>> --username= --password= --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:
>>
>> d

Re: [Nagios-users] problem with newly created checkcommand andservice

2011-11-23 Thread Kaplan, Andrew H.
Hi there --
 
The command definition for database_connection-time is the following:
 
define command {
command_namedatabase_connection-time
command_line
/usr/local/nagios/libexec/check_mssql_health --server=
--username= --password= --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  -d 
 
has the following definition in the services.cfg file:
 
define service {
service_description   Check NIS Service
check_command  check_nis_server!
host_name 
check_period  24x7
notification_period   24x7
contact_groupslinux-admins
event_handler_enabled 0
active_checks_enabled 1
passive_checks_enabled0
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:c...@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. 
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=
--username= --password= --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   
check_period24x7
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 '_connection-time'
specified in service 'Database Connection Time' for host '' 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