Re: [Nagios-users] User-defined host/service attributes

2006-10-19 Thread Marc Powell


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:nagios-users-
> [EMAIL PROTECTED] On Behalf Of Marc Haber
> Sent: Thursday, October 19, 2006 3:59 AM
> To: nagios-users@lists.sourceforge.net
> Subject: Re: [Nagios-users] User-defined host/service attributes
> 
> On Sat, Oct 14, 2006 at 03:11:02PM -0400, John P. Rouillard wrote:
> > Nagios 3.0 has native support for this.
> 
> But Nagios 3.0 is not yet released.
> 
> >  I use a simple wrapper script and define things like:
> 
> Do I see correctly that your wrapper script is a workaround for Nagios
> 2.x?
> 
> I surely hope that the way of solving this with Nagios 3 is a little
> less ugly.

It's talked about here: http://www.nagios.org/development/upcoming.php
And here:
http://www.netways.de/uploads/media/Ethan.Galstad_Nagios.3.and.Beyond.pd
f
And in the archives. 

--
Marc



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
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


Re: [Nagios-users] User-defined host/service attributes

2006-10-19 Thread Marc Haber
On Sat, Oct 14, 2006 at 03:11:02PM -0400, John P. Rouillard wrote:
> Nagios 3.0 has native support for this.

But Nagios 3.0 is not yet released.

>  I use a simple wrapper script and define things like:

Do I see correctly that your wrapper script is a workaround for Nagios
2.x?

I surely hope that the way of solving this with Nagios 3 is a little
less ugly.

Greetings
Marc

-- 
-
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
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


Re: [Nagios-users] User-defined host/service attributes

2006-10-14 Thread John P. Rouillard

In message <[EMAIL PROTECTED]>,
Marc Haber writes:
>This, however, means that one has to have the DNS name of the host in
>the host_name field:
>
>define host {
>use my-linux-host
>host_name   ipdesc.iface.host.loc.mydomain.example
>hostgroups  defaultping, snmp-w68, ssh, hostnameip
>alias   foo server running bar and baz services, col
>ocated in blu
>address 10.1.1.47
>parents localhost
>}
>
>This is a bit clumsy since our host names are complicated and lengthy.
>
>I'd like to have something like
>
>define command {
>command_name check_hostnameip
>command_line $USER1$/check_dns --hostname=$CUSTOMATTR$ --expected-ad
>dress=$HOSTADDRESS$
>}
>
>define host {
>use my-linux-host
>   host_name   host.mydomain.example
>custom_attributeipdesc.iface.host.loc.mydomain.example
>hostgroups  defaultping, snmp-w68, ssh, hostnameip
>alias   foo server running bar and baz services, col
>ocated in blu
>address 10.1.1.47
>parents localhost
>}
>
>If this possible in Nagios2? If not, are there other ideas how to
>solve this?

Nagios 3.0 has native support for this. I use a simple wrapper script
and define things like:

define service{
service_description VpnExternalIFPingCheck
hostgroup_name  vpn_ip
use generic-service
check_command   check_host_by_icmp!300,20%!500,40%!!`$USER1$/ge
t_custom_attributes $HOSTNAME$ VPN-IP`
contact_groups  renesys-admins-nopage
}

# 'check_host_via_icmp' command definition
define command{
command_namecheck_host_by_icmp
command_line$USER1$/check_icmp -w $ARG1$ -c $ARG2$ -n 2 $ARG3$ $ARG
4$
}

with the custom attribute $HOSTNAME$-VPN-IP defined as comment in the host 
definition like:

  define host{
host_name   example
alias   examplesite1
address 192.168.9.7
parents sc01_site1
use generic-host
  # custom_macro ops01-INSTALL-IP 192.168.9.10
  # custom_macro ops01-YUM-IP 192.168.97.11
  # custom_macro ops01-VPN-IP 169.184.83.10
hostgroups  standard_services,standard_linux_services,linux
_prod_hosts,internal_hosts,mht1,3ware_raid,dhcp_testers,yum_hosts,install_hosts
,web_role,vpn_hosts,vpn_ip
}

The get_custom_attributes script below goes in the plugins directory
($USER1$) and change HOSTFILES (files with host object definitons) to
a pattern that matches your installation:

#! /bin/sh

# this needs to run as fast as possible.
HOSTFILES="/etc/nagios/hosts/*.cfg"

# use cache file if present
# create cache file with:
#   grep -h custom_macro HOSTFILES > custom_macros.cache
# where HOSTFILES are the same files as specified above.
CACHEFILE="/etc/nagios/hosts/custom_macros.cache"

if [ -r $CACHEFILE ]; then
FILES="$CACHEFILE"
else
FILES="$HOSTFILES"
fi

# sed out lines of the form:
#  "# custom_macro HOST-VARIABLE VALUE" allowing arbitrary white space before
#  and after each token. Stripping white space from before (any maybe after)
#  the value. The sed command will exit on first match.
value=`sed -n -e "s/^[  ]*#[]*custom_macro[ ]*$1-$2[]*\([^ 
].*\)[  ]*$/\1/p" -e "t exit" -e "T" -e ":exit;q" $FILES`

if [ -z "$value" ]; then
  echo "'Unable to find $1-$2'"
else
  echo "$value"
fi


I keep all my nagios files under Config and when new hosts files are
pushed a simple command (grep custom_macro $HOSTFILES >
.../custom_macros.cache) updates the cache file on every host file
change.

-- rouilj
John Rouillard
===
My employers don't acknowledge my existence much less my opinions.

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
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


[Nagios-users] User-defined host/service attributes

2006-10-14 Thread Marc Haber
Hi,

recently, I was confused by my Nagios reporting a host DOWN event
while the host was alive and kicking. After debugging for a while, I
found out that the host had changed IP addresses and nagios was, of
course, still checking the old address since it was configured to
check the IP address.

To catch such error situations earlier, I'd now like to have Nagios
check that the host name indeed still points to the IP address we're
actually checking.

This is easy enough:

define service {
use my-service
hostgroup_name  hostnameip
service_description my_hostnameip
check_command   check_hostnameip
}

define command {
command_name check_hostnameip
command_line $USER1$/check_dns --hostname=$HOSTNAME$ 
--expected-address=$HOSTADDRESS$
}

This, however, means that one has to have the DNS name of the host in
the host_name field:

define host {
use my-linux-host
host_name   ipdesc.iface.host.loc.mydomain.example
hostgroups  defaultping, snmp-w68, ssh, hostnameip
alias   foo server running bar and baz services, 
colocated in blu
address 10.1.1.47
parents localhost
}

This is a bit clumsy since our host names are complicated and lengthy.

I'd like to have something like

define command {
command_name check_hostnameip
command_line $USER1$/check_dns --hostname=$CUSTOMATTR$ 
--expected-address=$HOSTADDRESS$
}

define host {
use my-linux-host
host_name   host.mydomain.example
custom_attributeipdesc.iface.host.loc.mydomain.example
hostgroups  defaultping, snmp-w68, ssh, hostnameip
alias   foo server running bar and baz services, 
colocated in blu
address 10.1.1.47
parents localhost
}

If this possible in Nagios2? If not, are there other ideas how to
solve this?

Greetings
Marc

-- 
-
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
___
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