On 1/4/2012 5:11 AM, Jim Avery wrote:
> Another advantage is if you add or remove host servers to the cluster
> you only need to change the one host definition.
>
> You could use check_cluster as the host check for your fake host, then
> its status would be meaningful too.  I'll have a go at doing that
> myself when I get a minute.

Yes, that is what you want to do.  It's what I did.

First, make sure you've defined all your VM hosts.  The check_cluster 
command will collate their states to determine the cluster's state.

Then, define a command to check your clusters.  This one can check hosts 
or services, depending on what you pass for $ARG1$.

-----
define command {
        #
        # $ARG1$ is either "host" or "service"
        #
        command_name    check_cluster
        command_line    $USER1$/check_cluster --$ARG1$ --label=$HOSTNAME$ 
--warning=$ARG2$ --critical=$ARG3$ --data=$ARG4$
}
-----

Next, define a host to represent your cluster.  I pass "host" as $ARG1$. 
  I set a warning if one is not-OK and critical if two or more are 
not-OK.  I don't recall where I saw the use of the @ and : documented in 
defining thresholds, but I seem to recall that without the "or more" 
part the check will do something odd when a third VM host goes down.

-----
define host {
        use             generic-server
        host_name       cluster_1
        alias           cluster_1
        parents         foo1,foo2,foo3,foo4
        check_command 
check_cluster!host!@1:!@2:!$HOSTSTATEID:foo1$,$HOSTSTATEID:foo2$,$HOSTSTATEID:foo3$,$HOSTSTATEID:foo4$
}
-----

I also define a service check for the cluster so I don't run into 
service-less hosts not showing up on Nagios' web pages.

-----
define service {
        use             standard_service
        host_name       cluster_1
        check_command 
check_cluster!service!@1:!@2:!$SERVICESTATEID:foo1:Ping$,$SERVICESTATEID:foo2:Ping$,$SERVICESTATEID:foo3:Ping$,$SERVICESTATEID:foo4:Ping$
}
-----


Nothing in this message is intended to make or accept an offer or to form a 
contract, except that an attachment that is an image of a contract bearing the 
signature of an officer of our company may be or become a contract. This 
message (including any attachments) is intended only for the use of the 
individual or entity to whom it is addressed. It may contain information that 
is non-public, proprietary, privileged, confidential, and exempt from 
disclosure under applicable law or may constitute as attorney work product. If 
you are not the intended recipient, we hereby notify you that any use, 
dissemination, distribution, or copying of this message is strictly prohibited. 
If you have received this message in error, please notify us immediately by 
telephone and delete this message immediately.

Thank you.


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Nagios-users mailing list
Nagios-users@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

Reply via email to