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="color: rgb(51, 51, 255); font-family: courier new,monospace;" face="Arial" color="#0000ff" size="2">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="color: rgb(51, 51, 255); font-family: courier new,monospace;">
<span style="color: rgb(51, 51, 255); font-family: courier new,monospace;">}</span><br><br><br>And the service should then pass the arguments to the command:<br><br><font face="Arial" color="#0000ff" size="2"><span></span></font><font style="font-family: courier new,monospace; color: rgb(51, 51, 255);" face="Arial" size="2">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 class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>
<div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">Hi there --</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2">The command definition for database_connection-time is the
following:</font></span></div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div><font face="Arial" color="#0000ff" size="2">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 face="Arial" color="#0000ff" size="2"></font> </div>
<div><span><font face="Arial" color="#0000ff" size="2">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 face="Arial" color="#0000ff" size="2">arguments passed to it. For example:</font></span></div>
<div><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div><font face="Arial" color="#0000ff" size="2">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 face="Arial" color="#0000ff" size="2"></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span>has
the following definition in the services.cfg file:</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><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 face="Arial" color="#0000ff" size="2"><span></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><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 face="Arial" color="#0000ff" size="2"><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 face="Arial" color="#0000ff" size="2"><span>used
to generate new files, a checkcommands.cfg file was among the them.
</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><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 face="Arial" color="#0000ff" size="2"><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 face="Arial" color="#0000ff" size="2"><span></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span>What
do you think?</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span> </span></font></div>
<div><br></div>
<div><font face="Arial"><br><font color="#0000ff" size="2"></font></font></div>
<div><span><font face="Arial" color="#0000ff" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font face="Arial" color="#0000ff" size="2"></font></span> </div><br>
<div dir="ltr" lang="en-us" align="left">
<hr>
<font face="Tahoma" size="2"><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 face="Arial" size="2"><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 face="Arial" size="2"></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 face="Arial" size="2">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 face="Arial" size="2">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 face="Arial" size="2">port on the Microsoft SQL server. Here are its
particulars: </font></p>
<p><b><font face="Arial" size="2">/usr/local/nagios/libexec/check_mssql_health
--server=<database server> --username=<username>
--password=<password> --port=<port>
--mode=connection-time</font></b> </p>
<p><font face="Arial" size="2">The name of the checkcommand is:</font><b> <font face="Arial" size="2">database_connection-time<br></font></b><br><font face="Arial" size="2">Once the checkcommand was created, so was the service. The
configuration of the service in question, taken from the </font><br><font face="Arial" size="2">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 face="Arial" size="2">/usr/local/nagios/bin/nagios -v
/usr/local/nagios/etc/nagios.cfg</font></b><br><br><font face="Arial" size="2">was
run to verify the configuration. It was here the error message: </font></p>
<ul>
<p><b><font face="Arial" size="2">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 face="Arial" size="2">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 face="Arial" size="2">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>