Пример #1
0
 public Service(string ServiceName, string MachineName = "LOCALHOST", bool Active = true, string SMTPRelay = "relay.lsnj.org", string AlertAddress = "*****@*****.**", string FromAddress = "*****@*****.**", int HolddownTimer = 60, bool Muted = false)
 {
     SERVICENAME   = ServiceName;
     MACHINENAME   = MachineName;
     STATUS        = WinServices.GetServiceStatus(SERVICENAME, MACHINENAME);
     LASTCHECKED   = DateTime.Now;
     ACTIVE        = Active;
     SMTPRELAY     = SMTPRelay;
     ALERTADDRESS  = AlertAddress;
     FROMADDRESS   = FromAddress;
     HOLDDOWNTIMER = HolddownTimer;
     MUTED         = Muted;
     RECOVERED     = false;
 }
Пример #2
0
        public void CheckStatus()
        {
            string NEWSTATUS = WinServices.GetServiceStatus(SERVICENAME, MACHINENAME);

            if (STATUS != "RUNNING" && NEWSTATUS == "RUNNING")
            {
                RECOVERED = true;
            }

            if (STATUS != NEWSTATUS)
            {
                CHANGED = true;
            }
            else
            {
                CHANGED = false;
            }

            STATUS      = NEWSTATUS;
            LASTCHECKED = DateTime.Now;
        }