public DobermanResult Execute() { var result = new DobermanResult { Check = CheckName }; try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(PageUrl)); request.Timeout = TimeOut; request.KeepAlive = false; request.Headers.Add("Cache-Control", "no-cache"); request.Headers.Add("Pragma", "no-cache"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); // TODO: I think there maybe more work required here to ensure that the home page is functioning as expected. result.Success = (response.StatusCode == HttpStatusCode.OK); if (result.Success) result.Detail = PageUrl + " is loading just fine."; response.Close(); request.Abort(); } catch (Exception ex) { result.Success = false; result.Detail = ex.Message; } return result; }
public DobermanResult Execute() { var result = new DobermanResult { Check = CheckName }; try { MongoServer server = MongoServer.Create(ConnectionString); server.Connect(); server.Disconnect(); result.Detail = "Can connect to Mongo DB just fine."; result.Success = true; } catch (Exception ex) { result.Detail = ex.Message; result.Success = false; } return result; }
public DobermanResult Execute() { var result = new DobermanResult { Check = CheckName }; try { using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); } result.Detail = "Can connect to SQL Server just fine."; result.Success = true; } catch (Exception ex) { result.Detail = ex.Message; result.Success = false; } return result; }
public DobermanResult Execute() { var result = new DobermanResult { Check = CheckName }; if (File.Exists(Path)) { result.Success = true; result.Detail = _originalPath + " file does exist."; } else if (Directory.Exists(Path)) { result.Success = true; result.Detail = _originalPath + " directory does exist."; } else { result.Success = false; result.Detail = "Unable to locate file or directory matching " + _originalPath + "."; } return result; }
public DobermanResult Execute() { var result = new DobermanResult { Check = CheckName }; var connected = CheckConnectionToHost(); if (connected == true && _firstResponse.StartsWith("220") && _secondResponse.StartsWith("250")) { result.Success = true; result.Detail = "Connected to SMTP server that is ready to send emails successfully."; } else if (connected == false) { result.Success = false; result.Detail = "Unable to connect to the SMTP server (" + SmtpSettings.Host + ":" + SmtpSettings.Port + ")"; } else { result.Success = false; result.Detail = _firstResponse + " & " + _secondResponse; } return result; }