Xymon Mailing List Archive search

Using variables in clientlaunch.cfg?

15 messages in this thread

list Charles Jones · Fri, 28 Jul 2006 16:02:45 -0700 ·
I plan on making some custom graphs for things like tomcat thread counts. The documentation for creating custom graphs should get me through that part, but the problem is my environment is such that groups of my monitored servers share a common home directory.

Fortunately, the hobbitclient uses the hostname as part of most of its dynamic files, so there are no conflicts.

The problem I forsee is lets say that servers 1-10 all share a common client homedirectory (SAN mount). Lets say that I want to collect data on tomcat thread counts on just some of the servers. I cannot just add an entry to clientlaunch.cfg, as this will affect ALL the servers.

Can you suggest how I should handle this?

The only way I can think of, is to define a generic "launcher" script, like:

[launcher]
        	ENVFILE /home/hobbit/client/etc/hobbitclient.cfg
                CMD /home/hobbit/client/ext/launcher.sh
                INTERVAL 5m


This launcher.sh script could do something like:
#!/bin/sh
if [ -f /home/hobbit/client/ext/$HOSTNAME_tct.sh ]
then
      /home/hobbit/client/ext/$HOSTNAME_tct.sh
fi
This would launch an external script that matched the hostname, if it existed, otherwise does nothing. This would allow all of the custom ext scripts to be in the same shared directory, with different names.


Another option would be, if clientlaunch could handle variables:
[tomcat_threads]
        	ENVFILE /home/hobbit/client/etc/hobbitclient.cfg
                CMD /home/hobbit/client/ext/$HOSTNAME_tct.sh
                INTERVAL 5m
I imagine this method though would generate errors when hobbit tries to execute the script on the hosts where it does not exist?

-Charles
list Charles Jones · Fri, 28 Jul 2006 23:12:21 -0700 ·
I just thought of another way to do this. I could modify the ps arguments that hobbit uses, and then just use hobbit-client.cfg with the PROC and TRACK options, and then I won't have to deal with using an ext script at all.

$ ps -welfm |egrep '(java.+tc_1_1)'|grep -v grep |wc -l
     66

The "m" flag shows all sub processes/threads. Without it, it would only show a single java process.

So this would work, but the question is, would hobbit still correctly parse the ps output with those flags? Here is a sample of the output using these flags:

$ ps -welfm |egrep '(java.+tc_1_1)'|grep -v grep | tail -1
1 S myuser   1664     1  0  76   0    - 365538 -     06:05 pts/0    00:00:00 /apps/someapp/java/j2sdk1.4.3/bin/java -server -XX:PermSize=256m -XX:NewSize=256m -Xms1024m -Xmx1024m -verbose:gc -Xloggc:/apps/someapp/tomcat/tc_1_1/logs/gc.log -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -Djava.endorsed.dirs=/apps/someapp/tom

-Charles
quoted from Charles Jones
-----Original Message-----
From: Charles Jones
Sent: Fri 7/28/2006 4:02 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Using variables in clientlaunch.cfg?
 
I plan on making some custom graphs for things like tomcat thread counts. The documentation for creating custom graphs should get me through that part, but the problem is my environment is such that groups of my monitored servers share a common home directory.

Fortunately, the hobbitclient uses the hostname as part of most of its dynamic files, so there are no conflicts.

The problem I forsee is lets say that servers 1-10 all share a common client homedirectory (SAN mount). Lets say that I want to collect data on tomcat thread counts on just some of the servers. I cannot just add an entry to clientlaunch.cfg, as this will affect ALL the servers.

Can you suggest how I should handle this?

The only way I can think of, is to define a generic "launcher" script, like:

[launcher]
        	ENVFILE /home/hobbit/client/etc/hobbitclient.cfg
                CMD /home/hobbit/client/ext/launcher.sh
                INTERVAL 5m


This launcher.sh script could do something like:
#!/bin/sh
if [ -f /home/hobbit/client/ext/$HOSTNAME_tct.sh ]
then
      /home/hobbit/client/ext/$HOSTNAME_tct.sh
fi
This would launch an external script that matched the hostname, if it existed, otherwise does nothing. This would allow all of the custom ext scripts to be in the same shared directory, with different names.


Another option would be, if clientlaunch could handle variables:
[tomcat_threads]
        	ENVFILE /home/hobbit/client/etc/hobbitclient.cfg
                CMD /home/hobbit/client/ext/$HOSTNAME_tct.sh
                INTERVAL 5m
I imagine this method though would generate errors when hobbit tries to execute the script on the hosts where it does not exist?

-Charles
list Henrik Størner · Sat, 29 Jul 2006 08:56:28 +0200 ·
quoted from Charles Jones
On Fri, Jul 28, 2006 at 04:02:45PM -0700, Charles Jones wrote:
Another option would be, if clientlaunch could handle variables:
[tomcat_threads]
        	ENVFILE /home/hobbit/client/etc/hobbitclient.cfg
                CMD /home/hobbit/client/ext/$HOSTNAME_tct.sh
                INTERVAL 5m
It can. Any environment variable, or setting from the hobbitclient.cfg
file, can be used in the settings in clientlaunch.cfg.
quoted from Charles Jones
I imagine this method though would generate errors when hobbit tries to 
execute the script on the hosts where it does not exist?
It would, but after 5 attempts it would automatically disable the task.


Henrik
list Henrik Størner · Sat, 29 Jul 2006 08:59:42 +0200 ·
quoted from Charles Jones
On Fri, Jul 28, 2006 at 11:12:21PM -0700, Charles Jones wrote:
I just thought of another way to do this. I could modify the ps arguments that hobbit uses, and then just use hobbit-client.cfg with the PROC and TRACK options, and then I won't have to deal with using an ext script at all.

$ ps -welfm |egrep '(java.+tc_1_1)'|grep -v grep |wc -l
     66

The "m" flag shows all sub processes/threads. Without it, it would only show a single java process.

So this would work, but the question is, would hobbit still correctly parse the ps output with those flags?
As long as it has a header with the same identifier for where the commandline is,
then it should work.


Regards,
Henrik
list Charles Jones -X Charljon - Cisco Learning Institute at Cisco · Sat, 29 Jul 2006 00:41:14 -0700 ·
Henrik,
 
I'm not sure what you mean by the header. I assume you mean the column headings on normal ps output:
$ ps aux |head -1
USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
 
It appears that the command line ps options that I want to use, drastically change the column header:
$ ps -welfm |head -1
F S UID        PID  PPID  C PRI  NI ADDR    SZ WCHAN  STIME TTY          TIME CMD
 
Will hobbit handle this?  If not, can I hack it to make it do so? If I have to I suppose I could use a shell script wrapper for ps that wiill spoof a header that the client is expecting.
 
-Charles
quoted from Henrik Størner


From: Henrik Stoerner [mailto:user-ce4a2c883f75@xymon.invalid]
Sent: Fri 7/28/2006 11:59 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] RE: [Hobbit] Using variables in clientlaunch.cfg?


On Fri, Jul 28, 2006 at 11:12:21PM -0700, Charles Jones wrote:
I just thought of another way to do this. I could modify the ps arguments
that hobbit uses, and then just use hobbit-client.cfg with the PROC and
TRACK options, and then I won't have to deal with using an ext script at all.

$ ps -welfm |egrep '(java.+tc_1_1)'|grep -v grep |wc -l
     66

The "m" flag shows all sub processes/threads. Without it, it would only show a single java process.

So this would work, but the question is, would hobbit still correctly parse the
ps output with those flags?
As long as it has a header with the same identifier for where the commandline is,
then it should work.
list Charles Jones -X Charljon - Cisco Learning Institute at Cisco · Sat, 29 Jul 2006 02:07:44 -0700 ·
Henrik,
 
FYI I just tried adding the m flag, and it works beautifully:
 
I changed hobbitclient-linux.sh.
Before:
ps -Aw -o pid,ppid,user,start,state,pri,pcpu,time,pmem,rsz,vsz,cmd
After:
ps -Awm -o pid,ppid,user,start,state,pri,pcpu,time,pmem,rsz,vsz,cmd
 
All proc checks seem to work as normal, and with the m flag I am now able to use TRACK on process threads (which are normally not displayed).
 
Thanks for making Hobbit so flexible!
-Charles
quoted from Charles Jones -X Charljon - Cisco Learning Institute at Cisco


From: Charles Jones -X (charljon - Cisco Learning Institute at Cisco)
Sent: Sat 7/29/2006 12:41 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] RE: [Hobbit] Using variables in clientlaunch.cfg?


Henrik,
 
I'm not sure what you mean by the header. I assume you mean the column headings on normal ps output:
$ ps aux |head -1
USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
 
It appears that the command line ps options that I want to use, drastically change the column header:
$ ps -welfm |head -1
F S UID        PID  PPID  C PRI  NI ADDR    SZ WCHAN  STIME TTY          TIME CMD
 
Will hobbit handle this?  If not, can I hack it to make it do so? If I have to I suppose I could use a shell script wrapper for ps that wiill spoof a header that the client is expecting.
 
-Charles


From: Henrik Stoerner [mailto:user-ce4a2c883f75@xymon.invalid]
Sent: Fri 7/28/2006 11:59 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] RE: [Hobbit] Using variables in clientlaunch.cfg?


On Fri, Jul 28, 2006 at 11:12:21PM -0700, Charles Jones wrote:
I just thought of another way to do this. I could modify the ps arguments
that hobbit uses, and then just use hobbit-client.cfg with the PROC and
TRACK options, and then I won't have to deal with using an ext script at all.

$ ps -welfm |egrep '(java.+tc_1_1)'|grep -v grep |wc -l
     66

The "m" flag shows all sub processes/threads. Without it, it would only show a single java process.

So this would work, but the question is, would hobbit still correctly parse the
ps output with those flags?
As long as it has a header with the same identifier for where the commandline is,
then it should work.
list T.J. Yang · Sat, 29 Jul 2006 09:21:12 -0500 ·
My goal is to script the configure process without interactive answering options.

Following line still won't cut it.

./configure --server --fping /opt/local/fping22/sbin/fping  --rrdinclude /opt/local/rrdtool12/include --rrdlib /opt/local/rrdtool12/lib --pcreinclude /opt/local/libpcre44/include --pcrelib /opt/local/libpcre44/lib --sslinclude /opt/local/libopenssl097/include --ssllib /opt/local/libopenssl097/lib --ldapinclude /opt/local/openldap2127/include --ldaplib /opt/local/openldap2127/lib

build/fping.sh still asking question.
I modified  fping.sh to slience the question prompt but then ssl and ldap question keep coming.

# ls build/*.sh
build/allinone.sh     build/fping.sh         build/ldap.sh     build/makehtml.sh  build/pedanticcheck.sh
build/bb-commands.sh  build/genconfig.sh     build/lfs.sh      build/makerpm.sh   build/rrd.sh
build/dorelease.sh    build/generate-md5.sh  build/makedeb.sh  build/pcre.sh       build/ssl.sh
#

Henrik,

Can you modify the related scripts to provie trully non-ineractive configure process ?

T.J. Yang
list Henrik Størner · Sat, 29 Jul 2006 16:43:15 +0200 ·
quoted from T.J. Yang
On Sat, Jul 29, 2006 at 09:21:12AM -0500, T.J. Yang wrote:
Can you modify the related scripts to provie trully non-ineractive 
configure process ?
See the "configure" commands in the debian/rules file. You can do 
some things with configure options, but the really simple way of doing a
non-interactive build is through environment variables passed to the
configure script. E.g. (from the debian/rules file):

        USEHOBBITPING=y \
        ENABLESSL=y \
        ENABLELDAP=y \
        ENABLELDAPSSL=y \
        BBUSER=hobbit \
        BBTOPDIR=/usr/lib/hobbit \
        BBVAR=/var/lib/hobbit \
        BBHOSTURL=/hobbit \
        CGIDIR=/usr/lib/hobbit/cgi-bin \
        BBCGIURL=/hobbit-cgi \
        SECURECGIDIR=/usr/lib/hobbit/cgi-secure \
        SECUREBBCGIURL=/hobbit-seccgi \
        HTTPDGID=www-data \
        BBLOGDIR=/var/log/hobbit \
        BBHOSTNAME=localhost \
        BBHOSTIP=127.0.0.1 \
        MANROOT=/usr/share/man \
        INSTALLBINDIR=/usr/lib/hobbit/server/bin \
        INSTALLETCDIR=/etc/hobbit \
        INSTALLWEBDIR=/etc/hobbit/web \
        INSTALLEXTDIR=/usr/lib/hobbit/server/ext \
        INSTALLTMPDIR=/var/lib/hobbit/tmp \
        INSTALLWWWDIR=/var/lib/hobbit/www \
        ./configure


Regards,
Henrik
list T.J. Yang · Sat, 29 Jul 2006 10:08:06 -0500 ·
quoted from Henrik Størner
From: user-ce4a2c883f75@xymon.invalid (Henrik Stoerner)
Reply-To: user-ae9b8668bcde@xymon.invalid
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] please enable non-interactive configure
Date: Sat, 29 Jul 2006 16:43:15 +0200

On Sat, Jul 29, 2006 at 09:21:12AM -0500, T.J. Yang wrote:
Can you modify the related scripts to provie trully non-ineractive
configure process ?
See the "configure" commands in the debian/rules file. You can do
some things with configure options, but the really simple way of doing a
non-interactive build is through environment variables passed to the
configure script. E.g. (from the debian/rules file):

        USEHOBBITPING=y \
This is what I missed, once I set "USEHOBBITPING=n", the external fping got 
accepted.
Thanks.

tj
list T.J. Yang · Sat, 29 Jul 2006 11:21:44 -0500 ·
Looks like even I specify "configure --server ...', "gmake install" also 
generate client binaries.

Am I doing somthing wrong ?


T.J. Yang
list Henrik Størner · Sat, 29 Jul 2006 21:45:25 +0200 ·
quoted from T.J. Yang
On Sat, Jul 29, 2006 at 11:21:44AM -0500, T.J. Yang wrote:
Looks like even I specify "configure --server ...', "gmake install" also generate client binaries.

Am I doing somthing wrong ?
Client binaries are always built. Even on a Hobbit server, you'd
probably want to run the client-side tools as well.


Henrik
list T.J. Yang · Sat, 29 Jul 2006 21:41:20 -0500 ·
quoted from Henrik Størner
From: user-ce4a2c883f75@xymon.invalid (Henrik Stoerner)
Reply-To: user-ae9b8668bcde@xymon.invalid
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] how to only generate server or client binaries ?
Date: Sat, 29 Jul 2006 21:45:25 +0200

On Sat, Jul 29, 2006 at 11:21:44AM -0500, T.J. Yang wrote:
Looks like even I specify "configure --server ...', "gmake install" also
generate client binaries.

Am I doing somthing wrong ?
Client binaries are always built. Even on a Hobbit server, you'd
probably want to run the client-side tools as well.


Henrik
Henrik
Thanks for the reply.

I am interested to replace my bb deployment with hobbit one.
I need to create hobbit server (for linux)and client packages(for solaris,hpux,linux).

May I suggest that in the future split the server and client binaries in a more cleaner way(IMHO).
configue as server should only generate server binaries. if one want client binary we then run "configure --client" to get it.
For now I can get by deleting /opt/local/hobbit/client directory after server install.

Also is it possible that you can have client and server reside at same level as hobbit ?
like /opt/local/hobbits( for server) and /opt/local/hobbitc (for client). the will make packaging more streightforwad  to deal with removal of client installation path.

My idea installation path structure is like this

/opt/local/hobbits
  -bin
  -man
  -doc
  -web
  -www
  -etc

/opt/local/hobbitc
  -bin
-man
-doc
-etc

Again just my person opinion.

Regards

tj
list Mike Arnold · Sun, 30 Jul 2006 23:41:30 -0700 (MST) ·
quoted from T.J. Yang
T.J. Yang wrote:
On Sat, Jul 29, 2006 at 11:21:44AM -0500, T.J. Yang wrote:
Looks like even I specify "configure --server ...', "gmake install"
also
generate client binaries.

Am I doing somthing wrong ?
Client binaries are always built. Even on a Hobbit server, you'd
probably want to run the client-side tools as well.


Henrik
Henrik
Thanks for the reply.

I am interested to replace my bb deployment with hobbit one.
I need to create hobbit server (for linux)and client packages(for
solaris,hpux,linux).
Packages of various versions for the above platforms can be found here:
http://www.razorsedge.org/~mike/software/hobbit/

-- 
-m

... so long as the people do not care to exercise their freedom, those
who wish to tyrranize will do so; for tyrants are active and ardent,
and will devote themselves in the name of any number of gods, religious
and otherwise, to put shackles upon sleeping men.
                -- Voltarine de Cleyre
list Mike Arnold · Sun, 30 Jul 2006 23:41:36 -0700 (MST) ·
T.J. Yang wrote:
On Sat, Jul 29, 2006 at 11:21:44AM -0500, T.J. Yang wrote:
Looks like even I specify "configure --server ...', "gmake install"
also
generate client binaries.

Am I doing somthing wrong ?
Client binaries are always built. Even on a Hobbit server, you'd
probably want to run the client-side tools as well.


Henrik
Henrik
Thanks for the reply.

I am interested to replace my bb deployment with hobbit one.
I need to create hobbit server (for linux)and client packages(for
solaris,hpux,linux).
Packages of various versions for the above platforms can be found here:
http://www.razorsedge.org/~mike/software/hobbit/

-- 
-m

... so long as the people do not care to exercise their freedom, those
who wish to tyrranize will do so; for tyrants are active and ardent,
and will devote themselves in the name of any number of gods, religious
and otherwise, to put shackles upon sleeping men.
                -- Voltarine de Cleyre
list Kent Brodie · Mon, 31 Jul 2006 08:34:15 -0500 ·
I personally prefer the separation of the client and server directories-
compared to BB, it makes things MUCH cleaner for us..    my $0.02.


Kent C. Brodie - user-da7f7d5174c0@xymon.invalid
Department of Physiology
Medical College of Wisconsin
(XXX) XXX-XXXX
quoted from T.J. Yang
-----Original Message-----
From: T.J. Yang [mailto:user-8e841282cda5@xymon.invalid] 
Sent: Saturday, July 29, 2006 9:41 PM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] how to only generate server or client binaries ?

From: user-ce4a2c883f75@xymon.invalid (Henrik Stoerner)
Reply-To: user-ae9b8668bcde@xymon.invalid
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] how to only generate server or client binaries ?
Date: Sat, 29 Jul 2006 21:45:25 +0200

On Sat, Jul 29, 2006 at 11:21:44AM -0500, T.J. Yang wrote:
Looks like even I specify "configure --server ...', "gmake install"
also
generate client binaries.

Am I doing somthing wrong ?
Client binaries are always built. Even on a Hobbit server, you'd
probably want to run the client-side tools as well.


Henrik
Henrik
Thanks for the reply.

I am interested to replace my bb deployment with hobbit one.
I need to create hobbit server (for linux)and client packages(for 
solaris,hpux,linux).

May I suggest that in the future split the server and client binaries in
a 
more cleaner way(IMHO).
configue as server should only generate server binaries. if one want
client 
binary we then run "configure --client" to get it.
For now I can get by deleting /opt/local/hobbit/client directory after 
server install.

Also is it possible that you can have client and server reside at same
level 
as hobbit ?
like /opt/local/hobbits( for server) and /opt/local/hobbitc (for
client). 
the will make packaging more streightforwad  to deal with removal of
client 
installation path.

My idea installation path structure is like this

/opt/local/hobbits
  -bin
  -man
  -doc
  -web
  -www
  -etc

/opt/local/hobbitc
  -bin
-man
-doc
-etc

Again just my person opinion.

Regards

tj