# CSV formatter The CSV formatter presents [results of database queries](../../queries) in the following formats: format|content type|description :---:|:---:|:----- `csv`|text/plain|a text table, comma separated, with a header line (dimension names) and `\r\n` at the end of the lines `csvjsonarray`|application/json|a JSON array, with each row as another array (the first row has the dimension names) `tsv`|text/plain|like `csv` but TAB is used instead of comma to separate values (MS Excel flavor) `html`|text/html|an html table `markdown`|text/plain|markdown table In all formats the date and time is the first column. The CSV formatter respects the following API `&options=`: option|supported|description :---:|:---:|:--- `nonzero`|yes|to return only the dimensions that have at least a non-zero value `flip`|yes|to return the rows older to newer (the default is newer to older) `seconds`|yes|to return the date and time in unix timestamp `ms`|yes|to return the date and time in unit timestamp as milliseconds `percent`|yes|to replace all values with their percentage over the row total `abs`|yes|to turn all values positive `null2zero`|yes|to replace gaps with zeros (the default prints the string `null` ## Examples Get the system total bandwidth for all physical network interfaces, over the last hour, in 6 rows (one for every 10 minutes), in `csv` format: Netdata always returns bandwidth in `kilobits`. ```bash # curl -Ss 'https://registry.my-netdata.io/api/v1/data?chart=system.net&format=csv&after=-3600&group=sum&points=6&options=abs' time,received,sent 2018-10-26 23:50:00,90214.67847,215137.79762 2018-10-26 23:40:00,90126.32286,238587.57522 2018-10-26 23:30:00,86061.22688,213389.23526 2018-10-26 23:20:00,85590.75164,206129.01608 2018-10-26 23:10:00,83163.30691,194311.77384 2018-10-26 23:00:00,85167.29657,197538.07773 ``` --- Get the max RAM used by the SQL server and any cron jobs, over the last hour, in 2 rows (one for every 30 minutes), in `tsv` format, and format the date and time as unix timestamp: Netdata always returns memory in `MB`. ```bash # curl -Ss 'https://registry.my-netdata.io/api/v1/data?chart=apps.mem&format=tsv&after=-3600&group=max&points=2&options=nonzero,seconds&dimensions=sql,cron' time sql cron 1540598400 61.95703 0.25 1540596600 61.95703 0.25 ``` --- Get an HTML table of the last 4 values (4 seconds) of system CPU utilization: Netdata always returns CPU utilization as `%`. ```bash # curl -Ss 'https://registry.my-netdata.io/api/v1/data?chart=system.cpu&format=html&after=-4&options=nonzero'
time | softirq | user | system |
2018-10-27 00:16:07 | 0.25 | 1 | 0.75 |
2018-10-27 00:16:06 | 0 | 1.0025063 | 0.5012531 |
2018-10-27 00:16:05 | 0 | 1 | 0.75 |
2018-10-27 00:16:04 | 0 | 1.0025063 | 0.7518797 |