This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# my global config | |
global: | |
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. | |
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. | |
# scrape_timeout is set to the global default (10s). | |
# Alertmanager configuration | |
alerting: | |
alertmanagers: | |
- static_configs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HELP mock_tag_info mock_tag_info | |
# TYPE mock_tag_info gauge | |
mock_tag_info{instance="prometheus-mock-exporter",resource_group="fake-rg-01",resource_name="fake-vm-01",resource_type="Microsoft.Compute/virtualMachines",tag_client_name="Big Bucks Corp",tag_monitoring="enabled"} 1 | |
mock_tag_info{instance="prometheus-mock-exporter",resource_group="fake-rg-02",resource_name="fake-vm-02",resource_type="Microsoft.Compute/virtualMachines",tag_client_name="The Laundry Guys",tag_monitoring="enabled"} 1 | |
mock_tag_info{instance="prometheus-mock-exporter",resource_group="fake-rg-03",resource_name="fake-vm-03",resource_type="Microsoft.Compute/virtualMachines",tag_client_name="Sugar Shack 2000",tag_monitoring="enabled"} 1 | |
# HELP virtual_machine_up virtual_machine_up | |
# TYPE virtual_machine_up gauge | |
virtual_machine_up{resource_group="fake-rg-01",resource_name="fake-vm-01"} 1 | |
virtual_machine_up{resource_group="fake-rg-02",resource_name="fake-vm-02"} 0 | |
virtual_machine_up{resource_group="fake-rg-03",resource_name="fake-vm-03"} 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
label_metrics: | |
- { | |
"resource_name": "fake-vm-01", | |
"resource_group": "fake-rg-01", | |
"resource_type": "Microsoft.Compute/virtualMachines", | |
"tag_client_name": "Big Bucks Corp", | |
"tag_monitoring": "enabled", | |
"instance": "prometheus-mock-exporter" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
for i := 0; i <= collectorCount; i++ { | |
var cid CollectorID | |
cid = CollectorID(i) | |
got := cid.GetCollector() | |
got.Collect() | |
} | |
// running Collector B | |
ID_B.GetCollector().Collect() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (cid CollectorID) GetCollector() PapaCollector { | |
return [...]PapaCollector{ObjectA{}, ObjectB{}, ObjectC{}, ObjectD{}, ObjectD{}}[cid] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CollectorID int | |
const ( | |
ID_A CollectorID = iota | |
ID_B | |
ID_C | |
ID_D | |
ID_E | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CollectorID int | |
const ( | |
ID_A CollectorID = iota | |
ID_B | |
ID_C | |
ID_D | |
ID_E | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
for i := 0; i <= collectorCount; i++ { | |
InitializeCollector(i)() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func InitializeCollector(i int) func() { | |
return [...]interface{}{ | |
NewObjectACollector, | |
NewObjectBCollector, | |
NewObjectCCollector, | |
NewObjectDCollector, | |
NewObjectECollector, | |
}[i].(func()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
const ( | |
collectorCount = 4 | |
) |