Ask Your Question
0

virt-top csv output format changed

asked 2011-12-02 05:08:11 -0500

firebird gravatar image

I use virt-top with CSV-switch to output all stats to a file which is parsed to fill SNMP-tree so the vm-stats can be queried using SNMP-walk/get remotely by monitoring systems (e.g. nagios, zabbix)

This worked using libvirt verions 0.7.X but with the most recent version (fedora 16, libvirt 0.9.X) the CSV-format has changed: floating point was represented as ',N.NNNN,' in the CSV with version 0.7X and now its represented as ',"N,NNNN",'. So the point has been changed to a comma and the complete number is now double-qouted because the comma now has a double function (floating-point and CSV-seperator). This makes it very hard to parse. Before I just did:

tail -n 1 virt-top.log | tr "," "\n" to split all values into seperate lines so I could read in this output directly into SNMP (via extend) - very easy and robust.

How can I archive the same now? Why has beend the format changed? How to contact the developers to ask for a new switch so at least the default seperator can be changed to something unique (e.g. ";").

Help much appreciated Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2011-12-07 07:57:53 -0500

rjones gravatar image

A few related issues/answers:

  1. We didn't change the format from period to comma. You could try setting LANG=C since it may be that your locale causes commas to be displayed for decimal points. (To see what I mean by these locales, try: LANG=es_ES virt-top --script --csv /dev/stdout)
  2. Don't use tr "," "\n" to parse CSV. It is not a robust way to parse any CSV file. Use a proper CSV parser such as spreadsheet/database, or Perl/Python/Ruby library, or /usr/bin/csvtool.
  3. We could add a flag to change the separator, but given (1) I don't think that's necessary to solve your problem.
edit flag offensive delete link more
0

answered 2011-12-02 09:13:34 -0500

SoumyaC gravatar image

Please go to the link for Virt-top

Starting from the IRC Channel (where you can discuss with people using virt-top and developers of virt-top), Mailing list (Join the mailing list and shoot your queries) , Developers Mail ID (rjones AT redhat DOT com) all are present in bottom of the page.

I guess best is to hang out in IRC channel and directly ask questions at #virt.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2011-12-02 05:08:11 -0500

Seen: 647 times

Last updated: Dec 07 '11