Citrix monitor

2005-06-28 Thread Jeroen Moors


Hi list,

We have some citrix servers over here we want to monitor. Below you can find 
the code of our citrix.monitor

Jeroen


--- citrix.monitor ---

#!/usr/bin/perl -w
#
# try to connect to a citrix server and wait for the ica prompt.
#
# Arguments are "host [host...]"
#
# Jeroen Moors, [EMAIL PROTECTED]
#
#Copyright (C) 2005, Jeroen Moors
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
use Getopt::Std;
use Socket;

my %opt;
getopts ("t:", \%opt);

my $PORT = 1494;
my $TIMEOUT = $opt{"t"} || 10;

my @failures = ();
my @detail = ();

my $ALARM = 0;

foreach my $host (@ARGV) {
my $pro = getprotobyname ('tcp');

if (!defined $pro) {
die "could not getprotobyname\n";
}

if (!defined socket (S, PF_INET, SOCK_STREAM, $pro)) {
die "could not create socket: $!\n";
}

my $a = inet_aton ($host);
if (!defined $a) {
push @failures, $host;
push @detail, "$host could not inet_aton";
close (S);
next;
}

my $sin = sockaddr_in ($PORT, $a);
if (!defined $sin) {
push @failures, $host;
push @detail, "$host could not sockaddr_in";
close (S);
next;
}

my $r;

eval {
local $SIG{"ALRM"} = sub { die "alarm\n" };

alarm $TIMEOUT;

$r = connect (S, $sin);
my $return_string;
while (my $char = getc(S)) {
$return_string .= $char;
if ( $return_string =~ /ICA/) {
alarm 0;
last;
}
}
};

if ($@) {
push @failures, $host;

if ($@ eq "alarm\n") {
push @detail, "$host timeout";

} else {
push @detail, "$host interrupted syscall: $!";
}

close (S);
next;
}

if (!defined $r) {
push @failures, $host;
push @detail, "$host could not connect: $!";
close (S);
next;
}

if (!defined close (S)) {
push @failures, $host;
push @detail, "$host could not close socket: $!";
next;
}
}

if (@failures == 0) {
exit 0;
}

print join (" ", sort @failures), "\n";
print "\n", join ("\n", @detail), "\n";

exit 1;


--- end of file ---

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


wrapping long lines in mon.cf, how?

2005-06-28 Thread prosolutions


Can long lines in mon.cf be gracefully wrapped, as:

hostgroup testing_server_network 172.16.0.1 172.16.0.2 172.16.0.3 \
 172.16.0.4 172.16.0.5


or does this mess things up?

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


what about spaces in names in mon.cf?

2005-06-28 Thread prosolutions

Is this possible in mon.cf:


hostgroup "My Server Group"

watch "My Server Group"

...




?

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: wrapping long lines in mon.cf, how?

2005-06-28 Thread David Nolan



--On Tuesday, June 28, 2005 4:39 PM -0500 [EMAIL PROTECTED] wrote:




Can long lines in mon.cf be gracefully wrapped, as:

hostgroup testing_server_network 172.16.0.1 172.16.0.2 172.16.0.3 \
 172.16.0.4 172.16.0.5


or does this mess things up?





Is this possible in mon.cf:


hostgroup "My Server Group"

watch "My Server Group"

...






From the man page:
Lines are parsed as they are read. Long lines may be continued by ending 
them with a backslash ("\"). If a line is continued, then the backslash, 
the trailing whitespace after the backslash, and the leading whitespace of 
the following line are removed. The end result is assembled into a single 
line.


Also from the man page:
Hostgroup entries begin with the keyword hostgroup, and are followed by a 
hostgroup tag and one or more hostnames or IP addresses, separated by 
whitespace. The hostgroup tag must be composed of alphanumeric characters, 
a dash ("-"), a period ("."), or an underscore ("_"). Non-blank lines 
following the first hostgroup line are interpreted as more hostnames. The 
hostgroup definition ends with a blank line.


And:
Watch entries begin with a line that starts with the keyword watch, 
followed by whitespace and a single word which normally refers to a 
pre-defined hostgroup. If the second word is not recognized as a hostgroup 
tag, a new hostgroup is created whose tag is that word, and that word is 
its only member.


-David



David Nolan<*>[EMAIL PROTECTED]
curses: May you be forced to grep the termcap of an unclean yacc while
 a herd of rogue emacs fsck your troff and vgrind your pathalias!

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Can "inverval" go inside "period" stanza?

2005-06-28 Thread prosolutions


Can "interval" go inside a "period" stanza - I need to run tests at
different rates, depending upon time of day and day of week.  For
example:


service mytest
description My_Test
monitor my_test.monitor ;;
period wd {Mon-Fri} hr {00:00:00-03:59:59}
interval 300s
alertevery 10m
alertafter 1
alert mail.alert [EMAIL PROTECTED]
period wd {Mon-Fri} hr {04:00:00-22:59:59}
interval 20s
alertevery 10m
alertafter 1
alert mail.alert [EMAIL PROTECTED]
period wd {Mon-Fri} hr {23:00:00-23:59:59}
interval 300s
alertevery 10m
alertafter 1
alert mail.alert [EMAIL PROTECTED]
period wd {Sat-Sun} hr {00:00:00-23:59:59}
interval 300s
alertevery 10m
alertafter 1
alert mail.alert [EMAIL PROTECTED]

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon


Re: Can "inverval" go inside "period" stanza?

2005-06-28 Thread Jim Trocki

On Tue, 28 Jun 2005 [EMAIL PROTECTED] wrote:


Can "interval" go inside a "period" stanza - I need to run tests at
different rates, depending upon time of day and day of week.  For
example:


no, it can't, but that wouldn't be a difficult feature to add.

___
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon