Get metrics to instance LXD

Hi, I’m trying to get the resource usage of my containers in order to integrate them into my general graphics database.
I managed to get the generic status with this command:

root@lxd-test:~# curl --unix-socket /var/snap/lxd/common/lxd/unix.socket s/1.0/instances/web36/state
{“type”:“sync”,“status”:“Success”,“status_code”:200,“operation”:"",“error_code”:0,“error”:"",“metadata”:{“status”:“Running”,“status_code”:103,“disk”:{},“memory”:{“usage”:252358656,“usage_peak”:256000000,“swap_usage”:0,“swap_usage_peak”:0},“network”:{“eth0”:{“addresses”:[{“family”:“inet”,“address”:“10.204.77.30”,“netmask”:“8”,“scope”:“global”},{“family”:“inet6”,“address”:“fd42:dc7d:69d1:d946:216:3eff:fece:659b”,“netmask”:“64”,“scope”:“global”},{“family”:“inet6”,“address”:“fe80::216:3eff:fece:659b”,“netmask”:“64”,“scope”:“link”}],“counters”:{“bytes_received”:153334724,“bytes_sent”:2451571,“packets_received”:19405,“packets_sent”:16091,“errors_received”:0,“errors_sent”:0,“packets_dropped_outbound”:0,“packets_dropped_inbound”:0},“hwaddr”:“00:16:3e:ce:65:9b”,“host_name”:“veth6e9ea45e”,“mtu”:1500,“state”:“up”,“type”:“broadcast”},“lo”:{“addresses”:[{“family”:“inet”,“address”:“127.0.0.1”,“netmask”:“8”,“scope”:“local”},{“family”:“inet6”,“address”:"::1",“netmask”:“128”,“scope”:“local”}],“counters”:{“bytes_received”:34073,“bytes_sent”:34073,“packets_received”:362,“packets_sent”:362,“errors_received”:0,“errors_sent”:0,“packets_dropped_outbound”:0,“packets_dropped_inbound”:0},“hwaddr”:"",“host_name”:"",“mtu”:65536,“state”:“up”,“type”:“loopback”}},“pid”:269408,“processes”:37,“cpu”:{“usage”:374182876941}}}

Now how do I get a single indicated metric:

The following instance metrics are provided:

  • lxd_cpu_effective_total
  • lxd_cpu_seconds_total{cpu="<cpu>", mode="<mode>"}
  • lxd_disk_read_bytes_total{device="<dev>"}
  • lxd_disk_reads_completed_total{device="<dev>"}
  • lxd_disk_written_bytes_total{device="<dev>"}
  • lxd_disk_writes_completed_total{device="<dev>"}
  • lxd_filesystem_avail_bytes{device="<dev>",fstype="<type>"}
  • lxd_filesystem_free_bytes{device="<dev>",fstype="<type>"}
  • lxd_filesystem_size_bytes{device="<dev>",fstype="<type>"}
  • lxd_memory_Active_anon_bytes
  • lxd_memory_Active_bytes
  • lxd_memory_Active_file_bytes
  • lxd_memory_Cached_bytes
  • lxd_memory_Dirty_bytes
  • lxd_memory_HugepagesFree_bytes
  • lxd_memory_HugepagesTotal_bytes
  • lxd_memory_Inactive_anon_bytes
  • lxd_memory_Inactive_bytes
  • lxd_memory_Inactive_file_bytes
  • lxd_memory_Mapped_bytes
  • lxd_memory_MemAvailable_bytes
  • lxd_memory_MemFree_bytes
  • lxd_memory_MemTotal_bytes
  • lxd_memory_OOM_kills_total
  • lxd_memory_RSS_bytes
  • lxd_memory_Shmem_bytes
  • lxd_memory_Swap_bytes
  • lxd_memory_Unevictable_bytes
  • lxd_memory_Writeback_bytes
  • lxd_network_receive_bytes_total{device="<dev>"}
  • lxd_network_receive_drop_total{device="<dev>"}
  • lxd_network_receive_errs_total{device="<dev>"}
  • lxd_network_receive_packets_total{device="<dev>"}
  • lxd_network_transmit_bytes_total{device="<dev>"}
  • lxd_network_transmit_drop_total{device="<dev>"}
  • lxd_network_transmit_errs_total{device="<dev>"}
  • lxd_network_transmit_packets_total{device="<dev>"}
  • lxd_procs_total

Thanks for your help

Those are at /1.0/metrics they return all instances.