2015-08-23 03:20:58 +00:00
|
|
|
package engine
|
|
|
|
|
|
|
|
import (
|
2015-08-24 05:28:45 +00:00
|
|
|
"log"
|
|
|
|
"fmt"
|
2015-08-23 03:20:58 +00:00
|
|
|
"time"
|
|
|
|
"../core"
|
|
|
|
"../checks"
|
|
|
|
)
|
|
|
|
|
2015-08-24 05:28:45 +00:00
|
|
|
func createCheck(engine *core.Engine, host core.TargetConfig) *core.GenericCheck {
|
|
|
|
log.Print("createCheck called")
|
|
|
|
log.Print(fmt.Sprintf("creating a `%s`", host.Type))
|
2015-08-23 03:20:58 +00:00
|
|
|
config := core.CheckCreateConfig{
|
|
|
|
engine,
|
2015-08-24 05:28:45 +00:00
|
|
|
time.Duration(int64(host.Interval)) * time.Second,
|
2015-08-23 03:20:58 +00:00
|
|
|
host,
|
|
|
|
}
|
|
|
|
switch host.Type {
|
|
|
|
case "http", "https":
|
2015-08-24 05:28:45 +00:00
|
|
|
return checks.NewHttpChecker(config)
|
2015-08-23 03:20:58 +00:00
|
|
|
}
|
2015-08-24 05:28:45 +00:00
|
|
|
return nil
|
2015-08-23 03:20:58 +00:00
|
|
|
}
|