erlug
[Top] [All Lists]

[Erlug] mklivestatus socat

To: ERlug - Lista Pubblica <erlug@xxxxxxxxxxxxxx>
Subject: [Erlug] mklivestatus socat
From: vito pascali <vito.pascali@xxxxxxxxx>
Date: Mon, 5 Aug 2013 13:09:46 +0200
Ciao,
sto cercando di redirigere la socket che crea mklivestatus (http://mathias-kettner.de/checkmk_livestatus.html) su una porta del mio firewall casalingo e da qui su un socket locale.
Questo mi permetterebbe di effettuare dei controlli sui vari nagios che ho in giro senza dover andare in vpn e con la comodità di eseguire delle query in locale.
Sto trovando però dei problemi a effettuare il fork della connessione che cade (giustamente) dopo che ha ottenuto EOF dalla socket.

-Nagios cliente:

  socat -d -d -d UNIX-CONNECT:/var/log/nagios/rw/live,debug=1,nonblock,append=1, TCP:server.di.casa:6040,reuseaddr,nonblock=1,append=1,debug=1,forever

-Server casalingo:
socat TCP-LISTEN:6040,reuseaddr,fork UNIX-LISTEN:/tmp/live,unlink-early

Questo funziona regolarmente, ma si chiude la connessione dopo il primo check:

-Check locale:
[root@srv-nlmonitor ~]# echo 'GET status' | unixcat /tmp/live.7
accept_passive_host_checks;accept_passive_service_checks;cached_log_messages;check_external_commands;check_host_freshness;check_service_freshness;connections;connections_rate;enable_event_handlers;enable_flap_detection;enable_notifications;
[snip]

-Server Nagios Remoto:
  socat -d -d -d UNIX-CONNECT:/var/log/nagios/rw/live,debug=1,nonblock,append=1, TCP:server.di.casa:6040,reuseaddr,nonblock=1,append=1,debug=1,forever
2013/08/05 13:06:11 socat[13589] I socat by Gerhard Rieger - see www.dest-unreach.org
2013/08/05 13:06:11 socat[13589] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2013/08/05 13:06:11 socat[13589] I This product includes software written by Tim Hudson (tjh@xxxxxxxxxxxxx)
2013/08/05 13:06:11 socat[13589] I setting option "so-debug" to 1
2013/08/05 13:06:11 socat[13589] I setting option "o-nonblock" to 1
2013/08/05 13:06:11 socat[13589] I setting option "append" to 1
2013/08/05 13:06:11 socat[13589] N opening connection to AF=1 "/var/log/nagios/rw/live"
2013/08/05 13:06:11 socat[13589] I socket(1, 1, 0) -> 3
2013/08/05 13:06:11 socat[13589] N successfully connected from local address AF=1 "\x9B"
2013/08/05 13:06:11 socat[13589] I setting option "so-reuseaddr" to 1
2013/08/05 13:06:11 socat[13589] I setting option "o-nonblock" to 1
2013/08/05 13:06:11 socat[13589] I setting option "append" to 1
2013/08/05 13:06:11 socat[13589] I setting option "so-debug" to 1
2013/08/05 13:06:11 socat[13589] I setting option "forever" to 1
2013/08/05 13:06:11 socat[13589] N opening connection to AF=2 127.0.0.1:6040
2013/08/05 13:06:11 socat[13589] I starting connect loop
2013/08/05 13:06:11 socat[13589] I socket(2, 1, 6) -> 4
2013/08/05 13:06:11 socat[13589] W connect(4, AF=2 127.0.0.1:6040, 16): Operation now in progress
2013/08/05 13:06:11 socat[13589] I resolved and opened all sock addresses
2013/08/05 13:06:11 socat[13589] N starting data transfer loop with FDs [3,3] and [4,4]
2013/08/05 13:06:14 socat[13589] I transferred 11 bytes from 4 to 3
2013/08/05 13:06:14 socat[13589] N socket 2 (fd 4) is at EOF
2013/08/05 13:06:14 socat[13589] I shutdown(3, 1)
2013/08/05 13:06:14 socat[13589] I transferred 1230 bytes from 3 to 4
2013/08/05 13:06:14 socat[13589] N socket 2 (fd 4) is at EOF
2013/08/05 13:06:14 socat[13589] I shutdown(3, 1)
2013/08/05 13:06:14 socat[13589] N socket 1 (fd 3) is at EOF
2013/08/05 13:06:14 socat[13589] I shutdown(4, 1)
2013/08/05 13:06:14 socat[13589] N socket 2 (fd 4) is at EOF
2013/08/05 13:06:14 socat[13589] I shutdown(3, 1)
2013/08/05 13:06:14 socat[13589] I shutdown(3, 2)
2013/08/05 13:06:14 socat[13589] I shutdown(4, 2)
2013/08/05 13:06:14 socat[13589] I shutdown(4, 2): Transport endpoint is not connected
2013/08/05 13:06:14 socat[13589] N exiting with status 0

Avete idea di come posso far funzionare il giochetto?
Sono un novizio di socat e nc e onestamente non sto vedendo alternative alla questione...
Grazie


Vito Pascali
<Prev in Thread] Current Thread [Next in Thread>