prometheus-libvirt-exporter icon indicating copy to clipboard operation
prometheus-libvirt-exporter copied to clipboard

Connection reset by peer

Open AdolarMezga opened this issue 5 years ago • 3 comments

Works fine when VM migrate to other host, but quit the job when VM shutdown:

failed to get DomainBlockStats: Unable to read from monitor: Connection reset by peer

Its possible to mark domain as 'not running' or similar in line 208?

Regards

AdolarMezga avatar Jul 12 '19 14:07 AdolarMezga

thanks for your suggestion.I don't quite understand the issue you're asking.could your help us fix this issue or explana the problem more clear.

zhangjianweibj avatar Jul 13 '19 01:07 zhangjianweibj

I start, stop and migrate VMs via oVirt and scrape metrics via Prometheus. On hosts running few VMs and the prometheus-libvirt-exporter. For tests I compiled the exporter on another Linux machine, pushed it to the hosts and started the exporter in the command line.

If I start VM or migrate VM from one to another host everythings works fine. But if I stop one or more VMs via oVirt, the exporter crashes. Error message is: failed to get DomainBlockStats: Unable to read from monitor: Connection reset by peer

I read some source code and found the line 203 respective 261. Thats go-libvirt functions. Maybe the isActive-flag of the domain is not the best indicator to avoid the DomainBlockStats-call. To use an unvalid domain.ID to indicate a stopped VM was not successful as well.

Regards

AdolarMezga avatar Jul 15 '19 14:07 AdolarMezga

very thanks.I understand what's causing the problem.after section "l.DomainIsActive" result is true,at this moment,vm is staill alive.when program goto "rRdReq, rRdBytes, rWrReq, rWrBytes, _, err = l.DomainBlockStats(*domain, disk.Target.Device)",vm is stoped.and caused error "connection reset by peer".i think if vm is migrated,libvirt return nil result with this domain is Reasonable.

zhangjianweibj avatar Jul 16 '19 00:07 zhangjianweibj