Status Page for monitoring your websites and applications with beautiful graphs, analytics, and plugins. Run on any type of environment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

51 lines
922 B

package checkins
import (
"github.com/statping/statping/utils"
"time"
)
func Samples() error {
log.Infoln("Inserting Sample Checkins...")
checkin1 := &Checkin{
Name: "Demo Checkin 1",
ServiceId: 1,
Interval: 3,
ApiKey: "demoCheckin123",
}
if err := checkin1.Create(); err != nil {
return err
}
checkin2 := &Checkin{
Name: "Example Checkin 2",
ServiceId: 2,
Interval: 1,
ApiKey: utils.RandomString(7),
}
if err := checkin2.Create(); err != nil {
return err
}
return nil
}
func SamplesChkHits() error {
log.Infoln("Inserting Sample Checkins Hits...")
checkTime := utils.Now().Add(-3 * time.Minute)
for i := int64(1); i <= 2; i++ {
checkHit := &CheckinHit{
Checkin: i,
From: "192.168.0.1",
CreatedAt: checkTime.UTC(),
}
if err := checkHit.Create(); err != nil {
return err
}
checkTime = checkTime.Add(1 * time.Minute)
}
return nil
}