| 1 | // Copyright 2017 Kumina, https://kumina.nl/ |
| 2 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | // you may not use this file except in compliance with the License. |
| 4 | // You may obtain a copy of the License at |
| 5 | // |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | // |
| 8 | // Unless required by applicable law or agreed to in writing, software |
| 9 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | // See the License for the specific language governing permissions and |
| 12 | // limitations under the License. |
| 13 | |
| 14 | package mainscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/ |
| 15 | |
| 16 | import ( |
| 17 | "encoding/xmlscip-go gomod github.com/golang/go/src go1.12 `encoding/xml`/" |
| 18 | "logscip-go gomod github.com/golang/go/src go1.12 log/" |
| 19 | "net/httpscip-go gomod github.com/golang/go/src go1.12 `net/http`/" |
| 20 | "osscip-go gomod github.com/golang/go/src go1.12 os/" |
| 21 | |
| 22 | "github.com/kumina/libvirt_exporter/libvirt_schemascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/" |
| 23 | "github.com/libvirt/libvirt-goscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/" |
| 24 | "github.com/prometheus/client_golang/prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/" |
| 25 | "github.com/prometheus/client_golang/prometheus/promhttpscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus/promhttp`/" |
| 26 | "gopkg.in/alecthomas/kingpin.v2scip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/" |
| 27 | ) |
| 28 | |
| 29 | // LibvirtExporter implements a Prometheus exporter for libvirt state. |
| 30 | type LibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter# struct { |
| 31 | uriscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#uri. string |
| 32 | exportNovaMetadatascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#exportNovaMetadata. bool |
| 33 | |
| 34 | libvirtUpDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtUpDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 35 | libvirtDomainsNumberDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainsNumberDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 36 | |
| 37 | libvirtDomainStateCodescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainStateCode. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 38 | libvirtDomainInfoMaxMemDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMaxMemDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 39 | libvirtDomainInfoMemoryDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMemoryDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 40 | libvirtDomainInfoNrVirtCpuDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoNrVirtCpuDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 41 | libvirtDomainInfoCpuTimeDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoCpuTimeDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 42 | |
| 43 | libvirtDomainBlockRdBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdBytesDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 44 | libvirtDomainBlockRdReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdReqDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 45 | libvirtDomainBlockRdTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdTotalTimesDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 46 | libvirtDomainBlockWrBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrBytesDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 47 | libvirtDomainBlockWrReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrReqDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 48 | libvirtDomainBlockWrTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrTotalTimesDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 49 | libvirtDomainBlockFlushReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushReqDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 50 | libvirtDomainBlockFlushTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushTotalTimesDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 51 | |
| 52 | libvirtDomainInterfaceRxBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxBytesDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 53 | libvirtDomainInterfaceRxPacketsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxPacketsDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 54 | libvirtDomainInterfaceRxErrsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxErrsDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 55 | libvirtDomainInterfaceRxDropDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxDropDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 56 | libvirtDomainInterfaceTxBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxBytesDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 57 | libvirtDomainInterfaceTxPacketsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxPacketsDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 58 | libvirtDomainInterfaceTxErrsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxErrsDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 59 | libvirtDomainInterfaceTxDropDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxDropDesc. *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc# |
| 60 | } |
| 61 | |
| 62 | // NewLibvirtExporter creates a new Prometheus exporter for libvirt. |
| 63 | func NewLibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/NewLibvirtExporter().(uri string, exportNovaMetadata bool) (*LibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#, error) { |
| 64 | var domainLabels []string |
| 65 | if exportNovaMetadata { |
| 66 | domainLabels = []string{"domain", "uuid", "name", "flavor", "project_name"} |
| 67 | } else { |
| 68 | domainLabels = []string{"domain", "uuid"} |
| 69 | } |
| 70 | return &LibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#{ |
| 71 | uriscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#uri.: uri, |
| 72 | exportNovaMetadatascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#exportNovaMetadata.: exportNovaMetadata, |
| 73 | libvirtUpDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtUpDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 74 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "", "up"), |
| 75 | "Whether scraping libvirt's metrics was successful.", |
| 76 | nil, |
| 77 | nil), |
| 78 | libvirtDomainsNumberDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainsNumberDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 79 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "", "domains_number"), |
| 80 | "Number of domains.", |
| 81 | nil, |
| 82 | nil), |
| 83 | libvirtDomainStateCodescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainStateCode.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 84 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "", "domain_state_code"), |
| 85 | "State of the domain.", |
| 86 | domainLabels, |
| 87 | nil), |
| 88 | libvirtDomainInfoMaxMemDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMaxMemDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 89 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_info", "maximum_memory_bytes"), |
| 90 | "Maximum allowed memory of the domain, in bytes.", |
| 91 | domainLabels, |
| 92 | nil), |
| 93 | libvirtDomainInfoMemoryDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMemoryDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 94 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_info", "memory_usage_bytes"), |
| 95 | "Memory usage of the domain, in bytes.", |
| 96 | domainLabels, |
| 97 | nil), |
| 98 | libvirtDomainInfoNrVirtCpuDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoNrVirtCpuDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 99 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_info", "virtual_cpus"), |
| 100 | "Number of virtual CPUs for the domain.", |
| 101 | domainLabels, |
| 102 | nil), |
| 103 | libvirtDomainInfoCpuTimeDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoCpuTimeDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 104 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_info", "cpu_time_seconds_total"), |
| 105 | "Amount of CPU time used by the domain, in seconds.", |
| 106 | domainLabels, |
| 107 | nil), |
| 108 | libvirtDomainBlockRdBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdBytesDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 109 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "read_bytes_total"), |
| 110 | "Number of bytes read from a block device, in bytes.", |
| 111 | append(domainLabels, "source_file", "target_device"), |
| 112 | nil), |
| 113 | libvirtDomainBlockRdReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdReqDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 114 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "read_requests_total"), |
| 115 | "Number of read requests from a block device.", |
| 116 | append(domainLabels, "source_file", "target_device"), |
| 117 | nil), |
| 118 | libvirtDomainBlockRdTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdTotalTimesDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 119 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "read_seconds_total"), |
| 120 | "Amount of time spent reading from a block device, in seconds.", |
| 121 | append(domainLabels, "source_file", "target_device"), |
| 122 | nil), |
| 123 | libvirtDomainBlockWrBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrBytesDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 124 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "write_bytes_total"), |
| 125 | "Number of bytes written from a block device, in bytes.", |
| 126 | append(domainLabels, "source_file", "target_device"), |
| 127 | nil), |
| 128 | |
| 129 | libvirtDomainBlockWrReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrReqDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 130 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "write_requests_total"), |
| 131 | "Number of write requests from a block device.", |
| 132 | append(domainLabels, "source_file", "target_device"), |
| 133 | nil), |
| 134 | libvirtDomainBlockWrTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrTotalTimesDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 135 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "write_seconds_total"), |
| 136 | "Amount of time spent writing from a block device, in seconds.", |
| 137 | append(domainLabels, "source_file", "target_device"), |
| 138 | nil), |
| 139 | libvirtDomainBlockFlushReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushReqDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 140 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "flush_requests_total"), |
| 141 | "Number of flush requests from a block device.", |
| 142 | append(domainLabels, "source_file", "target_device"), |
| 143 | nil), |
| 144 | libvirtDomainBlockFlushTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushTotalTimesDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 145 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_block_stats", "flush_seconds_total"), |
| 146 | "Amount of time spent flushing of a block device, in seconds.", |
| 147 | append(domainLabels, "source_file", "target_device"), |
| 148 | nil), |
| 149 | |
| 150 | libvirtDomainInterfaceRxBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxBytesDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 151 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "receive_bytes_total"), |
| 152 | "Number of bytes received on a network interface, in bytes.", |
| 153 | append(domainLabels, "source_bridge", "target_device"), |
| 154 | nil), |
| 155 | libvirtDomainInterfaceRxPacketsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxPacketsDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 156 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "receive_packets_total"), |
| 157 | "Number of packets received on a network interface.", |
| 158 | append(domainLabels, "source_bridge", "target_device"), |
| 159 | nil), |
| 160 | libvirtDomainInterfaceRxErrsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxErrsDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 161 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "receive_errors_total"), |
| 162 | "Number of packet receive errors on a network interface.", |
| 163 | append(domainLabels, "source_bridge", "target_device"), |
| 164 | nil), |
| 165 | libvirtDomainInterfaceRxDropDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxDropDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 166 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "receive_drops_total"), |
| 167 | "Number of packet receive drops on a network interface.", |
| 168 | append(domainLabels, "source_bridge", "target_device"), |
| 169 | nil), |
| 170 | libvirtDomainInterfaceTxBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxBytesDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 171 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "transmit_bytes_total"), |
| 172 | "Number of bytes transmitted on a network interface, in bytes.", |
| 173 | append(domainLabels, "source_bridge", "target_device"), |
| 174 | nil), |
| 175 | libvirtDomainInterfaceTxPacketsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxPacketsDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 176 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "transmit_packets_total"), |
| 177 | "Number of packets transmitted on a network interface.", |
| 178 | append(domainLabels, "source_bridge", "target_device"), |
| 179 | nil), |
| 180 | libvirtDomainInterfaceTxErrsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxErrsDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 181 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "transmit_errors_total"), |
| 182 | "Number of packet transmit errors on a network interface.", |
| 183 | append(domainLabels, "source_bridge", "target_device"), |
| 184 | nil), |
| 185 | libvirtDomainInterfaceTxDropDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxDropDesc.: prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.NewDescscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/NewDesc().( |
| 186 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.BuildFQNamescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/BuildFQName().("libvirt", "domain_interface_stats", "transmit_drops_total"), |
| 187 | "Number of packet transmit drops on a network interface.", |
| 188 | append(domainLabels, "source_bridge", "target_device"), |
| 189 | nil), |
| 190 | }, nil |
| 191 | } |
| 192 | |
| 193 | // Describe returns metadata for all Prometheus metrics that may be exported. |
| 194 | func (e *LibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#) Describescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#Describe().(ch chan<- *prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Descscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Desc#) { |
| 195 | ch <- e.libvirtUpDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtUpDesc. |
| 196 | ch <- e.libvirtDomainsNumberDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainsNumberDesc. |
| 197 | |
| 198 | ch <- e.libvirtDomainStateCodescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainStateCode. |
| 199 | ch <- e.libvirtDomainInfoMaxMemDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMaxMemDesc. |
| 200 | ch <- e.libvirtDomainInfoMemoryDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMemoryDesc. |
| 201 | ch <- e.libvirtDomainInfoNrVirtCpuDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoNrVirtCpuDesc. |
| 202 | ch <- e.libvirtDomainInfoCpuTimeDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoCpuTimeDesc. |
| 203 | |
| 204 | ch <- e.libvirtDomainBlockRdBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdBytesDesc. |
| 205 | ch <- e.libvirtDomainBlockRdReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdReqDesc. |
| 206 | ch <- e.libvirtDomainBlockRdTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdTotalTimesDesc. |
| 207 | ch <- e.libvirtDomainBlockWrBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrBytesDesc. |
| 208 | ch <- e.libvirtDomainBlockWrReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrReqDesc. |
| 209 | ch <- e.libvirtDomainBlockWrTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrTotalTimesDesc. |
| 210 | ch <- e.libvirtDomainBlockFlushReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushReqDesc. |
| 211 | ch <- e.libvirtDomainBlockFlushTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushTotalTimesDesc. |
| 212 | } |
| 213 | |
| 214 | // Collect scrapes Prometheus metrics from libvirt. |
| 215 | func (e *LibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#) Collectscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#Collect().(ch chan<- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Metricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Metric#) { |
| 216 | err := e.CollectFromLibvirtscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#CollectFromLibvirt().(ch) |
| 217 | if err == nil { |
| 218 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 219 | e.libvirtUpDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtUpDesc., |
| 220 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.GaugeValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/GaugeValue., |
| 221 | 1.0) |
| 222 | } else { |
| 223 | logscip-go gomod github.com/golang/go/src go1.12 log/.Printfscip-go gomod github.com/golang/go/src go1.12 log/Printf().("Failed to scrape metrics: %s", err) |
| 224 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 225 | e.libvirtUpDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtUpDesc., |
| 226 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.GaugeValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/GaugeValue., |
| 227 | 0.0) |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | // CollectFromLibvirt obtains Prometheus metrics from all domains in a |
| 232 | // libvirt setup. |
| 233 | func (e *LibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#) CollectFromLibvirtscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#CollectFromLibvirt().(ch chan<- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Metricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Metric#) error { |
| 234 | conn, err := libvirtscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/.NewConnectscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/NewConnect().(e.uriscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#uri.) |
| 235 | if err != nil { |
| 236 | return err |
| 237 | } |
| 238 | defer conn.Closescip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Connect#Close().() |
| 239 | |
| 240 | // Use ListDomains() as opposed to using ListAllDomains(), as |
| 241 | // the latter is unsupported when talking to a system using |
| 242 | // libvirt 0.9.12 or older. |
| 243 | domainIds, err := conn.ListDomainsscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Connect#ListDomains().() |
| 244 | if err != nil { |
| 245 | return err |
| 246 | } |
| 247 | // number of domains |
| 248 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 249 | e.libvirtDomainsNumberDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainsNumberDesc., |
| 250 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.GaugeValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/GaugeValue., |
| 251 | float64(len(domainIds))) |
| 252 | |
| 253 | for _, id := range domainIds { |
| 254 | domain, err := conn.LookupDomainByIdscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Connect#LookupDomainById().(id) |
| 255 | if err == nil { |
| 256 | err = e.CollectDomainscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#CollectDomain().(ch, domain) |
| 257 | domain.Freescip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Domain#Free().() |
| 258 | if err != nil { |
| 259 | return err |
| 260 | } |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | return nil |
| 265 | } |
| 266 | |
| 267 | // CollectDomain extracts Prometheus metrics from a libvirt domain. |
| 268 | func (e *LibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#) CollectDomainscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#CollectDomain().(ch chan<- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.Metricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/Metric#, domain *libvirtscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/.Domainscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Domain#) error { |
| 269 | // Decode XML description of domain to get block device names, etc. |
| 270 | xmlDesc, err := domain.GetXMLDescscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Domain#GetXMLDesc().(0) |
| 271 | if err != nil { |
| 272 | return err |
| 273 | } |
| 274 | var desc libvirt_schemascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/.Domainscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Domain# |
| 275 | err = xmlscip-go gomod github.com/golang/go/src go1.12 `encoding/xml`/.Unmarshalscip-go gomod github.com/golang/go/src go1.12 `encoding/xml`/Unmarshal().([]byte(xmlDesc), &desc) |
| 276 | if err != nil { |
| 277 | return err |
| 278 | } |
| 279 | |
| 280 | domainName, err := domain.GetNamescip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Domain#GetName().() |
| 281 | if err != nil { |
| 282 | return err |
| 283 | } |
| 284 | var domainUUID = desc.UUIDscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Domain#UUID. |
| 285 | |
| 286 | // Extract domain label valuies |
| 287 | var domainLabelValues []string |
| 288 | if e.exportNovaMetadatascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#exportNovaMetadata. { |
| 289 | var ( |
| 290 | novaName = desc.Metadatascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Domain#Metadata..NovaInstancescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Metadata#NovaInstance..Namescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/NovaInstance#Name. |
| 291 | novaFlavor = desc.Metadatascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Domain#Metadata..NovaInstancescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Metadata#NovaInstance..Flavorscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/NovaInstance#Flavor..Namescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/NovaFlavor#Name. |
| 292 | novaProjectName = desc.Metadatascip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Domain#Metadata..NovaInstancescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Metadata#NovaInstance..Ownerscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/NovaInstance#Owner..ProjectNamescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/NovaOwner#ProjectName. |
| 293 | ) |
| 294 | domainLabelValues = []string{domainName, domainUUID, novaName, novaFlavor, novaProjectName} |
| 295 | } else { |
| 296 | domainLabelValues = []string{domainName, domainUUID} |
| 297 | } |
| 298 | |
| 299 | // Report domain info. |
| 300 | info, err := domain.GetInfoscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Domain#GetInfo().() |
| 301 | if err != nil { |
| 302 | return err |
| 303 | } |
| 304 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 305 | e.libvirtDomainStateCodescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainStateCode., |
| 306 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.GaugeValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/GaugeValue., |
| 307 | float64(info.Statescip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInfo#State.), |
| 308 | domainLabelValues...) |
| 309 | |
| 310 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 311 | e.libvirtDomainInfoMaxMemDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMaxMemDesc., |
| 312 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.GaugeValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/GaugeValue., |
| 313 | float64(info.MaxMemscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInfo#MaxMem.)*1024, |
| 314 | domainLabelValues...) |
| 315 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 316 | e.libvirtDomainInfoMemoryDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoMemoryDesc., |
| 317 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.GaugeValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/GaugeValue., |
| 318 | float64(info.Memoryscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInfo#Memory.)*1024, |
| 319 | domainLabelValues...) |
| 320 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 321 | e.libvirtDomainInfoNrVirtCpuDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoNrVirtCpuDesc., |
| 322 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.GaugeValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/GaugeValue., |
| 323 | float64(info.NrVirtCpuscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInfo#NrVirtCpu.), |
| 324 | domainLabelValues...) |
| 325 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 326 | e.libvirtDomainInfoCpuTimeDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInfoCpuTimeDesc., |
| 327 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 328 | float64(info.CpuTimescip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInfo#CpuTime.)/1e9, |
| 329 | domainLabelValues...) |
| 330 | |
| 331 | // Report block device statistics. |
| 332 | for _, disk := range desc.Devicesscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Domain#Devices..Disksscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Devices#Disks. { |
| 333 | if disk.Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Device. == "cdrom" || disk.Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Device. == "fd" { |
| 334 | continue |
| 335 | } |
| 336 | |
| 337 | blockStats, err := domain.BlockStatsscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Domain#BlockStats().(disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.) |
| 338 | if err != nil { |
| 339 | return err |
| 340 | } |
| 341 | |
| 342 | if blockStats.RdBytesSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#RdBytesSet. { |
| 343 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 344 | e.libvirtDomainBlockRdBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdBytesDesc., |
| 345 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 346 | float64(blockStats.RdBytesscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#RdBytes.), |
| 347 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 348 | } |
| 349 | if blockStats.RdReqSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#RdReqSet. { |
| 350 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 351 | e.libvirtDomainBlockRdReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdReqDesc., |
| 352 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 353 | float64(blockStats.RdReqscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#RdReq.), |
| 354 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 355 | } |
| 356 | if blockStats.RdTotalTimesSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#RdTotalTimesSet. { |
| 357 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 358 | e.libvirtDomainBlockRdTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockRdTotalTimesDesc., |
| 359 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 360 | float64(blockStats.RdTotalTimesscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#RdTotalTimes.)/1e9, |
| 361 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 362 | } |
| 363 | if blockStats.WrBytesSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#WrBytesSet. { |
| 364 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 365 | e.libvirtDomainBlockWrBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrBytesDesc., |
| 366 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 367 | float64(blockStats.WrBytesscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#WrBytes.), |
| 368 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 369 | } |
| 370 | if blockStats.WrReqSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#WrReqSet. { |
| 371 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 372 | e.libvirtDomainBlockWrReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrReqDesc., |
| 373 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 374 | float64(blockStats.WrReqscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#WrReq.), |
| 375 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 376 | } |
| 377 | if blockStats.WrTotalTimesSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#WrTotalTimesSet. { |
| 378 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 379 | e.libvirtDomainBlockWrTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockWrTotalTimesDesc., |
| 380 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 381 | float64(blockStats.WrTotalTimesscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#WrTotalTimes.)/1e9, |
| 382 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 383 | } |
| 384 | if blockStats.FlushReqSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#FlushReqSet. { |
| 385 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 386 | e.libvirtDomainBlockFlushReqDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushReqDesc., |
| 387 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 388 | float64(blockStats.FlushReqscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#FlushReq.), |
| 389 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 390 | } |
| 391 | if blockStats.FlushTotalTimesSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#FlushTotalTimesSet. { |
| 392 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 393 | e.libvirtDomainBlockFlushTotalTimesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainBlockFlushTotalTimesDesc., |
| 394 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 395 | float64(blockStats.FlushTotalTimesscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainBlockStats#FlushTotalTimes.)/1e9, |
| 396 | append(domainLabelValues, disk.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Source..Filescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskSource#File., disk.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Disk#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/DiskTarget#Device.)...) |
| 397 | } |
| 398 | // Skip "Errs", as the documentation does not clearly |
| 399 | // explain what this means. |
| 400 | } |
| 401 | |
| 402 | // Report network interface statistics. |
| 403 | for _, iface := range desc.Devicesscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Domain#Devices..Interfacesscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Devices#Interfaces. { |
| 404 | if iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device. == "" { |
| 405 | continue |
| 406 | } |
| 407 | interfaceStats, err := domain.InterfaceStatsscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/Domain#InterfaceStats().(iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.) |
| 408 | if err != nil { |
| 409 | return err |
| 410 | } |
| 411 | |
| 412 | if interfaceStats.RxBytesSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxBytesSet. { |
| 413 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 414 | e.libvirtDomainInterfaceRxBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxBytesDesc., |
| 415 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 416 | float64(interfaceStats.RxBytesscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxBytes.), |
| 417 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 418 | } |
| 419 | if interfaceStats.RxPacketsSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxPacketsSet. { |
| 420 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 421 | e.libvirtDomainInterfaceRxPacketsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxPacketsDesc., |
| 422 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 423 | float64(interfaceStats.RxPacketsscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxPackets.), |
| 424 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 425 | } |
| 426 | if interfaceStats.RxErrsSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxErrsSet. { |
| 427 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 428 | e.libvirtDomainInterfaceRxErrsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxErrsDesc., |
| 429 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 430 | float64(interfaceStats.RxErrsscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxErrs.), |
| 431 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 432 | } |
| 433 | if interfaceStats.RxDropSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxDropSet. { |
| 434 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 435 | e.libvirtDomainInterfaceRxDropDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceRxDropDesc., |
| 436 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 437 | float64(interfaceStats.RxDropscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#RxDrop.), |
| 438 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 439 | } |
| 440 | if interfaceStats.TxBytesSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxBytesSet. { |
| 441 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 442 | e.libvirtDomainInterfaceTxBytesDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxBytesDesc., |
| 443 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 444 | float64(interfaceStats.TxBytesscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxBytes.), |
| 445 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 446 | } |
| 447 | if interfaceStats.TxPacketsSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxPacketsSet. { |
| 448 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 449 | e.libvirtDomainInterfaceTxPacketsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxPacketsDesc., |
| 450 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 451 | float64(interfaceStats.TxPacketsscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxPackets.), |
| 452 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 453 | } |
| 454 | if interfaceStats.TxErrsSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxErrsSet. { |
| 455 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 456 | e.libvirtDomainInterfaceTxErrsDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxErrsDesc., |
| 457 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 458 | float64(interfaceStats.TxErrsscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxErrs.), |
| 459 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 460 | } |
| 461 | if interfaceStats.TxDropSetscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxDropSet. { |
| 462 | ch <- prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustNewConstMetricscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustNewConstMetric().( |
| 463 | e.libvirtDomainInterfaceTxDropDescscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/LibvirtExporter#libvirtDomainInterfaceTxDropDesc., |
| 464 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.CounterValuescip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/CounterValue., |
| 465 | float64(interfaceStats.TxDropscip-go gomod github.com/libvirt/libvirt-go v5.5.0 `github.com/libvirt/libvirt-go`/DomainInterfaceStats#TxDrop.), |
| 466 | append(domainLabelValues, iface.Sourcescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Source..Bridgescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceSource#Bridge., iface.Targetscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/Interface#Target..Devicescip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter/libvirt_schema`/InterfaceTarget#Device.)...) |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | return nil |
| 471 | } |
| 472 | |
| 473 | func mainscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/main().() { |
| 474 | var ( |
| 475 | app = kingpinscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/.Newscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/New().("libvirt_exporter", "Prometheus metrics exporter for libvirt") |
| 476 | listenAddress = app.Flagscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/flagGroup#Flag().("web.listen-address", "Address to listen on for web interface and telemetry.").Defaultscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/FlagClause#Default().(":9177").Stringscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/parserMixin#String().() |
| 477 | metricsPath = app.Flagscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/flagGroup#Flag().("web.telemetry-path", "Path under which to expose metrics.").Defaultscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/FlagClause#Default().("/metrics").Stringscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/parserMixin#String().() |
| 478 | libvirtURI = app.Flagscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/flagGroup#Flag().("libvirt.uri", "Libvirt URI from which to extract metrics.").Defaultscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/FlagClause#Default().("qemu:///system").Stringscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/parserMixin#String().() |
| 479 | libvirtExportNovaMetadata = app.Flagscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/flagGroup#Flag().("libvirt.export-nova-metadata", "Export OpenStack Nova specific labels from libvirt domain xml").Defaultscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/FlagClause#Default().("false").Boolscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/FlagClause#Bool().() |
| 480 | ) |
| 481 | kingpinscip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/.MustParsescip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/MustParse().(app.Parsescip-go gomod gopkg.in/alecthomas/kingpin.v2 v2.2.6 `gopkg.in/alecthomas/kingpin.v2`/Application#Parse().(osscip-go gomod github.com/golang/go/src go1.12 os/.Argsscip-go gomod github.com/golang/go/src go1.12 os/Args.[1:])) |
| 482 | |
| 483 | exporter, err := NewLibvirtExporterscip-go gomod github.com/kumina/libvirt_exporter . `github.com/kumina/libvirt_exporter`/NewLibvirtExporter().(*libvirtURI, *libvirtExportNovaMetadata) |
| 484 | if err != nil { |
| 485 | panic(err) |
| 486 | } |
| 487 | prometheusscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/.MustRegisterscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus`/MustRegister().(exporter) |
| 488 | |
| 489 | httpscip-go gomod github.com/golang/go/src go1.12 `net/http`/.Handlescip-go gomod github.com/golang/go/src go1.12 `net/http`/Handle().(*metricsPath, promhttpscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus/promhttp`/.Handlerscip-go gomod github.com/prometheus/client_golang v1.0.0 `github.com/prometheus/client_golang/prometheus/promhttp`/Handler().()) |
| 490 | httpscip-go gomod github.com/golang/go/src go1.12 `net/http`/.HandleFuncscip-go gomod github.com/golang/go/src go1.12 `net/http`/HandleFunc().("/", func(w httpscip-go gomod github.com/golang/go/src go1.12 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.12 `net/http`/ResponseWriter#, r *httpscip-go gomod github.com/golang/go/src go1.12 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.12 `net/http`/Request#) { |
| 491 | w.Writescip-go gomod github.com/golang/go/src go1.12 `net/http`/ResponseWriter#Write().([]byte(` |
| 492 | <html> |
| 493 | <head><title>Libvirt Exporter</title></head> |
| 494 | <body> |
| 495 | <h1>Libvirt Exporter</h1> |
| 496 | <p><a href='` + *metricsPath + `'>Metrics</a></p> |
| 497 | </body> |
| 498 | </html>`)) |
| 499 | }) |
| 500 | logscip-go gomod github.com/golang/go/src go1.12 log/.Fatalscip-go gomod github.com/golang/go/src go1.12 log/Fatal().(httpscip-go gomod github.com/golang/go/src go1.12 `net/http`/.ListenAndServescip-go gomod github.com/golang/go/src go1.12 `net/http`/ListenAndServe().(*listenAddress, nil)) |
| 501 | } |