Re: AW: grab hostname from tomcat manager

2014-04-04 Thread Frederik Nosi

Hi,

On 04/02/2014 04:54 PM, bjoern.bec...@easycash.de wrote:

-Ursprüngliche Nachricht-
Von: André Warnier [mailto:a...@ice-sa.com]
Gesendet: Mittwoch, 2. April 2014 16:35
An: Tomcat Users List
Betreff: Re: grab hostname from tomcat manager

bjoern.bec...@easycash.de wrote:

Hello,

I need to grab the hostname from the tomcat manager somehow.
Unfortunately this URL manager/text/serverinfo doesn't contain the

hostname.

Is there any other smart way to receive the hostname via tomcat

manager app?
For give me for asking, but how do you access the tomcat manager if you
do not know the hostname ?

Good question :). But I got a good reason for it.

I got two servers with several tomcat instances.
In front of them is a loadbalancer with is configured to do a failover.

-LB-
 /   \
Server1:8081Server2:8081

I need to write a shell script to sync a specific directory and for each tomcat 
instance I need to know on which one the loadbalancer is targeting at the 
moment.
If tomcat 8081 on server 1 is down, the loadbalancer will point to server 2 
tomcat 8081. I can find it out through the loadbalancer address only.


I think the right source of the information you need is the load 
balancer, if you have access obviously. If not, you have the other 
indirect methods suggested from the others in this thread, jvmRoute or 
a page which shows the hostname.


Beware to the load balancing method used too, source ip, simple round 
robin or other.






-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Federik

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



AW: AW: grab hostname from tomcat manager

2014-04-03 Thread Bjoern.Becker
 -Ursprüngliche Nachricht-
 Von: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Gesendet: Mittwoch, 2. April 2014 22:33
 An: Tomcat Users List
 Betreff: Re: AW: grab hostname from tomcat manager
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256
 
 Bjorn,
 
 On 4/2/14, 10:54 AM, bjoern.bec...@easycash.de wrote:
  -Ursprüngliche Nachricht- Von: André Warnier
  [mailto:a...@ice-sa.com] Gesendet: Mittwoch, 2. April 2014 16:35
  An: Tomcat Users List Betreff: Re: grab hostname from tomcat manager
 
  bjoern.bec...@easycash.de wrote:
  Hello,
 
  I need to grab the hostname from the tomcat manager somehow.
  Unfortunately this URL manager/text/serverinfo doesn't contain
 the
  hostname.
 
  Is there any other smart way to receive the hostname via tomcat
  manager app?
 
 
  For give me for asking, but how do you access the tomcat manager if
  you do not know the hostname ?
 
  Good question :). But I got a good reason for it.
 
  I got two servers with several tomcat instances. In front of them is
 a
  loadbalancer with is configured to do a failover.
 
  -LB- /   \ Server1:8081 Server2:8081
 
  I need to write a shell script to sync a specific directory and for
  each tomcat instance I need to know on which one the loadbalancer is
  targeting at the moment.
 
 How will you check to see which one the lb is targeting?

That's the question. 

  If tomcat 8081 on server 1 is down, the loadbalancer will point to
  server 2 tomcat 8081. I can find it out through the loadbalancer
  address only.
 
 You should probably set a jvmRoute in your Engine in server.xml.
 That way, you can detect which back-end server you are getting just by
 looking at the JSESSIONID cookie.

That's the answer. When jvmroute is define I easily can receive the jsession id 
with wget:

wget -q -O - --no-cache --keep-session-cookies --no-check-certificate 
--save-cookies cookies.txt https://loadbalanceraddress:8081/manager  
--user=user--password=secure 1/dev/null

perfect! 

Thanks a lot! 
Björn
 
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org
 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
 
 iQIcBAEBCAAGBQJTPHPuAAoJEBzwKT+lPKRYW+oQAKr/BQOhCwBxlA+0cboIWdoO
 HLQw8czwuYVqxag9cFiy7XiAUGmnph3pYfZTj6YcYXKDVBEeCuWEVPDFsSuRQG3u
 +I9UnWFnoFn8OCWJyv2RKKBfkZ3UhjJom3JmLnHxnWb4KbU9yz/ep5xNpJ43WY3x
 VxiPlkdksIKTiwycc6itM+5/URoHn5LzMSAdzb2ZFVhx/VlaubAfqaAo6fIVylTj
 TZ0JdZR9QNvL+KO+QPUN5c9j2unVk08oc1feNSyDOdWrs0Fg4e5i6qjORxroA17L
 1uEZhnivHL8wvUt89F+oQ+1rqBIff+c242vdvDE7STJK4vUJfSk2JLPIvu/fApfl
 NhTgCCM8J7XOIUgCT556RHjioUhCumdzL24PUiIs30DSMYB2/5pC+jarF4+3iXI5
 8tAeZR+vVaTaszKYoWjA37dV3WIC+06Us5v2hmmVcuyVxN+IE/hqrxpBkSORcbO4
 5PpXJThPHQPvHMwJCywwIxaEDfLuxcWMXD4TJl5cogePt/BRA3p+9xafbuGJvEkN
 gaUDSNLXGMTd9iKUHdjH5g5arEPs0tIy5EJVpIcNk1X2QS0nfzH4P7TjrqNj432c
 fn3NPUUKn1QdIW6enyc6rgHnF+JHPFCETCtkmbX8lNfqr7rtorpmFXphvrFqcAFa
 B43OfQbSyuHsrkfVSoEx
 =RiHw
 -END PGP SIGNATURE-
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org



Re: AW: AW: grab hostname from tomcat manager

2014-04-03 Thread André Warnier

bjoern.bec...@easycash.de wrote:

-Ursprüngliche Nachricht-
Von: Christopher Schultz [mailto:ch...@christopherschultz.net]
Gesendet: Mittwoch, 2. April 2014 22:33
An: Tomcat Users List
Betreff: Re: AW: grab hostname from tomcat manager

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Bjorn,

On 4/2/14, 10:54 AM, bjoern.bec...@easycash.de wrote:

-Ursprüngliche Nachricht- Von: André Warnier
[mailto:a...@ice-sa.com] Gesendet: Mittwoch, 2. April 2014 16:35
An: Tomcat Users List Betreff: Re: grab hostname from tomcat manager

bjoern.bec...@easycash.de wrote:

Hello,

I need to grab the hostname from the tomcat manager somehow.
Unfortunately this URL manager/text/serverinfo doesn't contain

the

hostname.

Is there any other smart way to receive the hostname via tomcat

manager app?
For give me for asking, but how do you access the tomcat manager if
you do not know the hostname ?

Good question :). But I got a good reason for it.

I got two servers with several tomcat instances. In front of them is

a

loadbalancer with is configured to do a failover.

-LB- /   \ Server1:8081 Server2:8081

I need to write a shell script to sync a specific directory and for
each tomcat instance I need to know on which one the loadbalancer is
targeting at the moment.

How will you check to see which one the lb is targeting?


That's the question. 


If tomcat 8081 on server 1 is down, the loadbalancer will point to
server 2 tomcat 8081. I can find it out through the loadbalancer
address only.

You should probably set a jvmRoute in your Engine in server.xml.
That way, you can detect which back-end server you are getting just by
looking at the JSESSIONID cookie.


That's the answer. When jvmroute is define I easily can receive the jsession id 
with wget:

wget -q -O - --no-cache --keep-session-cookies --no-check-certificate 
--save-cookies cookies.txt https://loadbalanceraddress:8081/manager  
--user=user--password=secure 1/dev/null

perfect! 



Alternatively, I suppose that you could just create a small JSP (or even HTML, but then 
host-specific) page in each host, which returns the real hostname.


You should probably be careful however : in your rsync scenario above, is there any 
guarantee that between the time you ask for the hostname (in whatever way), and the time 
at which you do your rsync, the targeted host will still be the same ?

Remember that if things /can/ happen, they /do/ happen.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: AW: AW: grab hostname from tomcat manager

2014-04-03 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 4/3/14, 5:14 AM, André Warnier wrote:
 bjoern.bec...@easycash.de wrote:
 -Ursprüngliche Nachricht- Von: Christopher Schultz
 [mailto:ch...@christopherschultz.net] Gesendet: Mittwoch, 2.
 April 2014 22:33 An: Tomcat Users List Betreff: Re: AW: grab
 hostname from tomcat manager
 
 -BEGIN PGP SIGNED MESSAGE- Hash: SHA256
 
 Bjorn,
 
 On 4/2/14, 10:54 AM, bjoern.bec...@easycash.de wrote:
 -Ursprüngliche Nachricht- Von: André Warnier 
 [mailto:a...@ice-sa.com] Gesendet: Mittwoch, 2. April 2014
 16:35 An: Tomcat Users List Betreff: Re: grab hostname from
 tomcat manager
 
 bjoern.bec...@easycash.de wrote:
 Hello,
 
 I need to grab the hostname from the tomcat manager
 somehow. Unfortunately this URL manager/text/serverinfo
 doesn't contain
 the
 hostname.
 Is there any other smart way to receive the hostname via
 tomcat
 manager app? For give me for asking, but how do you access
 the tomcat manager if you do not know the hostname ?
 Good question :). But I got a good reason for it.
 
 I got two servers with several tomcat instances. In front of
 them is
 a
 loadbalancer with is configured to do a failover.
 
 -LB- /   \ Server1:8081 Server2:8081
 
 I need to write a shell script to sync a specific directory
 and for each tomcat instance I need to know on which one the
 loadbalancer is targeting at the moment.
 How will you check to see which one the lb is targeting?
 
 That's the question.
 If tomcat 8081 on server 1 is down, the loadbalancer will
 point to server 2 tomcat 8081. I can find it out through the
 loadbalancer address only.
 You should probably set a jvmRoute in your Engine in
 server.xml. That way, you can detect which back-end server you
 are getting just by looking at the JSESSIONID cookie.
 
 That's the answer. When jvmroute is define I easily can receive
 the jsession id with wget:
 
 wget -q -O - --no-cache --keep-session-cookies
 --no-check-certificate --save-cookies cookies.txt
 https://loadbalanceraddress:8081/manager 
 --user=user--password=secure 1/dev/null
 
 perfect!
 
 Alternatively, I suppose that you could just create a small JSP (or
 even HTML, but then host-specific) page in each host, which returns
 the real hostname.
 
 You should probably be careful however : in your rsync scenario
 above, is there any guarantee that between the time you ask for the
 hostname (in whatever way), and the time at which you do your
 rsync, the targeted host will still be the same ? Remember that
 if things /can/ happen, they /do/ happen.

I still don't really grok the use case, here, but if you use a bogus
JSESSIONID (like GimmieMyServer.jvmRoute), you can select the backend
server if you are using a load balancer that understands what the
jvmRoute means (like mod_jk does, for instance).

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTPYd6AAoJEBzwKT+lPKRYHngQAJ6zTouqqV4riBzgB6peRFTT
PxMGOT/yEfWxPnja8ZUeY9XRT6n3N07eg6vyELEOVSBMyXZSeeyef7mOomUPgrZz
/ADu7tieCE/bUkW24xrOs4Uklw+1AmeYwheTZ5bztHZRhkGpEqEExQD/E/6lVnQH
OpNv1MWIkUumk3f3UeIviibyrv/AAdCxgjukAgFkk2zWTAcLtYgBZ1psS8NpDUO8
ynM0drQuThCpdZmfCjSQWC+V+U7PS2Qc8L5q9xYm6dnilDhUp0YDW0Gf3/zTUudX
gBXTkE9XN2AnG6UnP+st//Jrwwjjw8PEL6u6q1fpThSyWRq9A8A8yYHm4O6qYMiW
A/YtOHlyGZ7L4E2T+bshz56AInEUEKEVSjdlZH95W17zgOlVqgWuFZAQG59Yow2D
U18NEN4PnFOjxwsMY6VdpK3tSL+Tu3EazYt0qfyhV/vguhufOpNjNoZC6hfDyh5C
zdcV8kKdogvjhl2zR9yjm+nFOIEH6B+TiQB96/XphX7MBY7DYJFwOkshDPN6dd0w
PwSXCbuX9i7WMEYPNmkqK1fgPtqqVdx7Sj586OYThEi3SVNhP2+owx0/OEqhuYey
BOm+i2z+FTzS87q20PV7tOsJbh5H5JkHxP6MXNVSY4Yah+XUbYCo9VU8LxbgTmDZ
jCNjBmv4hnYMmvZFdzzX
=6lZK
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



grab hostname from tomcat manager

2014-04-02 Thread Bjoern.Becker
Hello,

I need to grab the hostname from the tomcat manager somehow. 
Unfortunately this URL manager/text/serverinfo doesn't contain the hostname. 

Is there any other smart way to receive the hostname via tomcat manager app? 

Best Regards,
Bjoern


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: grab hostname from tomcat manager

2014-04-02 Thread André Warnier

bjoern.bec...@easycash.de wrote:

Hello,

I need to grab the hostname from the tomcat manager somehow. 
Unfortunately this URL manager/text/serverinfo doesn't contain the hostname. 

Is there any other smart way to receive the hostname via tomcat manager app? 



For give me for asking, but how do you access the tomcat manager if you do not know the 
hostname ?



-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: grab hostname from tomcat manager

2014-04-02 Thread Leo Donahue
On Wed, Apr 2, 2014 at 6:07 AM, bjoern.bec...@easycash.de wrote:

 Hello,

 I need to grab the hostname from the tomcat manager somehow.
 Unfortunately this URL manager/text/serverinfo doesn't contain the
 hostname.

 Is there any other smart way to receive the hostname via tomcat manager
 app?

 Best Regards,
 Bjoern


 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


Programmatically grab? or just see it?

There is a link on the manager homepage for server status which will show
the host name to you.


AW: grab hostname from tomcat manager

2014-04-02 Thread Bjoern.Becker
 -Ursprüngliche Nachricht-
 Von: André Warnier [mailto:a...@ice-sa.com]
 Gesendet: Mittwoch, 2. April 2014 16:35
 An: Tomcat Users List
 Betreff: Re: grab hostname from tomcat manager
 
 bjoern.bec...@easycash.de wrote:
  Hello,
 
  I need to grab the hostname from the tomcat manager somehow.
  Unfortunately this URL manager/text/serverinfo doesn't contain the
 hostname.
 
  Is there any other smart way to receive the hostname via tomcat
 manager app?
 
 
 For give me for asking, but how do you access the tomcat manager if you
 do not know the hostname ?

Good question :). But I got a good reason for it. 

I got two servers with several tomcat instances. 
In front of them is a loadbalancer with is configured to do a failover. 

   -LB-
/   \
Server1:8081Server2:8081

I need to write a shell script to sync a specific directory and for each tomcat 
instance I need to know on which one the loadbalancer is targeting at the 
moment. 
If tomcat 8081 on server 1 is down, the loadbalancer will point to server 2 
tomcat 8081. I can find it out through the loadbalancer address only. 

 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: AW: grab hostname from tomcat manager

2014-04-02 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Bjorn,

On 4/2/14, 10:54 AM, bjoern.bec...@easycash.de wrote:
 -Ursprüngliche Nachricht- Von: André Warnier
 [mailto:a...@ice-sa.com] Gesendet: Mittwoch, 2. April 2014 16:35 
 An: Tomcat Users List Betreff: Re: grab hostname from tomcat
 manager
 
 bjoern.bec...@easycash.de wrote:
 Hello,
 
 I need to grab the hostname from the tomcat manager somehow. 
 Unfortunately this URL manager/text/serverinfo doesn't
 contain the
 hostname.
 
 Is there any other smart way to receive the hostname via
 tomcat
 manager app?
 
 
 For give me for asking, but how do you access the tomcat manager
 if you do not know the hostname ?
 
 Good question :). But I got a good reason for it.
 
 I got two servers with several tomcat instances. In front of them
 is a loadbalancer with is configured to do a failover.
 
 -LB- /   \ Server1:8081   Server2:8081
 
 I need to write a shell script to sync a specific directory and
 for each tomcat instance I need to know on which one the
 loadbalancer is targeting at the moment.

How will you check to see which one the lb is targeting?

 If tomcat 8081 on server 1 is down, the loadbalancer will point to 
 server 2 tomcat 8081. I can find it out through the loadbalancer 
 address only.

You should probably set a jvmRoute in your Engine in server.xml.
That way, you can detect which back-end server you are getting just by
looking at the JSESSIONID cookie.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTPHPuAAoJEBzwKT+lPKRYW+oQAKr/BQOhCwBxlA+0cboIWdoO
HLQw8czwuYVqxag9cFiy7XiAUGmnph3pYfZTj6YcYXKDVBEeCuWEVPDFsSuRQG3u
+I9UnWFnoFn8OCWJyv2RKKBfkZ3UhjJom3JmLnHxnWb4KbU9yz/ep5xNpJ43WY3x
VxiPlkdksIKTiwycc6itM+5/URoHn5LzMSAdzb2ZFVhx/VlaubAfqaAo6fIVylTj
TZ0JdZR9QNvL+KO+QPUN5c9j2unVk08oc1feNSyDOdWrs0Fg4e5i6qjORxroA17L
1uEZhnivHL8wvUt89F+oQ+1rqBIff+c242vdvDE7STJK4vUJfSk2JLPIvu/fApfl
NhTgCCM8J7XOIUgCT556RHjioUhCumdzL24PUiIs30DSMYB2/5pC+jarF4+3iXI5
8tAeZR+vVaTaszKYoWjA37dV3WIC+06Us5v2hmmVcuyVxN+IE/hqrxpBkSORcbO4
5PpXJThPHQPvHMwJCywwIxaEDfLuxcWMXD4TJl5cogePt/BRA3p+9xafbuGJvEkN
gaUDSNLXGMTd9iKUHdjH5g5arEPs0tIy5EJVpIcNk1X2QS0nfzH4P7TjrqNj432c
fn3NPUUKn1QdIW6enyc6rgHnF+JHPFCETCtkmbX8lNfqr7rtorpmFXphvrFqcAFa
B43OfQbSyuHsrkfVSoEx
=RiHw
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org