Feature: Netdata service widget (#2672)

pull/2675/head
Mitchell 10 months ago committed by GitHub
parent 72efd9a08d
commit 7f621ed518
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,12 @@
---
title: Netdata
description: Netdata Widget Configuration
---
Allowed fields: `["warnings", "criticals"]`.
```yaml
widget:
type: Netdata
url: http://netdata.host.or.ip
```

@ -84,6 +84,7 @@ nav:
- widgets/services/moonraker.md
- widgets/services/mylar.md
- widgets/services/navidrome.md
- widgets/services/netdata.md
- widgets/services/nextcloud.md
- widgets/services/nextdns.md
- widgets/services/nginx-proxy-manager.md

@ -795,5 +795,9 @@
"digitalRelease": "Digital release",
"noEventsToday": "No events for today!",
"noEventsFound": "No events found"
},
"netdata": {
"warnings": "Warnings",
"criticals": "Criticals"
}
}

@ -58,6 +58,7 @@ const components = {
moonraker: dynamic(() => import("./moonraker/component")),
mylar: dynamic(() => import("./mylar/component")),
navidrome: dynamic(() => import("./navidrome/component")),
netdata: dynamic(() => import("./netdata/component")),
nextcloud: dynamic(() => import("./nextcloud/component")),
nextdns: dynamic(() => import("./nextdns/component")),
npm: dynamic(() => import("./npm/component")),

@ -0,0 +1,33 @@
import { useTranslation } from "next-i18next";
import Container from "components/services/widget/container";
import Block from "components/services/widget/block";
import useWidgetAPI from "utils/proxy/use-widget-api";
export default function Component({ service }) {
const { t } = useTranslation();
const { widget } = service;
const { data: netdataData, error: netdataError } = useWidgetAPI(widget, "info");
if (netdataError) {
return <Container service={service} error={netdataError} />;
}
if (!netdataData) {
return (
<Container service={service}>
<Block label="netdata.warnings" />
<Block label="netdata.criticals" />
</Container>
);
}
return (
<Container service={service}>
<Block label="netdata.warnings" value={t("common.number", { value: netdataData.alarms.warning })} />
<Block label="netdata.criticals" value={t("common.number", { value: netdataData.alarms.critical })} />
</Container>
);
}

@ -0,0 +1,14 @@
import genericProxyHandler from "utils/proxy/handlers/generic";
const widget = {
api: "{url}/api/v1/{endpoint}",
proxyHandler: genericProxyHandler,
mappings: {
info: {
endpoint: "info",
},
},
};
export default widget;

@ -50,6 +50,7 @@ import mjpeg from "./mjpeg/widget";
import moonraker from "./moonraker/widget";
import mylar from "./mylar/widget";
import navidrome from "./navidrome/widget";
import netdata from "./netdata/widget";
import nextcloud from "./nextcloud/widget";
import nextdns from "./nextdns/widget";
import npm from "./npm/widget";
@ -155,6 +156,7 @@ const widgets = {
moonraker,
mylar,
navidrome,
netdata,
nextcloud,
nextdns,
npm,

Loading…
Cancel
Save