Thought I’d share this since I hadn’t seen any related posts.
One issue I’ve been having lately, is once in a while Z-Wave devices just go “dead” and I don’t have any visibility into this. This can range from annoying (oh, I never got notified the laundry was done) to somewhat of a security problem (oh great, my door didn’t lock last night).
I’m already using Nagios to monitor my network, so I decided to investigate what it’d take to monitor the Z-wave devices inside Home Assistant.
To solve this, I installed the following plugin, check_json:
From there, I setup the following command in commands.cfg
Then I modified the file I have that checks my HASS install to the following:
define host {
use linux-server
host_name ha
alias Home Assistant Server
address ha
hostgroups linux-servers
}
define service {
use local-service
host_name ha
service_description HTTP
check_command check_http!-p 8123
}
define service {
use local-service
host_name ha
service_description Front Door Lock
check_command check_hass_device!zwave.front_door!ready
}
define service {
use local-service
host_name ha
service_description Washing Machine
check_command check_hass_device!zwave.washing_machine!ready
}
Basically, once that command is setup, it’s just a matter of setting the check_command to check_hass_device!entity_id!expected_status and things are good to go after that.
@pdobrien3 I was looking at your PR and the command example, and see that there must be things missing. Do you have a working check_json and a correct command definition?
@aherbjornsen, I can’t remember why I stopped using that plugin. Something had stopped working but I can’t remember what. I would love to get things back working. I only copied the info in the PR, it wasn’t my pull request.
ok, things are coming back to me. I followed your changes and get this:
(No output on stdout) stderr: Can’t locate HTTP/Request/Common.pm in @INC (you may need to install the HTTP::Request::Common module) (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base) at /usr/local/nagios/libexec/check_json line 5.
Then when I do sudo apt-get install libjson-perl libnagios-plugin-perl libwww-perl
I get:
Package libnagios-plugin-perl is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘libnagios-plugin-perl’ has no installation candidate
I’ had to do “apt-get install libnagios-plugin-perl” in order to get things to work.
But that did not throw any error messages, I’m on Ubuntu 16.04. I see that it’s not available on my Ubuntu 18.04 machine, so probably something has changed between those.
You can try “apt install libmonitoring-plugin-perl” instead?
(No output on stdout) stderr: Can’t locate Nagios/Plugin.pm in @INC (you may need to install the Nagios::Plugin module) (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base) at /usr/local/nagios/libexec/check_json line 8.
I updated the original plugin to use Monitoring::Plugin and also added the ability to use the Home Assistant API Tokens. Give it a try and see if it works for you:
This is the command I use to check the general API status: