It seems that your port is not opened. Just make sure you have configured Livestatus on xinetd.
- Install xinetd
- Create /etc/xinetd.d/livestatus with something like:
_
service livestatus
{
type = UNLISTED
port = 6557
socket_type = stream
protocol = tcp
wait = no
cps = 100 3
instances = 500
per_source = 250
flags = NODELAY
user = nagios
server = /usr/bin/unixcat
server_args = /var/lib/nagios/rw/live
# only_from = 127.0.0.1 192.168.0.0
disable = no
}
See Remote access to Livestatus via SSH or xinetd for a detailed example
- Restart xinetd service
Then your example should work.
But that's only if you want to open your livestatus socket through the network (to have on one interface the results of several distributed nagios cores, for instance).
If you just want to test it locally, try with:
echo "GET hosts" | unixcat /var/lib/nagios/rw/live
where /var/lib/nagios/rw/live isyour livestatus socket