umbraco-health-check by umbraco/umbraco-cms-backoffice-skills
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-health-checkUmbraco 中的健康检查允许您创建自定义的系统诊断,这些诊断会显示在健康检查仪表板中。它们用于验证您的 Umbraco 安装及相关服务是否正常运行。健康检查可以报告状态、显示警告,并提供解决问题的可操作建议。
在实施前请务必获取最新文档:
上下文 API : 当需要访问应用程序状态时
umbraco-context-api控制器 : 当为检查创建 API 端点时
umbraco-controllers广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
import type { ManifestHealthCheck } from '@umbraco-cms/backoffice/health-check';
export const manifests: Array<ManifestHealthCheck> = [
{
type: 'healthCheck',
alias: 'My.HealthCheck.Custom',
name: 'Custom Health Check',
api: () => import('./my-health-check.context.js'),
meta: {
label: 'Custom Check',
},
},
];
import { UmbHealthCheckContext } from '@umbraco-cms/backoffice/health-check';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { HealthCheckResultResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
export class MyHealthCheckContext extends UmbHealthCheckContext {
constructor(host: UmbControllerHost) {
super(host);
}
override async check(): Promise<HealthCheckResultResponseModel> {
// 执行您的健康检查逻辑
const isHealthy = await this.#performCheck();
return {
message: isHealthy ? 'All systems operational' : 'Issue detected',
resultType: isHealthy ? 'Success' : 'Warning',
actions: isHealthy ? [] : [
{
alias: 'fix-issue',
name: 'Fix Issue',
description: 'Attempt to automatically fix this issue',
},
],
};
}
async #performCheck(): Promise<boolean> {
// 在此处放置您的自定义检查逻辑
return true;
}
override async executeAction(actionAlias: string): Promise<HealthCheckResultResponseModel> {
if (actionAlias === 'fix-issue') {
// 执行修复操作
return {
message: 'Issue has been resolved',
resultType: 'Success',
actions: [],
};
}
return {
message: 'Unknown action',
resultType: 'Error',
actions: [],
};
}
}
export { MyHealthCheckContext as api };
interface ManifestHealthCheck extends ManifestBase {
type: 'healthCheck';
api: ApiLoaderProperty; // 应实现 UmbHealthCheckContext
meta: MetaHealthCheck;
}
interface MetaHealthCheck {
label: string;
}
// 结果类型: 'Success' | 'Warning' | 'Error' | 'Info'
interface HealthCheckResultResponseModel {
message: string;
resultType: string;
actions?: Array<{
alias: string;
name: string;
description?: string;
}>;
}
健康检查也可以实现为 C# 类,并由 Umbraco 自动发现。
using Umbraco.Cms.Core.HealthChecks;
namespace MyPackage.HealthChecks;
[HealthCheck(
"12345678-1234-1234-1234-123456789012",
"My Custom Check",
Description = "Verifies custom services are running",
Group = "Custom")]
public class MyHealthCheck : HealthCheck
{
public MyHealthCheck(HealthCheckContext context) : base(context) { }
public override Task<IEnumerable<HealthCheckStatus>> GetStatus()
{
var isHealthy = CheckMyService();
var status = new HealthCheckStatus(isHealthy ? "Service running" : "Service down")
{
ResultType = isHealthy ? StatusResultType.Success : StatusResultType.Error,
Actions = isHealthy ? null : new List<HealthCheckAction>
{
new("restart", Id) { Name = "Restart Service" }
}
};
return Task.FromResult<IEnumerable<HealthCheckStatus>>(new[] { status });
}
public override HealthCheckStatus ExecuteAction(HealthCheckAction action)
{
if (action.Alias == "restart")
{
RestartMyService();
return new HealthCheckStatus("Restarted") { ResultType = StatusResultType.Success };
}
throw new InvalidOperationException("Unknown action");
}
private bool CheckMyService() => true;
private void RestartMyService() { }
}
就是这样!请务必获取最新文档,保持示例简洁,生成完整可运行的代码。
每周安装数
74
代码仓库
GitHub 星标数
15
首次出现
2026年2月4日
安全审计
安装于
github-copilot55
cursor26
opencode24
codex24
gemini-cli22
amp22
Health Checks in Umbraco allow you to create custom system diagnostics that appear in the Health Check dashboard. They verify that your Umbraco installation and related services are functioning correctly. Health checks can report status, display warnings, and provide actionable recommendations for resolving issues.
Always fetch the latest docs before implementing:
Context API : When accessing application state
umbraco-context-apiControllers : When creating API endpoints for checks
umbraco-controllersimport type { ManifestHealthCheck } from '@umbraco-cms/backoffice/health-check';
export const manifests: Array<ManifestHealthCheck> = [
{
type: 'healthCheck',
alias: 'My.HealthCheck.Custom',
name: 'Custom Health Check',
api: () => import('./my-health-check.context.js'),
meta: {
label: 'Custom Check',
},
},
];
import { UmbHealthCheckContext } from '@umbraco-cms/backoffice/health-check';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { HealthCheckResultResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
export class MyHealthCheckContext extends UmbHealthCheckContext {
constructor(host: UmbControllerHost) {
super(host);
}
override async check(): Promise<HealthCheckResultResponseModel> {
// Perform your health check logic
const isHealthy = await this.#performCheck();
return {
message: isHealthy ? 'All systems operational' : 'Issue detected',
resultType: isHealthy ? 'Success' : 'Warning',
actions: isHealthy ? [] : [
{
alias: 'fix-issue',
name: 'Fix Issue',
description: 'Attempt to automatically fix this issue',
},
],
};
}
async #performCheck(): Promise<boolean> {
// Your custom check logic here
return true;
}
override async executeAction(actionAlias: string): Promise<HealthCheckResultResponseModel> {
if (actionAlias === 'fix-issue') {
// Execute the fix action
return {
message: 'Issue has been resolved',
resultType: 'Success',
actions: [],
};
}
return {
message: 'Unknown action',
resultType: 'Error',
actions: [],
};
}
}
export { MyHealthCheckContext as api };
interface ManifestHealthCheck extends ManifestBase {
type: 'healthCheck';
api: ApiLoaderProperty; // Should implement UmbHealthCheckContext
meta: MetaHealthCheck;
}
interface MetaHealthCheck {
label: string;
}
// Result types: 'Success' | 'Warning' | 'Error' | 'Info'
interface HealthCheckResultResponseModel {
message: string;
resultType: string;
actions?: Array<{
alias: string;
name: string;
description?: string;
}>;
}
Health checks can also be implemented as C# classes that are auto-discovered by Umbraco.
using Umbraco.Cms.Core.HealthChecks;
namespace MyPackage.HealthChecks;
[HealthCheck(
"12345678-1234-1234-1234-123456789012",
"My Custom Check",
Description = "Verifies custom services are running",
Group = "Custom")]
public class MyHealthCheck : HealthCheck
{
public MyHealthCheck(HealthCheckContext context) : base(context) { }
public override Task<IEnumerable<HealthCheckStatus>> GetStatus()
{
var isHealthy = CheckMyService();
var status = new HealthCheckStatus(isHealthy ? "Service running" : "Service down")
{
ResultType = isHealthy ? StatusResultType.Success : StatusResultType.Error,
Actions = isHealthy ? null : new List<HealthCheckAction>
{
new("restart", Id) { Name = "Restart Service" }
}
};
return Task.FromResult<IEnumerable<HealthCheckStatus>>(new[] { status });
}
public override HealthCheckStatus ExecuteAction(HealthCheckAction action)
{
if (action.Alias == "restart")
{
RestartMyService();
return new HealthCheckStatus("Restarted") { ResultType = StatusResultType.Success };
}
throw new InvalidOperationException("Unknown action");
}
private bool CheckMyService() => true;
private void RestartMyService() { }
}
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Weekly Installs
74
Repository
GitHub Stars
15
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot55
cursor26
opencode24
codex24
gemini-cli22
amp22
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
高级前端开发工具集:React/Next.js项目脚手架、组件生成与性能优化
142 周安装
Commit Hygiene 指南:原子提交、PR审查与Git历史整洁的最佳实践
143 周安装
.NET配置绑定与验证指南:Microsoft.Extensions.Configuration最佳实践
142 周安装
密钥轮换自动化指南:实现零停机的API密钥、证书与凭据安全轮换策略
141 周安装
多语言集成指南:C++/Rust/Python/Node.js跨语言调用与gRPC通信最佳实践
144 周安装
公司调研AI工具 - 使用Exa API进行智能企业信息搜索与分析
73 周安装