"last_update", "disk_caches"};
if ((tag_index < 0) || (tag_index >= (int)STATIC_ARRAY_SIZE(tags))) {
- ERROR("virt plugin: Array index out of bounds: tag_index = %d", tag_index);
+ ERROR(PLUGIN_NAME " plugin: Array index out of bounds: tag_index = %d",
+ tag_index);
return;
}
ERROR(PLUGIN_NAME " plugin: virDomainListGetStats failed with status %i.",
status);
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_NO_SUPPORT) {
ERROR(PLUGIN_NAME
" plugin: Disabled unsupported ExtraStats selector: perf");
ERROR(PLUGIN_NAME " plugin: virDomainGetVcpus failed with status %i.",
status);
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_NO_SUPPORT) {
if (extra_stats & ex_stats_vcpu)
ERROR(PLUGIN_NAME
if (nparams < 0) {
VIRT_ERROR(conn, "getting the CPU params count");
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_NO_SUPPORT) {
ERROR(PLUGIN_NAME
" plugin: Disabled unsupported ExtraStats selector: pcpu");
mem_stats);
sfree(minfo);
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_NO_SUPPORT) {
ERROR(PLUGIN_NAME
" plugin: Disabled unsupported ExtraStats selector: memory");
ERROR(PLUGIN_NAME
" plugin: failed to get preferred size of disk errors array");
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_NO_SUPPORT) {
ERROR(PLUGIN_NAME
ERROR(PLUGIN_NAME " plugin: virDomainGetBlockInfo failed for path: %s",
block_dev->path);
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_NO_SUPPORT) {
if (extra_stats & ex_stats_disk_allocation)
ERROR(PLUGIN_NAME " plugin: virDomainGetFSInfo failed: %d",
mount_points_cnt);
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
if (err->code == VIR_ERR_NO_SUPPORT) {
ERROR(PLUGIN_NAME
" plugin: Disabled unsupported ExtraStats selector: fs_info");
if (ret != 0) {
ERROR(PLUGIN_NAME " plugin: virDomainGetJobStats failed: %d", ret);
- virErrorPtr err = virConnGetLastError(conn);
+ virErrorPtr err = virGetLastError();
// VIR_ERR_INVALID_ARG returned when VIR_DOMAIN_JOB_STATS_COMPLETED flag is
// not supported by driver
if (err->code == VIR_ERR_NO_SUPPORT || err->code == VIR_ERR_INVALID_ARG) {
return 0;
}
+ int ret = virConnectIsAlive(conn);
+ if (ret == 0) { /* Connection lost */
+ if (inst->id == 0) {
+ c_complain(LOG_ERR, &conn_complain,
+ PLUGIN_NAME " plugin: Lost connection.");
+
+ if (!persistent_notification)
+ stop_event_loop(¬if_thread);
+
+ lv_disconnect();
+ last_refresh = 0;
+ }
+ return -1;
+ }
+
time_t t;
time(&t);