Example #1
0
func testHttp(url string, config models.Configuration) bool {
	cmd := exec.Command("curl", "-s", url)
	err := cmd.Run()
	if err != nil {
		notifications.NotifySlack(fmt.Sprintf("%s is not responding", url), config)
		return false
	}
	return true
}
Example #2
0
func testPing(hostname string, isRetry bool, config models.Configuration) bool {
	cmd := exec.Command("ping", "-c1", hostname)
	err := cmd.Run()
	if err != nil {
		if isRetry == false {
			return testPing(hostname, true, config)
		}
		notifications.NotifySlack(fmt.Sprintf("%s is not responding", hostname), config)
		return false
	}
	return true
}