Prometheus API

13 views
Skip to first unread message

Thomas Will

unread,
Jun 25, 2020, 12:06:18 AM6/25/20
to Prometheus Users
Hello guys, I am trying to run this command on my cluster.

curl -g http://10.23.255.80:9090/api/v1/series?match[]=node_cpu{job="node_exporter", instanceAlias="master"}

and I am getting an error :-

{"status":"error","errorType":"bad_data","error":"parse error at char 14: unexpected identifier \"node_exporter\" in label matching, expected string"}curl: (6) Could not resolve host: instanceAlias=master}

Can anyone please point out my mistake.

Thanks,
Thomas Will

Brian Candler

unread,
Jun 25, 2020, 1:22:21 AM6/25/20
to Prometheus Users
Put single quotes around the whole URL:

curl -g 'http://10.23.255.80:9090/api/v1/series?match[]=node_cpu{job="node_exporter", instanceAlias="master"}'

You have a space after the comma, which is fine, but without the quotes the shell breaks this into two words and passes them as separate arguments to curl.  Also the single quotes prevent the shell from interpreting metacharacters such as [], {}, * and ?
Reply all
Reply to author
Forward
0 new messages