This commit is contained in:
2018-07-26 20:09:05 +00:00
parent 280239604c
commit 18e851c9c2
3 changed files with 165 additions and 23 deletions

View File

@@ -29,8 +29,90 @@ namespace rockfishCore.Controllers
[HttpGet("status")] [HttpGet("status")]
public dtoOpsStatus GetOpsStatus() public dtoOpsStatus GetOpsStatus()
{ {
dtoOpsStatus ret= new dtoOpsStatus(); dtoOpsStatus Ret = new dtoOpsStatus();
ret.MailMirrorOK=RfMail.MailIsMirroringProperly();
try
{
Ret.MailMirrorOK = RfMail.MailIsMirroringProperly();
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"Mail mirror: {ex.Message}\r\n";
}
try
{
Ret.AyaNovaWebsiteOK = OpsDiagnostics.CheckWebsite("https://www.ayanova.com/", "Ground Zero Tech-Works Inc.");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"AyaNova website: {ex.Message}\r\n";
}
try
{
Ret.APIWebsiteOK = OpsDiagnostics.CheckWebsite("https://api.ayanova.com/", "WorkorderTypes Enumeration");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"API website: {ex.Message}\r\n";
}
try
{
Ret.ContactFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/contact", "Contact.Email");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"Contact form website: {ex.Message}\r\n";
}
try
{
Ret.RequestFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/request", "Contact.Email");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"Request website: {ex.Message}\r\n";
}
try
{
Ret.RequestLiteFormOK = OpsDiagnostics.CheckWebsite("https://contact.ayanova.com/requestlite", "Contact.Email");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"RequestLite website: {ex.Message}\r\n";
}
try
{
Ret.SubversionOK = OpsDiagnostics.CheckWebsite("http://svn.helloayanova.com:3343/csvn/login/auth", "Subversion Edge");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"Subversion server: {ex.Message}\r\n";
}
try
{
Ret.ForumOK = OpsDiagnostics.CheckWebsite("http://forum.ayanova.com/", "AyaNova support resources");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"Forum: {ex.Message}\r\n";
}
try
{
Ret.DevOpsOK = OpsDiagnostics.CheckWebsite("https://test.helloayanova.com/api/v8/", "AyaNova server");
}
catch (Exception ex)
{
Ret.OpsCheckMessage += $"DevOps: {ex.Message}\r\n";
}
//PING? //PING?
//Can ping Spaces and all the servers we have, maybe do that first then proceed //Can ping Spaces and all the servers we have, maybe do that first then proceed
@@ -42,7 +124,6 @@ namespace rockfishCore.Controllers
//Contact form: https://contact.ayanova.com/contact //Contact form: https://contact.ayanova.com/contact
//Request form: https://contact.ayanova.com/request //Request form: https://contact.ayanova.com/request
//Request lite form: https://contact.ayanova.com/requestlite //Request lite form: https://contact.ayanova.com/requestlite
//subversion: https://svn.helloayanova.com:18080/svn/GZTWREPO/ (requires login)
//subversion admin: http://svn.helloayanova.com:3343/csvn/login/auth //subversion admin: http://svn.helloayanova.com:3343/csvn/login/auth
//Forum: http://forum.ayanova.com/ //Forum: http://forum.ayanova.com/
//devops: https://test.helloayanova.com/api/v8/ //devops: https://test.helloayanova.com/api/v8/
@@ -50,7 +131,7 @@ namespace rockfishCore.Controllers
//Need S3 library for c# //Need S3 library for c#
return ret; return Ret;
} }
public class dtoOpsStatus public class dtoOpsStatus
@@ -65,7 +146,22 @@ namespace rockfishCore.Controllers
public bool SubversionOK; public bool SubversionOK;
public bool DevOpsOK; public bool DevOpsOK;
public bool BackupOK; public bool BackupOK;
public string OpsCheckMessage;
public dtoOpsStatus()
{
MailMirrorOK = false;
ForumOK = false;
AyaNovaWebsiteOK = false;
APIWebsiteOK = false;
ContactFormOK = false;
RequestFormOK = false;
RequestLiteFormOK = false;
SubversionOK = false;
DevOpsOK = false;
BackupOK = false;
OpsCheckMessage = string.Empty;
}
} }

View File

@@ -40,7 +40,8 @@ namespace rockfishCore
{ {
services.AddDbContext<rockfishContext>( services.AddDbContext<rockfishContext>(
options => { options =>
{
options.UseSqlite(Configuration.GetConnectionString("rfdb")); options.UseSqlite(Configuration.GetConnectionString("rfdb"));
options.EnableSensitiveDataLogging(false); options.EnableSensitiveDataLogging(false);
} }
@@ -107,6 +108,14 @@ namespace rockfishCore
RfSchema.CheckAndUpdate(dbContext); RfSchema.CheckAndUpdate(dbContext);
//bool bMM=RfMail.MailIsMirroringProperly(); //bool bMM=RfMail.MailIsMirroringProperly();
try
{
var test = OpsDiagnostics.CheckWebsite("https://test.helloayanova.com/api/v8/", "AyaNova server");
}
catch (Exception ex)
{
string res = ex.Message;
}
}//eof }//eof
} }

37
util/OpsDiagnostics.cs Normal file
View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.IO;
using System.Net.Http;
using System.Net.Http.Headers;
namespace rockfishCore.Util
{
public static class OpsDiagnostics
{
private static HttpClient Client = new HttpClient();
public static bool CheckWebsite(string url, string mustContain)
{
bool Result = false;
var Response = Client.GetAsync(url).Result;
if (Response.IsSuccessStatusCode)
{
var PageText = Response.Content.ReadAsStringAsync().Result;
if(PageText.Contains(mustContain))
{
Result=true;
}
}
return Result;
}
}//eoc
}//eons