mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-01 08:06:38 +00:00
Merge pull request #227 from szook/add-worker-process-name-to-w3wp-processes
append IIS worker process name to corresponding w3wp processes
This commit is contained in:
@@ -177,6 +177,11 @@ type Win32_PerfRawData_PerfProc_Process struct {
|
|||||||
WorkingSetPrivate uint64
|
WorkingSetPrivate uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WorkerProcess struct {
|
||||||
|
AppPoolName string
|
||||||
|
ProcessId uint32
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ProcessCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
func (c *ProcessCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Desc, error) {
|
||||||
var dst []Win32_PerfRawData_PerfProc_Process
|
var dst []Win32_PerfRawData_PerfProc_Process
|
||||||
q := queryAllWhere(&dst, c.queryWhereClause)
|
q := queryAllWhere(&dst, c.queryWhereClause)
|
||||||
@@ -184,6 +189,10 @@ func (c *ProcessCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var dst_wp []WorkerProcess
|
||||||
|
q_wp := queryAll(&dst_wp)
|
||||||
|
wmi.QueryNamespace(q_wp, &dst_wp, "root\\WebAdministration")
|
||||||
|
|
||||||
for _, process := range dst {
|
for _, process := range dst {
|
||||||
|
|
||||||
if process.Name == "_Total" {
|
if process.Name == "_Total" {
|
||||||
@@ -194,6 +203,13 @@ func (c *ProcessCollector) collect(ch chan<- prometheus.Metric) (*prometheus.Des
|
|||||||
pid := strconv.FormatUint(uint64(process.IDProcess), 10)
|
pid := strconv.FormatUint(uint64(process.IDProcess), 10)
|
||||||
cpid := strconv.FormatUint(uint64(process.CreatingProcessID), 10)
|
cpid := strconv.FormatUint(uint64(process.CreatingProcessID), 10)
|
||||||
|
|
||||||
|
for _, wp := range dst_wp {
|
||||||
|
if wp.ProcessId == process.IDProcess {
|
||||||
|
processName = strings.Join([]string{processName, wp.AppPoolName}, "_")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ch <- prometheus.MustNewConstMetric(
|
ch <- prometheus.MustNewConstMetric(
|
||||||
c.StartTime,
|
c.StartTime,
|
||||||
prometheus.GaugeValue,
|
prometheus.GaugeValue,
|
||||||
|
|||||||
Reference in New Issue
Block a user