Ciro Iriarte wrote:
2008/9/25 David C. Rankin
: Listmates,
I have run into another challenge and I am trying to determine the proper and most efficient way to get remote data to display on a local machine. Part of what I want to do is to gather sensor data from remote machines for web display on a server. I can think of 2 ways to do it, but neither seems like the "right" way. For example what's best to retrieve the ls_sensor output from a box across the lan or internet?
First attempt was to force remote execution of 'sensors' via ssh and redirect the output to a file on the remote machine and rsync it back. On the remote site you would have a script called 'rem_sensors':
#!/bin/bash sensors > ~/tmp/savedsensors exit 0
On the local machine, you would have 'get_sensors':
#!/bin/bash rsync -av lanremotehost:~/tmp/savedsensors ~/tmp/host_snsr_data rsync -ave ssh netremotehost:~/tmp/savedsensors ~/tmp/host_snsr_data # and so on
The connection time is a bother, but with sshkeys, no interaction is required.
Next, I though I would just write a 3 line php script to execute sensors and then suck it back to the local box over http with lynx -dump or with rsync. The script on the remote is nothing but:
<?php $SENS = sensors; echo $SENS."\n"; ?>
This option seemed like trying to kill a mosquito with shotgun. What are some of the other ways you employ to get this type of script output back from a remote host? I'm looking for something lightweight and fast -- aren't we all. Any ideas would be greatly appreciated. Thanks.
-- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com
If you must do it that way, you can use:
*Option 1 Remote side: snmpd (you can define custom commands) Local side: snmpget (or php equivalent function)
*Option 2 Remote side: script through xinetd Local side: netcat+script (or php socket function)
This way you get data on demand (no stale status)
Regards, Ciro
Thank you Carlos, GT, Anders, Theo, Ken and Ciro, The brain trust added several pearls of wisdom again. Looks like I can add snmp to the "learned something new today category!" -- David C. Rankin, J.D., P.E. Rankin Law Firm, PLLC 510 Ochiltree Street Nacogdoches, Texas 75961 Telephone: (936) 715-9333 Facsimile: (936) 715-9339 www.rankinlawfirm.com -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org