Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request : Sensor Monitoring for other systems on the network #310

Closed
jldeen opened this issue Sep 1, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@jldeen
Copy link

commented Sep 1, 2015

Currently it seems the sensor component monitors the local system on which hass is installed, but I wonder if others would find it useful to check the same stats for other systems on the network via IP or DNS.

I am a very new developer and probably won't be useful with coding for awhile, but I would love to help with documentation, testing, etc. for this project.

@rmkraus

This comment has been minimized.

Copy link
Contributor

commented Sep 1, 2015

This could potentially be done. I'm sure it would get used of it were
available too. If you would like to try this, the following link has some
good resources about running commands on remote machines.

http://python-for-system-administrators.readthedocs.org/en/latest/ssh.html

On Tuesday, September 1, 2015, jldeen notifications@github.com wrote:

Currently it seems the sensor component monitors the local system on which
hass is installed, but I wonder if others would find it useful to check the
same stats for other systems on the network via IP or DNS.

I am a very new developer and probably won't be useful with coding for
awhile, but I would love to help with documentation, testing, etc. for this
project.


Reply to this email directly or view it on GitHub
#310.

Thanks,

Ryan Kraus

@fabaff

This comment has been minimized.

Copy link
Member

commented Sep 13, 2015

I submitted PR #356 which could help in getting stats from other systems. Well, this will need an external script to gather the data and would not be the most efficient way to do it but should work in a basic manner.

If you are exposing the needed data on the remote host through a REST API, then HA will be able to get those information. Ok, the generic rest sensor is still work in progress at the moment.

Just a proof-of-concept of how to create a smartdevice...Using Flask to create a REST API and psuti to access the system utilization information.

from psutil import cpu_percent
from flask import Flask
from flask_restful import Resource, Api

app = Flask(__name__)
api = Api(app)

class CpuLoad(Resource):
    def get(self):
        cpu = cpu_percent(interval=None)
        return {'cpu': '{}'.format(cpu)}

api.add_resource(CpuLoad, '/')

if __name__ == '__main__':
    app.run(debug=True)

If this script is running, the CPU data should be available.

$ curl -X GET http://127.0.0.1:5000/
{
    "cpu": "13.2"
}
@fabaff

This comment has been minimized.

Copy link
Member

commented Sep 13, 2015

As mentioned in my previous comment I now have proposed in PR #360 a generic REST sensor.

I guess that monitoring solutions (like cacti, monit, collectd, nagios, and alike) offers RESTful APIs to get access to their information. glances could be an option without the need of a full-blown monitoring setup.

@fabaff

This comment has been minimized.

Copy link
Member

commented Sep 14, 2015

Just an addition:

$ glances -w
Glances web server started on http://0.0.0.0:61208/

Webinterface (similar to the local ncurses interface): http://IP_ADDRESS:61208/

@fabaff fabaff referenced this issue Sep 14, 2015

Merged

Glances sensor #366

@balloob balloob closed this in #366 Sep 15, 2015

@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.