How to get metrics from tgtd
I’ve tried to find a way to gather metrics from iscsi TGT. I found nothing. No metrics, no exporters, no counters. Documentation is silent, internet is silent. It sounded like there is no metrics from tgt-admin or tgtadm or tgtd at all.
But after reading source code iscsi_if.h
and tgtadm.c
, I found, there are, actually metrics. Tgtd is very old, so they are called ‘stats’. And there is undocumented feature:
tgtadm --mode system --op stat
Example of output of tgtd (output is too long to show as text):
Lun0 is a controller, and lun 1 is the actual device.
rd_subm
is submitted reads (in bytes and operations == cmds)rd_done
is finished reads (the same, bytes and ops)wr_subm
is submitted writeswr_done
is finished writeserrs
is an error counter.
There is no ready-made exporter, but it should be easy to write, I believe. Advise for future exporter writer: to support multiple instances TGTD (multiple TGT_IPC_SOCKET
)