Hum, in fact, it is working : "netcat" issue.

I was using ' netcat-traditional', if I use 'netcat-openbsd', it is working. Strange :(

With Nagios, it isn't a direct tcp connection, but a xinetd service (I forgot this part).
If I use the "socket" option of shinken livestatus; it is working as expected (with my netcat).

Sorry for all that :(

2011/5/9 Gerhard Lausser <Gerhard.Lausser@consol.de>
this mail should have been sent to the devel-list instead...

-----Ursprüngliche Nachricht-----
Von: Gerhard Lausser [mailto:gerhard.lausser@consol.de]
Gesendet: Montag, 9. Mai 2011 00:04
An: 'Olivier Hanesse'
Betreff: AW: AW: AW: [Shinken-devel] Problem with Livestatus module

What i tried so far was an omd installation with shinken (0.6) as the
default core.
Now i repeat it with a native shinken installation (git clone a few minutes
ago).

I fire it up:
[shinken@vs2067068 shinken]$ sh bin/launch_all.sh

and then send a query:
[shinken@vs2067068 shinken]$ cat /tmp/lsq.lql
GET hosts
Columns: host_name host_address

[shinken@vs2067068 shinken]$ date && FOO=`cat /tmp/lsq.lql | nc 127.0.0.1
50000`&& date
Sun May  8 23:57:28 CEST 2011
Sun May  8 23:57:28 CEST 2011
[shinken@vs2067068 shinken]$ echo $FOO
applications;localhost databasehost-asia;localhost databasehost-us;localhost
databasehost1;localhost databasehost2;localhost databasehost3;localhost
localhost;localhost router-asia;www.google.com router-us;www.google.com
router1;www.google.com srv-ipvs-1;localhost srv-ipvs-2;localhost
srv-nfs-1;localhost srv-nfs-2;localhost srv-web-1;localhost
srv-web-2;localhost srv-web-3;localhost srv-web-asia;localhost
srv-web-us;localhost

How old is the version you're using? And what's your Linux-distribution?

Gerhard


> -----Ursprüngliche Nachricht-----
> Von: Olivier Hanesse [mailto:olivier.hanesse@gmail.com]
> Gesendet: Sonntag, 8. Mai 2011 23:27
> An: Gerhard Lausser
> Betreff: Re: AW: AW: [Shinken-devel] Problem with Livestatus module
>
> oliv@pc-olivier-h:~/sup$ date && FOO=`cat query_services2 |
> nc.traditional shinken 50000` && date
> Sun May  8 23:08:48 CEST 2011
> Sun May  8 23:14:46 CEST 2011
>
>
> oliv@pc-olivier-h:~/sup$ date && FOO=`cat query_services2 |
> nc.traditional nagios 6557` && date
> Sun May  8 23:17:21 CEST 2011
> Sun May  8 23:17:21 CEST 2011
>
> But I think it is normal for Shinken as the connection isn't
> close. The
> connection is set to "idle".
> Am I missing something ?
>
> Olivier
>
> Le 08/05/2011 22:29, Gerhard Lausser a écrit :
> > I still don't understand. With a 0.6 shinken installation i can do:
> >
> > [root@omd ~]# FOO=`cat /tmp/lsq.lql | nc 127.0.0.1 6557`
> > [root@omd ~]# echo $FOO
> > omd-lhm;66.66.66.66
> > [root@omd ~]# time BAR=`cat /tmp/lsq.lql | nc 127.0.0.1 6557`
> >
> > real    0m0.040s
> > user    0m0.001s
> > sys     0m0.012s
> > [root@omd ~]# echo $BAR
> > omd-lhm;66.66.66.66
> > [root@omd ~]#
> >
> > Do you mean your FOO=`send query...` takes 5 minutes to complete?
> >
> > Gerhard
> >
> >> -----Ursprüngliche Nachricht-----
> >> Von: Olivier Hanesse [mailto:olivier.hanesse@gmail.com]
> >> Gesendet: Sonntag, 8. Mai 2011 22:04
> >> An: Gerhard Lausser
> >> Betreff: Re: AW: [Shinken-devel] Problem with Livestatus module
> >>
> >> Yes I got the response right away, but the connection isn't closed.
> >> That's just my problem.
> >>
> >> With Nagios, the connection is closed after the response.
> >>
> >> I am using Livestatus with some script like FOO=`cat query | nc
> >> localhost 5667` with Nagios, but I can't do it with Shinken,
> >> because the
> >> connection isn't closed, I have to wait 5min to get the
> >> connection closed.
> >>
> >> I think, as I don't send a 'KeepAlive :on', the connection must be
> >> closed right after the server send the answer, no ?
> >>
> >>
> >> Le 08/05/2011 21:29, Gerhard Lausser a écrit :
> >>> With a small livestatus command file:
> >>>
> >>> [root@omd ~]# cat /tmp/lsq.lql
> >>> GET hosts
> >>> Columns: host_name host_address
> >>>
> >>>
> >>> i can send the command from the command line
> >>> [root@omd ~]# cat /tmp/lsq.lql | nc 127.0.0.1 6557
> >>> omd-lhm;66.66.66.66
> >>>
> >>> and get an immediate response.
> >>> Looking at the output of the shinken-broker process, i see:
> >>>
> >>> Begin Loop : manage broks 0
> >>> REQUEST
> >>> GET hosts
> >>> Columns: host_name host_address
> >>>
> >>> my result is [{'name': u'omd-lhm', 'address': u'66.66.66.66'}]
> >>> outputformat csv
> >>> RESPONSE
> >>> omd-lhm;66.66.66.66
> >>>
> >>>
> >>> DURATION 0.0080s
> >>> connection 22 is idle since 0 seconds (idle)
> >>>
> >>> connection 22 is idle since 0 seconds (idle)
> >>>
> >>> shutdown socket 22<---
> >>> Begin Loop : manage broks 0
> >>>
> >>>
> >>> What's your query and how long do you have to wait for a response?
> >>>
> >>> Gerhard
> >>>
> >>>
> >>>> -----Ursprüngliche Nachricht-----
> >>>> Von: Olivier Hanesse [mailto:olivier.hanesse@gmail.com]
> >>>> Gesendet: Sonntag, 8. Mai 2011 20:05
> >>>> An: shinken-devel@lists.sourceforge.net
> >>>> Cc: Gerhard Lausser
> >>>> Betreff: Re: [Shinken-devel] Problem with Livestatus module
> >>>>
> >>>> Hi,
> >>>>
> >>>> I think,  with Nagios livestatus module, connection is
> closed right
> >>>> after a successfull request, not after 5min of inactivity.
> >>>>
> >>>> So , in a bash script, we can use something like 'cat
> >> query_file | nc
> >>>> nagioshost livestatusport' to interact with the livestatus
> >> module and
> >>>> get a response right away without waiting 5min.
> >>>>
> >>>> To get the same behaviour with Shinken, I had to add
> >>>> 'close_it = True'
> >>>> in sourcecode.
> >>>>
> >>>> Regards
> >>>>
> >>>> Olivier
> >>>>
> >>>> Le 08/05/2011 19:14, Gerhard Lausser a écrit :
> >>>>> Hi,
> >>>>>
> >>>>>> I wanted to use the livestatus module from shinken the
> >>>> same way I was
> >>>>>> using the one from Nagios,
> >>>>> what does this mean exactly? How dows the client
> interact with the
> >>>>> livestatus module?
> >>>>>
> >>>>>
> >>>>>> connection after a successful query.
> >>>>> With "KeepAlive: on" the connection will not be closed at
> >>>> all (ok, after 5
> >>>>> minutes of inactivity). Otherwise after a succesfully
> >>>> handled request the
> >>>>> state of the connection is set to "idle". This means that
> >>>> the connection is
> >>>>> queued to be closed.
> >>>>>
> >>>>> Gerhard
> >>>>>
> >>>>>
> >>>>> __________ Hinweis von ESET NOD32 Antivirus,
> >>>> Signaturdatenbank-Version 6105
> >>>>> (20110508) __________
> >>>>>
> >>>>> E-Mail wurde gepruft mit ESET NOD32 Antivirus.
> >>>>>
> >>>>> http://www.eset.com
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>> --------------------------------------------------------------
> >>>> ----------------
> >>>>> WhatsUp Gold - Download Free Network Management Software
> >>>>> The most intuitive, comprehensive, and cost-effective network
> >>>>> management toolset available today.  Delivers lowest initial
> >>>>> acquisition cost and overall TCO of any competing solution.
> >>>>> http://p.sf.net/sfu/whatsupgold-sd
> >>>>> _______________________________________________
> >>>>> Shinken-devel mailing list
> >>>>> Shinken-devel@lists.sourceforge.net
> >>>>> https://lists.sourceforge.net/lists/listinfo/shinken-devel
> >>>
> >>> __________ Hinweis von ESET NOD32 Antivirus,
> >> Signaturdatenbank-Version 6105
> >>> (20110508) __________
> >>>
> >>> E-Mail wurde geprüft mit ESET NOD32 Antivirus.
> >>>
> >>> http://www.eset.com
> >>>
> >>>
> >>
> >
> >
> > __________ Hinweis von ESET NOD32 Antivirus,
> Signaturdatenbank-Version 6105
> > (20110508) __________
> >
> > E-Mail wurde geprüft mit ESET NOD32 Antivirus.
> >
> > http://www.eset.com
> >
> >
>
>


__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 6105
(20110508) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com



__________ Hinweis von ESET NOD32 Antivirus, Signaturdatenbank-Version 6105
(20110508) __________

E-Mail wurde geprüft mit ESET NOD32 Antivirus.

http://www.eset.com



------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Shinken-devel mailing list
Shinken-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/shinken-devel