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 _, f := range r.File { | |
if f.FileInfo().IsDir() { | |
os.MkdirAll(*dest+"/"+f.Name, os.ModePerm) | |
continue | |
} |
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() { | |
.... | |
r, err := zip.OpenReader(cbz) | |
if err != nil { | |
fmt.Println(err) | |
os.Exit(1) | |
} | |
defer r.Close() |
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 parseExt(path string) string { | |
split := strings.Split(path, ".") | |
return "." + split[len(split)-1] | |
} | |
func today() string { | |
now := time.Now() | |
return now.Format("20060102") | |
} |
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 ( | |
"flag" | |
"fmt" | |
"os" | |
"path/filepath" | |
) | |
func pathExists(path string) bool { |
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
groups: | |
- name: SLA Recording Rules | |
rules: | |
- record: with_silence:virtual_machine_up:bool | |
expr: sum(avg_over_time(with_silence:virtual_machine_up:bool{tag_monitoring="enabled"}[30d])) / count(avg_over_time(with_silence:virtual_machine_up:bool{tag_monitoring="enabled"}[30d])) | |
- record: with_silence:virtual_machine_up:bool | |
expr: > | |
(( | |
sum by(resource_group, resource_name) | |
(virtual_machine_up) |
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
(( | |
sum by(resource_group, resource_name) | |
(virtual_machine_up) | |
+ | |
sum by(resource_group, resource_name) | |
(alertmanager_silence_info) | |
OR | |
sum by(resource_group, resource_name) | |
(virtual_machine_up) | |
) >= bool 1) * on (resource_group, resource_name) group_left(resource_type, tag_client_name, tag_monitoring) |
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
(( | |
sum by(resource_group, resource_name) | |
(virtual_machine_up) | |
+ | |
sum by(resource_group, resource_name) | |
(alertmanager_silence_info) | |
OR | |
sum by(resource_group, resource_name) | |
(virtual_machine_up) | |
) >= bool 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
sum by(resource_group, resource_name) | |
(virtual_machine_up) | |
+ | |
sum by(resource_group, resource_name) | |
(alertmanager_silence_info) | |
OR | |
sum by(resource_group, resource_name) | |
(virtual_machine_up) |
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
# HELP alertmanager_silence_end_seconds Alertmanager silence end time, elapsed seconds since epoch | |
# TYPE alertmanager_silence_end_seconds gauge | |
alertmanager_silence_end_seconds{id="7b7fc8ea-23f3-49fb-8851-8f8c13b9b584"} 1.5854976e+09 | |
alertmanager_silence_end_seconds{id="e412ea8c-a9f4-4683-9d70-3719a8a90729"} 1.586218042e+09 | |
# HELP alertmanager_silence_info Alertmanager silence info metric | |
# TYPE alertmanager_silence_info gauge | |
alertmanager_silence_info{comment="This is going to be long...",createdBy="codedumpster.io",id="e412ea8c-a9f4-4683-9d70-3719a8a90729",matcher_resource_group="fake-rg-02",matcher_resource_name="fake-vm-02",status="active"} 1 | |
alertmanager_silence_info{comment="none",createdBy="me",id="7b7fc8ea-23f3-49fb-8851-8f8c13b9b584",matcher_resource_group="fake-rg-05",matcher_resource_name="fake-vm-05",status="expired"} 0 | |
# HELP alertmanager_silence_start_seconds Alertmanager silence start time, elapsed seconds since epoch | |
# TYPE alertmanager_silence_start_seconds gauge |
NewerOlder