[英]Best way to display real-time data from an SSH accesible file on webpage
I have a temperature logger that measures the records temperature values at specified time intervals. 我有一个温度记录器,它以指定的时间间隔测量记录的温度值。 Currently I push these to a google spreadsheet but would like to display the values automatically on a web-page.
目前,我将这些信息推送到Google电子表格中,但希望在网页上自动显示这些值。
I have no experience with anything to do with web-pages, except setting up a few Wordpress sites but am reasonably comfortable with C++, Python, Matlab and Java. 除了设置一些Wordpress网站外,我没有任何与网页有关的经验,但是对C ++,Python,Matlab和Java相当满意。
A complicating factor is that the machine is in a VPN, so that access it via SSH I need to join the VPN. 一个复杂的因素是该计算机位于VPN中,因此要通过SSH访问它,我需要加入VPN。
I suspect the best way is to have a Python script that periodically send a up-to-date file to the web-server via ftp and then some script on the server that plots this. 我怀疑最好的方法是拥有一个Python脚本,该脚本通过ftp定期将最新文件发送到Web服务器,然后在服务器上绘制该脚本。
My initial though was to use Python via something like CGI to read the data and create a plot on the server. 我最初的做法是通过CGI之类的工具使用Python读取数据并在服务器上创建图。 However, I have no idea what the best approach on the server side would be.
但是,我不知道服务器端的最佳方法是什么。 Is it worth to learn some PHP?
值得学习一些PHP吗? Or should I write a Java Applet?
还是应该编写Java Applet? Or CGI is the way to go?
还是要走CGI?
Thank you for your help 谢谢您的帮助
With phpseclib, a pure PHP SSH2 implementation: 使用phpseclib,一个纯PHP SSH2实现:
<?php
include('Net/SSH2.php');
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
exit('Login Failed');
}
function packet_handler($str)
{
echo $str;
@flush();
@ob_flush();
}
$ssh->exec('ping 127.0.0.1', 'packet_handler');
?>
Have a program monitor the file, either locally or via SSH. 让程序在本地或通过SSH监视文件。 Have that program push updates into your web backend, via HTTP API or such.
让该程序通过HTTP API等将更新推送到您的Web后端。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.