Problem with memcached graphs and nc command arguments

Bug #1155712 reported by Roman Vynar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Monitoring Plugins
Fix Released
Medium
Unassigned

Bug Description

We have the following to get memcached graphs in cacti/scripts/ss_get_by_ssh.php:

$nc_cmd = 'nc -C -q1'; # How to invoke netcat
...
   return "echo \"stats\nquit\" | $nc_cmd $srv $prt";

This results in:

Debian:
------------------
root@debian:~# echo "stats\nquit" | nc -C -q1 localhost 11211
nc: invalid option -- 'C'
nc -h for help
root@debian:~# echo "stats\nquit" | nc -q1 localhost 11211
ERROR
root@debian:~# echo stats | nc -q1 localhost 11211
STAT pid 2006
...
>>> that's ok
root@debian:~# echo stats | nc localhost 11211
STAT pid 2006
...
>>> stuck, needs CRLF

CentOS/RHEL:
------------------
[root@centos ~]# echo "stats\nquit" | nc -C -q1 localhost 11211
nc: invalid option -- 'q'
usage: nc [-46DdhklnrStUuvzC] [-i interval] [-p source_port]
   [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]
   [-x proxy_address[:port]] [hostname] [port[s]]
[root@centos ~]# echo "stats\nquit" | nc -C localhost 11211
ERROR
[root@centos ~]# echo stats | nc -C localhost 11211
STAT pid 31391
...
>>> that's ok
[root@centos ~]# echo stats | nc localhost 11211
STAT pid 31391
...
>>> that's ok

Ubuntu:
------------------
Works with both -C -q1 and w/0 options at all.

So it would be good to change the code to conform most of the cases to:

$nc_cmd = 'nc'; # How to invoke netcat. NOTE, for Debian set 'nc -q1'.
...
   return "echo stats | $nc_cmd $srv $prt";

Tags: cacti
Changed in percona-monitoring-plugins:
importance: Undecided → Medium
status: New → In Progress
milestone: none → 1.0.3
tags: added: cacti
Changed in percona-monitoring-plugins:
status: In Progress → Fix Committed
Changed in percona-monitoring-plugins:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.