curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
{
"targets":[
{
"host":"host1.example.org",
"service":"_HOST_",
"perflabel":"rta",
"type":"AVERAGE"
},
{
"host":"host2.example.org",
"service":"_HOST_",
"perflabel":"rta",
"type":"AVERAGE"
}
],
"start":'UNIXEPOCHTIMESTAMP_START',
"end":'UNIXEPOCHTIMESTAMP_END'
}' https://example.org/pnp4nagios/index.php/api/metrics
curl -s -u '<username>:<password>' https://example.org/pnp4nagios/index.php/api/hosts
curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
{
"host":"host.example.org"
}' https://example.org/pnp4nagios/index.php/api/services
You can use regular expressions for host lists:
curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
{
"host":"/^local"
}' https://example.org/pnp4nagios/index.php/api/services
curl -s -u '<username>:<password>' -H "Content-Type: application/json" -X POST -d '
{
"host":"host.example.org",
"service":"_HOST_"
}' https://example.org/pnp4nagios/index.php/api/labels