Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to use the Percona Apache Monitoring [Cacti] Template for Memcached.

They do indeed warn that you can't use the openbsd version of the package and provide a solution for Ubuntu/Debian users, i.e.:

You need nc on the server. Some versions of nc accept different command-line options. You can change the options used by configuring the PHP script. If you don’t want to do this for some reason, then you can install a version of nc that conforms to the expectations coded in the script’s default configuration instead. On Debian/Ubuntu, netcat-openbsd does not work, so you need the netcat-traditional package, and you need to switch to /bin/nc.traditional...

Since the RHEL 6.x version indeed comes from openbsd (confirmed by rpm -qi nc) how does one go about getting this installed on RHEL/CentOS?

Anyone else running these Percona templates on RHEL/CentOS? What did you do? alien the Debian package?

Update 1: FWIW, I tried to use GNU netcat by compiling it from source but it doesn't seem to have the exact options required by the Cacti template either (i.e. there is no analogy for -C or -q1 so it seems)

Update 2: I alien[ed] the netcat-traditional_1.10-38_amd64.deb package to make a .tgz and it does produce a binary "nc.traditional" and that version has the -q option but no -C

Update 3: I alied[ed] netcat-openbsd_1.89-3ubuntu2_amd64.deb as suggested by cjc and although it provides the -C and -q options it does not appear to work with the template. I also removed the -q1 option from the nc_cmd as suggested by quanta. Still doesn't graph or produce output from the commandline.

Update 4: I built the source RPM as suggested by dmourati and left out the -q1 as suggested by quanta and still it doesn't graph or produce output from the commandline. Maybe the source RPM solution and/or not passing -q1 works on RHEL 5.x, I dunno. At this point I admit defeat.


share|improve this question
Hmm. Here's a "netcat traditional" rpm for 5.x: rpm.pbone.net/index.php3/stat/4/idpl/2392833/dir/redhat_5.x/com/… You might be able to do something with the SRPM, in terms of building it on RHEL/CentOS 6.x. –  cjc Jun 26 '12 at 18:37
@cjc, see my Update 2 I expect the same issue with that RPM. –  HTTP500 Jun 26 '12 at 19:09
hmm, looking more closely at the nc installed on my Ubuntu 10.04 box, I see that the version that has both "-C" and "-q1" is the openbsd one, version 1.89-3ubuntu2. The nc.traditional one does not. Try to alien netcat-openbsd maybe? –  cjc Jun 26 '12 at 19:40
It's almost like the template makers are trolling on purpose. "Installing this template is easy! Just make sure your netcat has both -C and -q options available. <evil grin>" –  Janne Pikkarainen Jun 27 '12 at 10:54
show 2 more comments

5 Answers

Here's a partial (and opposite) solution that addresses the -C but not the -q.

I started here:


That at least explains what the -C option is supposed to do, provide a CRLF.

That page lead me to an ancient bugzilla:


There you can find a patched SRPM for the -C issue.


Download that SRPM, rebuild it (works fine in my CentOS 6 RPM build environment) and you can install the resulting nc. Check the man page, voila, support for -C.

-C Send CRLF as line-ending

For my own edification, what does the -q1 option do?

EDIT: Ah, I see the -q1 is to quit after 1 second. For the netcat above, the option is "-w" for timeout. You may be able to make that simple change to the percona script and get your graphs working. Pass a EOF as necessary.

share|improve this answer
My impression is that the "-q1" differs from the "-w" timeout. The latter is the timeout to establish a connection. The former, at least according to the docs, is a delay in closing an established connection. –  cjc Jun 27 '12 at 9:29
add comment

On my Ubuntu 10.04 box, I see that the version that has both "-C" and "-q1" is the openbsd one, version 1.89-3ubuntu2. The nc.traditional one in fact does not.

Try to alien netcat-openbsd package, maybe?

Interestingly, the various sources for netcat around the Internet don't have the complete featureset offered by the Ubuntu version. I haven't looked at the Ubuntu package manifest to see what they did.

share|improve this answer
Awarded bounty as it met the posted criteria but note that this solution does not work for the broader problem (i.e. with the Percona Cacti Memcached template) so not awarding best answer. –  HTTP500 Jun 27 '12 at 19:56
add comment

You can use the nc_cmd configuration option in the template, as stated in the comment just above your last comment to the bug report on the Google Code Cacti template project, where you linked to this question.

In addition, you should know that you are using outdated templates. As stated on the Better Cacti Templates project, that project has been discontinued and is now part of the Percona Monitoring Plugins. See http://www.percona.com/software/percona-monitoring-plugins/ and note that this software is fully covered by Percona support or consulting contracts, which is a great way to get help with installation. Or, in the unlikely event that there's a real incompatibility that won't let you get the templates to install as-is, you'll be able to get bug fixes to the software.

share|improve this answer
I am using the Percona Monitoring Plugins template as stated in original post. I added a comment to that thread out of frustration, my apologies. And I have edited the nc_cmd configuration option in the ../scripts/ss_get_by_ssh.php file. It's only this one template that has caused me grief and probably not worthy of a support/consulting contract at this time but thanks for the suggestion. –  HTTP500 Jun 27 '12 at 19:53
Oh, my mistake, sorry for not reading closely enough. I jumped to a conclusion. In any case, nc_cmd should be the right solution, unless there is something about the nc you're using that simply prevents it from actually working. If it can work at all, it should be a matter of finding the right options to use for your nc. –  Baron Schwartz Jun 28 '12 at 11:16
add comment

Alternatively you can write your own wrapper what use the correct options and ignore all the other. Saving it and use it in the percona monitoring plugins. How does it sounds ?

share|improve this answer
A wrapper would not be able to implement the functionality provided by these options. Unless you are suggesting he rewrites netcat itself. –  chutz Oct 31 '12 at 14:22
add comment
yum install nc
up2date install nc

and change the script if you need it

share|improve this answer
You read the note where I said that the version that comes from Red Hat uses the openbsd version of nc right? –  HTTP500 Jun 14 '12 at 19:53
"You can change the options used by configuring the PHP script", and change the script if you need it –  GioMac Jun 14 '12 at 19:57
The option used by the script that is not present in RHEL version is -q1 . Can you suggest an analogous option(s)? Thanks! –  HTTP500 Jun 14 '12 at 20:41
Oh, probably I would find source code for netcat I need and create RPM, or compile it and install directly (make, make install). –  GioMac Jun 15 '12 at 6:37
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.