Website banner
Show a banner on your own website when services are down (“2 services are down”), driven by a published status page. When everything is fine the banner stays hidden, unless you ask for it to be shown (“All systems operational”).
Three ways to add it, from simplest to most controlled. Ready-to-copy files are
in the integrations/ folder of the repository.
In DumbMonit, open the status page’s settings (Status pages, Edit): the Status banner for your website section at the very bottom has the ready-filled HTML and PHP snippets with a Copy button, a link to this page, and a button to download the WordPress plugin as a .zip ready to upload.
HTML snippet
Section titled “HTML snippet”Paste this before </body>, with your server address and the page’s address:
<script async src="https://monit.example.com/api/public/status/my-page/banner.js" data-position="top" data-show="issues" data-lang="en"></script>| Attribute | Values | Default |
|---|---|---|
data-position | top, bottom | top |
data-show | issues (only when something is wrong), always | issues |
data-lang | en, fr, de, es, it, pt, pt-BR, ru, zh-Hans | page language, else en |
The script has no dependencies, draws inside a Shadow DOM so your styles do not
touch it, follows the visitor’s light or dark preference and can be dismissed
(until the browser tab is closed). It reads the page’s public JSON, which the
server allows any website to fetch (Access-Control-Allow-Origin: *, no
cookies). Only the status page’s public document is opened this way; the rest
of the API keeps its rules.
WordPress
Section titled “WordPress”Copy integrations/wordpress/dumbmonit-status-banner into
wp-content/plugins/, activate it, then open Settings > DumbMonit Banner
and enter the status page URL
(https://monit.example.com/api/public/status/my-page), the position and the
show mode. The plugin fetches the JSON on the server, caches it for one minute
and escapes everything it prints.
The DumbMonit server may be on a private (LAN) address: the plugin only ever
requests the exact URL you saved (checked against the
/api/public/status/<address> pattern, redirects disabled). If the address is
invalid, the settings page shows an error and keeps the previous value. If the
status page cannot be fetched, a warning is shown in the WordPress admin (and
when saving), instead of failing silently.
The banner text is translatable (text domain dumbmonit-status-banner, template
in languages/); it follows the WordPress site language. The public status JSON
carries no language, so it cannot choose one.
PHP include
Section titled “PHP include”For any PHP site, without a framework:
require __DIR__ . '/banner.php';dumbmonit_banner('https://monit.example.com/api/public/status/my-page', ['position' => 'top', 'show' => 'issues', 'ttl' => 60]);The helper accepts http and https URLs only, uses a 3-second timeout, does
not follow redirects, keeps a file cache in the temporary directory and prints
nothing if the server cannot be reached (the failure is written to the PHP error
log). Texts are in English by default; pass 'lang' => 'fr' or a 'strings'
array to change them. A private (LAN) address works. See integrations/php/example.php.