comparison host/admin/src/private/lib/monitor.luan @ 2022:969291201e12

ping lucene backups
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 20 Oct 2025 17:25:47 -0600
parents b8e5d53c4fc9
children
comparison
equal deleted inserted replaced
2021:b8e5d53c4fc9 2022:969291201e12
7 local Time = require "luan:Time.luan" 7 local Time = require "luan:Time.luan"
8 local Thread = require "luan:Thread.luan" 8 local Thread = require "luan:Thread.luan"
9 local Http = require "luan:http/Http.luan" 9 local Http = require "luan:http/Http.luan"
10 local Config = require "site:/private/Config.luan" 10 local Config = require "site:/private/Config.luan"
11 local Utils = require "site:/private/lib/Utils.luan" 11 local Utils = require "site:/private/lib/Utils.luan"
12 local send_mail = Utils.send_mail or error()
12 local Logging = require "luan:logging/Logging.luan" 13 local Logging = require "luan:logging/Logging.luan"
13 local logger = Logging.logger "monitor" 14 local logger = Logging.logger "monitor"
14 15
15 16
16 local who_monitors_who = { 17 local who_monitors_who = {
50 local s = Utils.ssh(domain,"/Users/administrator/luan/host/restart.sh monitoring") 51 local s = Utils.ssh(domain,"/Users/administrator/luan/host/restart.sh monitoring")
51 if trim(s) == "stopped with stop script" then 52 if trim(s) == "stopped with stop script" then
52 logger.info("stopped with stop script") 53 logger.info("stopped with stop script")
53 else 54 else
54 logger.error("restart successful\n"..s) 55 logger.error("restart successful\n"..s)
55 Utils.send_mail { 56 send_mail {
56 Subject = domain.." restarted" 57 Subject = domain.." restarted"
57 body = s 58 body = s
58 } 59 }
59 end 60 end
60 fails = 0 61 fails = 0
61 catch e 62 catch e
62 logger.error("restart failed: "..e.get_message()) 63 logger.error("restart failed: "..e.get_message())
63 if fails < 5 then 64 if fails < 5 then
64 Utils.send_mail { 65 send_mail {
65 Subject = domain.." restart failed" 66 Subject = domain.." restart failed"
66 body = e.get_message() 67 body = e.get_message()
67 } 68 }
68 end 69 end
69 end 70 end