[opensuse] How to quickly get Remote Data from another box? bash? http?
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 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Thursday 2008-09-25 at 03:14 -0500, David C. Rankin wrote:
way. For example what's best to retrieve the ls_sensor output from a box across the lan or internet?
gkrellmd? ...
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.
Email :-) - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkjbZvkACgkQtTMYHG2NR9Xr9gCeO0at9YBbEvgdvhiLUfiATkNx lNUAn2j0tgOPdBNCpZAY2C9xygqT8WHO =/w0a -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 David C. Rankin wrote:
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.
err... IIRC nagios can do some of this monitoring stuff (though to call it light is distorting the English dictionary somewhat)... a possible alternative could be a simple script daemon on the target machines to broadcast a data packet at regular intervals and receiver daemon to monitor the relevant port and process the received data when received.... have a look at the Perl IPC stuff for ideas .... doing this with files is a bit clumsy (and probably a bit error prone)... - -- ============================================================================== I have always wished that my computer would be as easy to use as my telephone. My wish has come true. I no longer know how to use my telephone. Bjarne Stroustrup ============================================================================== -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkjbiccACgkQasN0sSnLmgJxbACgoBzvqGzm6PhNzKrzQVdQc/sA 3J4An3/L3WSvNCLm3Om05ySq+k1lXa+e =Jcwp -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 25 September 2008 10:14:26 David C. Rankin wrote:
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.
The general case of "retrieving script output" has no good solution (that I'm aware of). I think you're stuck with using ssh. But note that you don't have to redirect to a remote file and then fetch it, you can just redirect the output to a file locally ssh user@host command > outputfile will generate the file locally But in the special case of sensor data, I think the easiest is to use snmp. It was designed for this very thing, to get remote information for local use Anders -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
David C. Rankin wrote:
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?
What about this: http://sendxmpp.platon.sk/ "sendxmpp is in use on computers around the globe, for example for distributing CVS-commit alerts, sending server warnings and notifying users." -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Theo van Werkhoven pecked at the keyboard and wrote:
David C. Rankin wrote:
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?
What about this: http://sendxmpp.platon.sk/ "sendxmpp is in use on computers around the globe, for example for distributing CVS-commit alerts, sending server warnings and notifying users."
As was mentioned by Anders, use SNMP which was created for just this situation. You can use it to monitor temps, disk usage, network usage and more. -- Ken Schneider SuSe since Version 5.2, June 1998 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
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 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
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
participants (7)
-
Anders Johansson
-
Carlos E. R.
-
Ciro Iriarte
-
David C. Rankin
-
G T Smith
-
Ken Schneider
-
Theo van Werkhoven