Ingester state monitoring is best accomplished in the automation system. Here is a sample script to try.
Below is a script which monitors ingesters and will send an email whenever it detects that the ingester has changed state (come online or gone offline).
I typically schedule mine for every 5 minutes (*/5 * * * *), but you can control how often this script samples and alerts using the cron specification in the scripting API. Simply create a new script, upload the file you create (We call ours ingesterStateMonitoring.anko), and adjust the sender/receiver at the top.
ingesterStateMonitoring.anko :
var fromAddr = `sender@example.com`
var toAddr = `receiver@example.com`
MinVer(3, 3, 6)
require(`utils/ingesterTracker.ank`, `df2c1a8792d12be066fec5ea7146ba5325bbaa1d`)
require(`email/htmlEmail.ank`, `df2c1a8792d12be066fec5ea7146ba5325bbaa1d`)
var pit = PersistentIngesterTracker
err = pit.Load()
if err != nil {
return err
}
err = pit.Scan()
if err != nil {
return err
}
var changed = pit.ChangedStates()
if len(changed) == 0 {
return pit.Save() //we are done
}
//something changed, send an alert email
var online = pit.FilterState(`ONLINE`)
var em = htmlEmail
em.SetTitle(`Ingester State Change Alert`)
em.AddSubTitle(`Ingester State Changes`)
em.AddTable(pit.Table(changed))
em.AddSubTitle(`Online Ingesters`)
em.AddTable(pit.Table(online))
err = em.SendEmail(fromAddr, toAddr, `Ingester State Change`)
if err != nil {
return err
}
//we got the email off, its safe to save our state back
return pit.Save()
When ingesters go offline, or come online, you will get a nice email with a table and the state change transitions.
If you have any questions or you would like some help please reach out to support@gravwell.io