<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal>I need some help understanding the check_cluster plugin,
please.  I’m using version 1.4.13 of the plugins on Nagios 3.10, all
compiled from source on 64-bit CentOS 5.2.  We use VMWare ESX clusters,
and I’d like the hosts in Nagios that happen to be virtual machines to
have one parent instead of a list of parents comprising every ESX host in the
cluster.  Recently, an ESX host was moved from one cluster to another, so
I had to change a lot of parents.  If there’s a better way to
represent VMs and their hosts, I’m open to suggestions too.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>I don’t have any problem running it as the Nagios user
from the command line and feeding it states, like so:<o:p></o:p></p>

<p class=MsoNormal>./check_cluster --host --data=0,0,2,1 --warning=0
--critical=1<o:p></o:p></p>

<p class=MsoNormal>CLUSTER CRITICAL: Host cluster: 2 up, 1 down, 1 unreachable<o:p></o:p></p>

<p class=MsoNormal>./check_cluster --host --data=0,0,0,0 --warning=0
--critical=1<o:p></o:p></p>

<p class=MsoNormal>CLUSTER OK: Host cluster: 4 up, 0 down, 0 unreachable<o:p></o:p></p>

<p class=MsoNormal>./check_cluster --host --data=0,0,0,1 --warning=0
--critical=1<o:p></o:p></p>

<p class=MsoNormal>CLUSTER WARNING: Host cluster: 3 up, 1 down, 0 unreachable<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>Adding --verbose just says “check_cluster - Warning:
start=0 end=0; Critical: start=0 end=1” first.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>However, if I try anything with the $HOSTSTATEID$ macro,
everything is always OK, even if I just make up host names:<o:p></o:p></p>

<p class=MsoNormal>[./check_cluster --host
--data=$HOSTSTATEID:duck$,$HOSTSTATEID:cow$,$HOSTSTATEID:chicken$ --warning=0
--critical=1<o:p></o:p></p>

<p class=MsoNormal>CLUSTER OK: Host cluster: 3 up, 0 down, 0 unreachable<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>I thought maybe macros work better when executed by Nagios,
so I added check_host_cluster command a host with that as its check_command.<o:p></o:p></p>

<p class=MsoNormal>define command {<o:p></o:p></p>

<p class=MsoNormal>       
command_name    check_host_cluster<o:p></o:p></p>

<p class=MsoNormal>       
command_line    $USER1$/check_cluster --host --label=$HOSTNAME$
--warning=$ARG1$ --critical=$ARG2$ --data=$ARG3$<o:p></o:p></p>

<p class=MsoNormal>}<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>define host {<o:p></o:p></p>

<p class=MsoNormal>       
use            
linux-server<o:p></o:p></p>

<p class=MsoNormal>       
host_name       ProductionCluster1<o:p></o:p></p>

<p class=MsoNormal>       
alias           Production
Cluster 1<o:p></o:p></p>

<p class=MsoNormal>       
address         127.0.0.1<o:p></o:p></p>

<p class=MsoNormal>       
parents         gisesx1,gisesx3,gisesx4<o:p></o:p></p>

<p class=MsoNormal>       
check_command  
check_host_cluster!1!2!$HOSTSTATEID:foo1$,$HOSTSTATEID:foo3$,$HOSTSTATEID:foo4$<o:p></o:p></p>

<p class=MsoNormal>  
     hostgroups     
nogsupport<o:p></o:p></p>

<p class=MsoNormal>}<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>The check_interval for the linux-server template is set to
3.  I made the assumption that it didn’t matter what I set the
address to since I’m only interested in the state of other hosts, and it’s
not being referenced in the check_command.<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>It shows up in the host information web page as being up,
but I don’t have any hosts named foo:<o:p></o:p></p>

<p class=MsoNormal>Host Status:        <o:p></o:p></p>

<p class=MsoNormal>  UP  <o:p></o:p></p>

<p class=MsoNormal> (for 0d 3h 41m 9s+)<o:p></o:p></p>

<p class=MsoNormal>Status
Information:         CLUSTER OK:
ProductionCluster1: 3 up, 0 down, 0 unreachable<o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p class=MsoNormal>I had better luck with check_icmp, but it looks like it goes
straight to CRITICAL if one host is down.<o:p></o:p></p>

</div>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<p><font face="Arial" size="1">This message (including any attachments) is 
intended only for<br>
the use of the individual or entity to which it is addressed and<br>
may contain information that is non-public, proprietary,<br>
privileged, confidential, and exempt from disclosure under<br>
applicable law or may constitute as attorney work product.<br>
If you are not the intended recipient, you are hereby notified<br>
that any use, dissemination, distribution, or copying of this<br>
communication is strictly prohibited. If you have received this<br>
communication in error, notify us immediately by telephone and<br>
(i) destroy this message if a facsimile or (ii) delete this message<br>
immediately if this is an electronic communication.</font></p>
<p><font face="Arial"><font size="1">Thank you.</font><br>
 </font></p>

</body>

</html>
</body>

</html>