<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19154"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial>Hi there --</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial>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 </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial>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.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial>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,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial>and that solved the problem.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=989533416-23112011><FONT color=#0000ff
size=2 face=Arial>Thanks for the help in any event. </FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B> Claudio Kuenzler
[mailto:ck@claudiokuenzler.com] <BR><B>Sent:</B> Wednesday, November 23, 2011
10:22 AM<BR><B>To:</B> Nagios Users List<BR><B>Subject:</B> Re: [Nagios-users]
problem with newly created checkcommandandservice<BR></FONT><BR></DIV>
<DIV></DIV>Did you replace the $ARGX$ options by <database> etc or did you
really write them like this?<BR><BR><BR>The command definition should look like
this:<BR><BR><FONT
style="FONT-FAMILY: courier new,monospace; COLOR: rgb(51,51,255)" color=#0000ff
size=2 face=Arial>define command
{<BR>
command_name
<SPAN></SPAN><SPAN>database</SPAN>_connection-time<BR>
command_line
/usr/local/nagios/libexec/check_mssql_health --server=<SPAN>$HOSTADDRESS$</SPAN>
--username=$ARG1$<SPAN></SPAN> --password=<SPAN>$ARG2$</SPAN>
--port=<SPAN>$ARG3$</SPAN> --mode=connection-time</FONT><BR
style="FONT-FAMILY: courier new,monospace; COLOR: rgb(51,51,255)"><SPAN
style="FONT-FAMILY: courier new,monospace; COLOR: rgb(51,51,255)">}</SPAN><BR><BR><BR>And
the service should then pass the arguments to the command:<BR><BR><FONT
color=#0000ff size=2 face=Arial><SPAN></SPAN></FONT><FONT
style="FONT-FAMILY: courier new,monospace; COLOR: rgb(51,51,255)" size=2
face=Arial>define service {<BR>service_description
Database Connection
Time<BR>check_command
database_connection-time!username!mypasswd!1433<BR>host_name
<database
server><BR>check_period
24x7<BR>contact_groups
nt-admins,linux-admins,admins<BR>event_handler_enabled
0<BR>active_checks_enabled
1<BR>passive_checks_enabled
0<BR>notifications_enabled
1<BR>check_freshness
0<BR>freshness_threshold
86400<BR>use
generic-service<BR>}</FONT><BR><BR>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$).<BR><BR>
<DIV class=gmail_quote>On Wed, Nov 23, 2011 at 2:35 PM, Kaplan, Andrew H. <SPAN
dir=ltr><<A
href="mailto:AHKAPLAN@partners.org">AHKAPLAN@partners.org</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><U></U>
<DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2 face=Arial>Hi there
--</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2 face=Arial>The
command definition for database_connection-time is the
following:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial>define command
{<BR>
command_name <SPAN> </SPAN><SPAN>database</SPAN>_connection-time<BR>
command_line
/usr/local/nagios/libexec/check_mssql_health
--server=<SPAN><database></SPAN>
--username=<SPAN><username></SPAN>
--password=<SPAN><password></SPAN> --port=<SPAN><port></SPAN>
--mode=connection-time</FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN><FONT color=#0000ff size=2 face=Arial>There are arguments that are
passed to the command. I did not remove the exclamation point due to another
command that also has </FONT></SPAN></DIV>
<DIV><SPAN><FONT color=#0000ff size=2 face=Arial>arguments passed to it. For
example:</FONT></SPAN></DIV>
<DIV><SPAN><FONT color=#0000ff size=2 face=Arial></FONT></SPAN> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial>define command
{<BR>
command_name check_nis_server<SPAN></SPAN><BR>
command_line
/usr/local/nagios/libexec/check_nis -H <SPAN><server></SPAN>
-d <domainname></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>has the following definition
in the services.cfg file:</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>define service
{<BR>
service_description
Check NIS
Service<BR>
check_command check_nis_server!<BR>
host_name <server><BR>
check_period
24x7<BR>
notification_period
24x7<BR>
contact_groups
linux-admins
<DIV
class=im><BR>
event_handler_enabled
0<BR>
active_checks_enabled
1<BR>
passive_checks_enabled
0<BR>
notifications_enabled
1<BR>
check_freshness
0<BR>
freshness_threshold
86400<BR>
use
generic-service</DIV></SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>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</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>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</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>used to generate new files, a
checkcommands.cfg file was among the them. </SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>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
</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>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.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN>What do you
think?</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN></SPAN></FONT> </DIV>
<DIV><BR></DIV>
<DIV><FONT face=Arial><BR><FONT color=#0000ff size=2></FONT></FONT></DIV>
<DIV><SPAN><FONT color=#0000ff size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff size=2
face=Arial></FONT></SPAN> </DIV><BR>
<DIV dir=ltr lang=en-us align=left>
<HR>
<FONT size=2 face=Tahoma><B>From:</B> Claudio Kuenzler [mailto:<A
href="mailto:ck@claudiokuenzler.com" target=_blank>ck@claudiokuenzler.com</A>]
<BR><B>Sent:</B> Wednesday, November 23, 2011 2:26 AM<BR><B>To:</B> Nagios
Users List<BR><B>Subject:</B> Re: [Nagios-users] problem with newly created
checkcommand andservice<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<DIV></DIV><FONT size=2><FONT face=Arial>Hi,<BR><BR>Please show the command
definition of database_connection-time.<BR><BR>Furthermore in the service
definition you use the following line:<BR><BR></FONT></FONT><FONT size=2
face=Arial><SPAN style="FONT-FAMILY: courier new,monospace">check_command
database_connection-time!</SPAN><BR><BR>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.<BR></FONT><FONT size=2 face=Arial></FONT><BR>
<DIV class=gmail_quote>On Tue, Nov 22, 2011 at 7:29 PM, Kaplan, Andrew H.
<SPAN dir=ltr><<A href="mailto:AHKAPLAN@partners.org"
target=_blank>AHKAPLAN@partners.org</A>></SPAN> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><U></U>
<DIV>
<P><FONT size=2 face=Arial>Hi there --<BR><BR>I am going through the motions
of adding a new checkcommand, and service to the Nagios server. The command
involves </FONT><BR><FONT size=2 face=Arial>the check_mssql_health plugin
which runs on the Nagios server. The plugin gets in information via queries
to a particular </FONT></P>
<P><FONT size=2 face=Arial>port on the Microsoft SQL server. Here are its
particulars: </FONT></P>
<P><B><FONT size=2 face=Arial>/usr/local/nagios/libexec/check_mssql_health
--server=<database server> --username=<username>
--password=<password> --port=<port>
--mode=connection-time</FONT></B> </P>
<P><FONT size=2 face=Arial>The name of the checkcommand is:</FONT><B> <FONT
size=2 face=Arial>database_connection-time<BR></FONT></B><BR><FONT size=2
face=Arial>Once the checkcommand was created, so was the service. The
configuration of the service in question, taken from the </FONT><BR><FONT
size=2 face=Arial>services.cfg file, is shown below:<BR><BR>define service
{<BR>service_description
Database Connection
Time<BR>check_command
database_connection-time!<BR>host_name
<database
server><BR>check_period
24x7<BR>contact_groups
nt-admins,linux-admins,admins<BR>event_handler_enabled
0<BR>active_checks_enabled
1<BR>passive_checks_enabled
0<BR>notifications_enabled
1<BR>check_freshness
0<BR>freshness_threshold
86400<BR>use
generic-service<BR>}<BR><BR>To
verify the new configuration would work, the command:</FONT> </P>
<P><B><FONT size=2 face=Arial>/usr/local/nagios/bin/nagios -v
/usr/local/nagios/etc/nagios.cfg</FONT></B><BR><BR><FONT size=2
face=Arial>was run to verify the configuration. It was here the error
message: </FONT></P>
<UL>
<P><B><FONT size=2 face=Arial>Checking services...<BR>Error: Service check
command '<database>_connection-time' specified in service 'Database
Connection Time' for host '<database server>' not defined
anywhere!</FONT></B></P></UL>
<P><FONT size=2 face=Arial>I verified the syntax of the command in the
checkcommands.cfg file, including the name given to the command. Why would
Nagios </FONT></P>
<P><FONT size=2 face=Arial>think the service check command is not defined,
and return this error? </FONT></P><BR><BR><FONT face=monospace><BR><BR>The
information in this e-mail is intended only for the person to whom it
is<BR>addressed. If you believe this e-mail was sent to you in error and the
e-mail<BR>contains patient information, please contact the Partners
Compliance HelpLine at<BR><A href="http://www.partners.org/complianceline"
target=_blank>http://www.partners.org/complianceline</A> . If the e-mail was
sent to you in error<BR>but does not contain patient information, please
contact the sender and properly<BR>dispose of the
e-mail.</FONT></DIV><BR>------------------------------------------------------------------------------<BR>All
the data continuously generated in your IT infrastructure<BR>contains a
definitive record of customers, application performance,<BR>security
threats, fraudulent activity, and more. Splunk takes this<BR>data and makes
sense of it. IT sense. And common sense.<BR><A
href="http://p.sf.net/sfu/splunk-novd2d"
target=_blank>http://p.sf.net/sfu/splunk-novd2d</A><BR>_______________________________________________<BR>Nagios-users
mailing list<BR><A href="mailto:Nagios-users@lists.sourceforge.net"
target=_blank>Nagios-users@lists.sourceforge.net</A><BR><A
href="https://lists.sourceforge.net/lists/listinfo/nagios-users"
target=_blank>https://lists.sourceforge.net/lists/listinfo/nagios-users</A><BR>:::
Please include Nagios version, plugin version (-v) and OS when reporting any
issue.<BR>::: Messages without supporting info will risk being sent to
/dev/null<BR></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV><BR>------------------------------------------------------------------------------<BR>All
the data continuously generated in your IT infrastructure<BR>contains a
definitive record of customers, application performance,<BR>security threats,
fraudulent activity, and more. Splunk takes this<BR>data and makes sense of
it. IT sense. And common sense.<BR><A href="http://p.sf.net/sfu/splunk-novd2d"
target=_blank>http://p.sf.net/sfu/splunk-novd2d</A><BR>_______________________________________________<BR>Nagios-users
mailing list<BR><A
href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</A><BR><A
href="https://lists.sourceforge.net/lists/listinfo/nagios-users"
target=_blank>https://lists.sourceforge.net/lists/listinfo/nagios-users</A><BR>:::
Please include Nagios version, plugin version (-v) and OS when reporting any
issue.<BR>::: Messages without supporting info will risk being sent to
/dev/null<BR></BLOCKQUOTE></DIV><BR></BODY></HTML>