Work on #62: Add uptime percentage + badges

This commit is contained in:
TwinProduction
2020-12-29 20:22:17 -05:00
parent 3eb8299316
commit bc4380db19
25 changed files with 3457 additions and 80 deletions

View File

@ -32,6 +32,16 @@ func GetJSONEncodedServiceStatuses() ([]byte, error) {
return data, err
}
// GetUptimeByServiceGroupAndName returns the uptime of a service based on its group and name
func GetUptimeByServiceGroupAndName(group, name string) *core.Uptime {
key := fmt.Sprintf("%s_%s", group, name)
serviceStatus, exists := serviceStatuses[key]
if !exists {
return nil
}
return serviceStatus.Uptime
}
// Monitor loops over each services and starts a goroutine to monitor each services separately
func Monitor(cfg *config.Config) {
for _, service := range cfg.Services {