How to export data in csv file for below query

Asked by Dhinesh M

Hi Guys,

I am new to Graphite. I want to export metric data in csv file for below query. It is not working, Can you please help me on this.

FOR /F %i IN (Servers.txt) do curl "http://graphite.com/render/?target=summarize(servers.%i.system.availability, "24hours", "avg")&format=csv" >> %i.csv

When i execute, http://graphite.com/render/?target=summarize(servers.graphXXXX*.system.availability, "24hours", "avg")&format=csv in browser, It is returning file. Not from command prompt, I am getting below error,

<address>Apache/2.2.15 (CentOS) Server at graphite.com Port 80</address>
</body></html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>400 Bad Request</title>
</head><body>
<h1>Bad Request</h1>
<p>Your browser sent a request that this server could not understand.<br />
</p>
<hr>
<address>Apache/2.2.15 (CentOS) Server at graphite.com Port 80</address>
</body></html>

Thanks,
Dhinesh.M

Question information

Language:
English Edit question
Status:
Expired
For:
Graphite Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Piotr Popieluch (piotr1212) said :
#1

Not sure which shell you are using but I think it interprets the ampersand as special character. Try to single quote the URL or escape the ampersand.

Revision history for this message
Dhinesh M (mdhinesh) said :
#2

Hi,

When i hit graphite server with wildcard or specific server name, It is returning the data.

Example:- "http://graphite.com/render/?target=summarize(servers.XXXXX_yyyy_com.system.availability, "24hours", "avg")&format=csv".

I want to pull this report for specific set of servers, So i stored all the necessary server names in file and running the command for each servers one by one by using 'for loop' in command prompt. It is not working. Can you please help me on this.

FOR /F %i IN (Servers.txt) do curl "http://graphite.com/render/?target=summarize(servers.%i.system.availability, "24hours", "avg")&format=csv" >> %i.csv

Thanks,
Dhinesh.M

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.