This is a module for MagicMirror². Shows informantion from nagios.
The module uses the JSON formatted Nagios status as formattted by php-nagios-json.
To install the module, just clone this repository to your modules folder:
git clone https://github.com/qistoph/MMM-nagios.git nagios
.
The run cd nagios
and npm install
to install the dependencies.
Pull the git updates: git pull
.
The update dependencies in the module folder: cd nagios
followed by npm install
.
To use this module, add it to the modules array in the config/config.js
file:
modules: [
{
module: 'nagios',
position: 'top_right',
header: 'Nagios - Services',
config: {
statusUrl: 'https://<YOUR URL>/',
username:'Basic auth username',
password: 'Basic auth password',
showDetails: true,
showHosts: false
}
},
{
module: 'nagios',
position: 'top_right',
header: 'Nagios - Hosts',
config: {
statusUrl: 'https://<YOUR URL>/',
username:'Basic auth username',
password: 'Basic auth password',
showDetails: true,
showHosts: true
}
}
]
The following properties can be configured:
Option | Description |
---|---|
statusUrl |
The URL to get the status from. Must be a php-nagios-json page. Required |
username |
HTTP Basic Auth username, if need to access the page. Optional |
password |
HTTP Basic Auth password, should be specified if the username is. Optional |
showDetails |
Show the service and host for each nagios status (except OK). Optional |
showHosts |
Show information about hosts instead of services. Default value: false |
reloadInterval |
Number of milliseconds between refresh. Default value: 5 * 60 * 1000 (5 minutes) |
labels |
Defines the labels for each type of status. Default value: See Default labels |
labels: {
'ok': 'Ok',
'warning': 'Warning',
'critical': 'Critical',
'unknown': 'Unknown'
}
This module supports the following notifications:
Notification | Description |
---|---|
SHOW_DETAILS |
Payload is a boolean indicating if the details should be shown, just like (showDetails in the config). |
.nagios-critical {
color: red;
}
.nagios-warning {
color: yellow;
}
.nagios-unknown {
color: orange;
}
.nagios-ok {
color: green;
}
If you would like the numbers to be colored, you can add the above code
to your css/custom.css
file. You might need to create that file if it
doesn't exist.
You can of course also use these CSS classes for differente styling.