# virt-top csv output format changed

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 close merge delete

Sort by » oldest newest most voted

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.
more

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.

more