Closed The-Exterminator closed 3 years ago
Note - in working on these this evening, I've noticed there's something going on with the way the responses are handled by the module when more than one instance is being shown. Sometimes they seem to get mixed up. As a workaround for now, you can add a loadDelay: 5
(for example) to one of the modules' configs so they receive their pings at different times.
Hello,
I've made a quick template that just has the status for each response on a new line (no table or anything fancy). Save the following into the templates folder as simpleList.njk
:
{% if pingResults %}
<div class="light small">
{% for ping in pingResults %}
{% if ping.isAlive %}
<span style="color: {{ config.upColor }};" class="fas fa-{{ config.upSymbol }}"></span> {{ ping.name }} {{ config.upText }}
{% else %}
<span style="color: {{ config.downColor }};" class="fas fa-{{ config.downSymbol }}"></span> {{ ping.name }} {{ config.downText }}
{% endif %}
<br />
{% endfor %}
</div>
{% else %}
<div class="dimmed xsmall">Loading...</div>
{% endif %}
As for the configs, you can use:
{
module: "MMM-ServerStatus",
position: "bottom_left",
header: "People",
config: {
group: "people",
templateName: "simpleList",
hosts: [
{ name: "NAME", ip: "IP" },
// Add your targets here
],
pingInterval: 10,
upSymbol: "user",
upColor: "green",
upText: "is home",
downSymbol: "user",
downColor: "red",
downText: "is away"
}
},
{
module: "MMM-ServerStatus",
position: "bottom_left",
header: "Devices",
config: {
group: "devices",
templateName: "simpleList",
hosts: [
{ name: "NAME", ip: "IP" },
// Add your targets here
],
pingInterval: 10,
upSymbol: "check-circle",
upColor: "green",
upText: "is on",
downSymbol: "times-circle",
downColor: "red",
downText: "is off"
}
}
Note how these two configs use the same template - I've set the template to use the symbols, colours, and text that is given in the config instead.
Note - in working on these this evening, I've noticed there's something going on with the way the responses are handled by the module when more than one instance is being shown. Sometimes they seem to get mixed up. As a workaround for now, you can add a
loadDelay: 5
(for example) to one of the modules' configs so they receive their pings at different times.Hello,
I've made a quick template that just has the status for each response on a new line (no table or anything fancy). Save the following into the templates folder as
simpleList.njk
:{% if pingResults %} <div class="light small"> {% for ping in pingResults %} {% if ping.isAlive %} <span style="color: {{ config.upColor }};" class="fas fa-{{ config.upSymbol }}"></span> {{ ping.name }} {{ config.upText }} {% else %} <span style="color: {{ config.downColor }};" class="fas fa-{{ config.downSymbol }}"></span> {{ ping.name }} {{ config.downText }} {% endif %} <br /> {% endfor %} </div> {% else %} <div class="dimmed xsmall">Loading...</div> {% endif %}
As for the configs, you can use:
{ module: "MMM-ServerStatus", position: "bottom_left", header: "People", config: { group: "people", templateName: "simpleList", hosts: [ { name: "NAME", ip: "IP" }, // Add your targets here ], pingInterval: 10, upSymbol: "user", upColor: "green", upText: "is home", downSymbol: "user", downColor: "red", downText: "is away" } }, { module: "MMM-ServerStatus", position: "bottom_left", header: "Devices", config: { group: "devices", templateName: "simpleList", hosts: [ { name: "NAME", ip: "IP" }, // Add your targets here ], pingInterval: 10, upSymbol: "check-circle", upColor: "green", upText: "is on", downSymbol: "times-circle", downColor: "red", downText: "is off" } }
Note how these two configs use the same template - I've set the template to use the symbols, colours, and text that is given in the config instead.
Thanks alot, i Will try that letter.
@XBCreepinJesus Thanks you, is work, nice modul you have made :)
Can you please make a example of both "Example uses" with group: and Templates???
Thanks