mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Update endpoint URLs for status check script
This commit is contained in:
@@ -348,4 +348,62 @@ export default class API {
|
||||
|
||||
throw new APIException(`URL ${url ? url + ' ' : ''}is not available.`);
|
||||
}
|
||||
|
||||
public static getFriendlyErrorMessage(error: AxiosError | Error): string {
|
||||
const errorString: string = error.message || error.toString();
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('network error')) {
|
||||
return 'Network Error';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('timeout')) {
|
||||
return 'Timeout Error';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('request aborted')) {
|
||||
return 'Request Aborted';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('canceled')) {
|
||||
return 'Request Canceled';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('connection refused')) {
|
||||
return 'Connection Refused';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('connection reset')) {
|
||||
return 'Connection Reset';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('connection closed')) {
|
||||
return 'Connection Closed';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('connection failed')) {
|
||||
return 'Connection Failed';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('enotfound')) {
|
||||
return 'Cannot Find Host';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('econnreset')) {
|
||||
return 'Connection Reset';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('econnrefused')) {
|
||||
return 'Connection Refused';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('econnaborted')) {
|
||||
return 'Connection Aborted';
|
||||
}
|
||||
|
||||
if(errorString.toLocaleLowerCase().includes('certificate has expired')) {
|
||||
return 'SSL Certificate Expired';
|
||||
}
|
||||
|
||||
return errorString;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ export default class ProbeMonitorResponseService {
|
||||
(
|
||||
(input.dataToProcess as ProbeMonitorResponse)
|
||||
.failureCause || ''
|
||||
).replace('Error:', '');
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import MonitorsElement from '../../Components/Monitor/Monitors';
|
||||
import EventName from '../../Utils/EventName';
|
||||
import DashboardNavigation from '../../Utils/Navigation';
|
||||
import ProjectUser from '../../Utils/ProjectUser';
|
||||
import IncidentElement from './Incident';
|
||||
import BaseModel from 'Common/Models/BaseModel';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
import { Black } from 'Common/Types/BrandColors';
|
||||
@@ -524,7 +525,10 @@ const IncidentsTable: FunctionComponent<ComponentProps> = (
|
||||
title: true,
|
||||
},
|
||||
title: 'Title',
|
||||
type: FieldType.Text,
|
||||
type: FieldType.Element,
|
||||
getElement: (item: Incident): ReactElement => {
|
||||
return <IncidentElement incident={item} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: {
|
||||
|
||||
@@ -83,6 +83,17 @@ const WebsiteMonitorSummaryView: FunctionComponent<ComponentProps> = (
|
||||
/>
|
||||
</div>
|
||||
|
||||
{props.probeMonitorResponse.failureCause && <div className="flex space-x-3">
|
||||
<InfoCard
|
||||
className="w-full shadow-none border-2 border-gray-100 "
|
||||
title="Error"
|
||||
value={
|
||||
props.probeMonitorResponse.failureCause?.toString() ||
|
||||
'-'
|
||||
}
|
||||
/>
|
||||
</div>}
|
||||
|
||||
{showMoreDetails && fields.length > 0 && (
|
||||
<div>
|
||||
<Detail<ProbeMonitorResponse>
|
||||
|
||||
@@ -21,6 +21,7 @@ const app: ExpressApplication = Express.getExpressApp();
|
||||
|
||||
const APP_NAME: string = 'ingestor';
|
||||
|
||||
|
||||
app.use([`/${APP_NAME}`, '/'], AliveAPI);
|
||||
app.use([`/${APP_NAME}`, '/'], RegisterAPI);
|
||||
app.use([`/${APP_NAME}`, '/'], MonitorAPI);
|
||||
|
||||
@@ -166,7 +166,7 @@ export default class ApiMonitor {
|
||||
statusCode: 0,
|
||||
responseBody: '',
|
||||
responseHeaders: {},
|
||||
failureCause: (err as any).toString(),
|
||||
failureCause: API.getFriendlyErrorMessage(err as Error),
|
||||
};
|
||||
|
||||
// check if timeout exceeded and if yes, return null
|
||||
|
||||
@@ -6,6 +6,7 @@ import SSLMonitorReponse from 'Common/Types/Monitor/SSLMonitor/SslMonitorRespons
|
||||
import ObjectID from 'Common/Types/ObjectID';
|
||||
import PositiveNumber from 'Common/Types/PositiveNumber';
|
||||
import Sleep from 'Common/Types/Sleep';
|
||||
import API from 'Common/Utils/API';
|
||||
import ObjectUtil from 'Common/Utils/ObjectUtil';
|
||||
import logger from 'CommonServer/Utils/Logger';
|
||||
import { ClientRequest, IncomingMessage } from 'http';
|
||||
@@ -105,7 +106,7 @@ export default class SSLMonitor {
|
||||
|
||||
return {
|
||||
isOnline: false,
|
||||
failureCause: (err as any).toString(),
|
||||
failureCause: API.getFriendlyErrorMessage(err as Error),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -135,7 +136,7 @@ export default class SSLMonitor {
|
||||
} catch (err) {
|
||||
return {
|
||||
isOnline: false,
|
||||
failureCause: (err as any).toString(),
|
||||
failureCause: API.getFriendlyErrorMessage(err as Error),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import ObjectID from 'Common/Types/ObjectID';
|
||||
import PositiveNumber from 'Common/Types/PositiveNumber';
|
||||
import Sleep from 'Common/Types/Sleep';
|
||||
import WebsiteRequest, { WebsiteResponse } from 'Common/Types/WebsiteRequest';
|
||||
import API from 'Common/Utils/API';
|
||||
import logger from 'CommonServer/Utils/Logger';
|
||||
import { AxiosError } from 'axios';
|
||||
|
||||
@@ -136,7 +137,7 @@ export default class WebsiteMonitor {
|
||||
statusCode: err.response?.status,
|
||||
responseBody: err.response?.data,
|
||||
responseHeaders: (err.response?.headers as Headers) || {},
|
||||
failureCause: err.message || err.toString(),
|
||||
failureCause: API.getFriendlyErrorMessage(err),
|
||||
};
|
||||
} else {
|
||||
probeWebsiteResponse = {
|
||||
@@ -148,7 +149,7 @@ export default class WebsiteMonitor {
|
||||
statusCode: undefined,
|
||||
responseBody: undefined,
|
||||
responseHeaders: undefined,
|
||||
failureCause: (err as Error).toString(),
|
||||
failureCause: API.getFriendlyErrorMessage(err as Error),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -15,26 +15,39 @@ echo ""
|
||||
echo ""
|
||||
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "App" $HOST_TO_CHECK
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "App" $HOST_TO_CHECK/status/ready
|
||||
bash $scriptDir/endpoint-status.sh "App (Status Check)" $HOST_TO_CHECK/status
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "App (Ready Check)" $HOST_TO_CHECK/status/ready
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Dashboard" $HOST_TO_CHECK/dashboard
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Dashboard Status API" $HOST_TO_CHECK/dashboard/status/ready
|
||||
bash $scriptDir/endpoint-status.sh "Dashboard (Ready Check)" $HOST_TO_CHECK/dashboard/status/ready
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Dashboard (Status Check)" $HOST_TO_CHECK/dashboard/status
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Status Page" $HOST_TO_CHECK/status-page
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Status Page Status API" $HOST_TO_CHECK/status-page/status/ready
|
||||
bash $scriptDir/endpoint-status.sh "Status Page (Ready Check)" $HOST_TO_CHECK/status-page/status/ready
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Status Page (Status Check)" $HOST_TO_CHECK/status-page/status
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Accounts" $HOST_TO_CHECK/accounts
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Accounts Status API" $HOST_TO_CHECK/accounts/status/ready
|
||||
bash $scriptDir/endpoint-status.sh "Accounts (Ready Check)" $HOST_TO_CHECK/accounts/status/ready
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Accounts (Status Check)" $HOST_TO_CHECK/accounts/status
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Admin Dashboard" $HOST_TO_CHECK/admin/status/ready
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Admin Dashboard Status API" $HOST_TO_CHECK/admin
|
||||
bash $scriptDir/endpoint-status.sh "Admin Dashboard (Status Check)" $HOST_TO_CHECK/admin/status
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Ingestor" $HOST_TO_CHECK/ingestor/status/ready
|
||||
bash $scriptDir/endpoint-status.sh "Admin Dashboard (Ready Check)" $HOST_TO_CHECK/admin/status/ready
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Ingestor (Ready Check)" $HOST_TO_CHECK/ingestor/status/ready
|
||||
|
||||
bash $scriptDir/endpoint-status.sh "Ingestor (Status Check)" $HOST_TO_CHECK/ingestor/status
|
||||
|
||||
echo "🚀 OneUptime is up! 🚀"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user