xymon-rclient.sh
list Kevin King
I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin
list Ralph Mitchell
Sounds like there's an empty variable in a test expression. Something like:
if [ $x = $y ]; then
......
fi
where either $x or $y is not set. If those variables were put in
double-quotes, at least you'd get an empty string.
Ralph Mitchell
▸
On Sep 27, 2012 10:59 AM, "Kevin King" <user-4c6c31ddcab2@xymon.invalid> wrote:
I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin
list Ryan Novosielski
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Do set -x or change the top line to read #!/bin/whatever -x -- adding in the -x. That will tell you like by line what is happening and show you which test is failing. Likely a variable isn't defined somewhere.
▸
On 09/27/2012 09:42 AM, Kevin King wrote:I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin
- -- - ---- _ _ _ _ ___ _ _ _
|Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |user-ae4522577e16@xymon.invalid - 973/972.0922 (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBkbsgACgkQmb+gadEcsb722wCdHWEJgkPHlUH4CBPH261+PKwq 9oIAoKR7Qa9cD9fnmXLLYoWtoyMc/Aj/ =lfmu -----END PGP SIGNATURE-----
list Kevin King
Thanks Ralph, I found the issue. the writer tested using bash as his /bin/sh so when I ran in on my server /bin/sh is not bash. fixed that then it ran... Now I am getting a garbled sed command.... sed: command garbled: 1,/---START---/d;$a[endmarker]\ndummy entry More digging. -Kevin
▸
On Thu, Sep 27, 2012 at 11:12 AM, Ralph Mitchell <user-00a5e44c48c0@xymon.invalid>wrote:
Sounds like there's an empty variable in a test expression. Something like: if [ $x = $y ]; then ...... fi where either $x or $y is not set. If those variables were put in double-quotes, at least you'd get an empty string. Ralph Mitchell On Sep 27, 2012 10:59 AM, "Kevin King" <user-4c6c31ddcab2@xymon.invalid> wrote:I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin
list Kevin King
Ryan, I am going to do that next. I did that the first time and it helped me figure out the shell needed to be bash rather than sh. The script writer has some good debugging in the code and I was setting his debug options. When I look on the remote client it did start the vmstat and create the tempfile output. I think the sed might be barfing on some output from the remote host at login.
▸
-Kevin
On Thu, Sep 27, 2012 at 11:20 AM, Ryan Novosielski <user-ae4522577e16@xymon.invalid>wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Do set -x or change the top line to read #!/bin/whatever -x -- adding in the -x. That will tell you like by line what is happening and show you which test is failing. Likely a variable isn't defined somewhere. On 09/27/2012 09:42 AM, Kevin King wrote:I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin- -- - ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |user-ae4522577e16@xymon.invalid - 973/972.0922 (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBkbsgACgkQmb+gadEcsb722wCdHWEJgkPHlUH4CBPH261+PKwq 9oIAoKR7Qa9cD9fnmXLLYoWtoyMc/Aj/ =lfmu -----END PGP SIGNATURE-----
list Ryan Novosielski
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This is probably due to a difference in the type of sed you're using (GNU vs. SysV or whatever else there is). I'm going to go ahead and guess you're on Solaris and the guy wrote for Linux/didn't care. Often times on Solaris, I get around this by using the sed command in /usr/xpg4/bin. You could probably also use GNU sed if you felt like installing the GNU textutils.
▸
On 09/27/2012 11:30 AM, Kevin King wrote:Thanks Ralph, I found the issue. the writer tested using bash as his /bin/sh so when I ran in on my server /bin/sh is not bash. fixed that then it ran... Now I am getting a garbled sed command.... sed: command garbled: 1,/---START---/d;$a[endmarker]\ndummy entry More digging. -Kevin On Thu, Sep 27, 2012 at 11:12 AM, Ralph Mitchell <user-00a5e44c48c0@xymon.invalid <mailto:user-00a5e44c48c0@xymon.invalid>> wrote: Sounds like there's an empty variable in a test expression. Something like: if [ $x = $y ]; then ...... fi where either $x or $y is not set. If those variables were put in double-quotes, at least you'd get an empty string. Ralph Mitchell On Sep 27, 2012 10:59 AM, "Kevin King" <user-4c6c31ddcab2@xymon.invalid <mailto:user-4c6c31ddcab2@xymon.invalid>> wrote: I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin
- -- - ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |user-ae4522577e16@xymon.invalid - 973/972.0922 (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/
iEYEARECAAYFAlBkdXUACgkQmb+gadEcsb4T7ACgxifuEyrVXKK8P1LNCtkCs5oa
3f8AoLMt5XcVTEkBELbmxWqKtEC1B8Jl
=7DVd
-----END PGP SIGNATURE-----
list Paul Root
It could be a matter of a Linux sed (gnu) verses the Solaris (SysV) sed command. You might a gnu sed package. Paul Root - Senior Engineer Managed Services Systems - CenturyLink
▸
From: xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] On Behalf Of Kevin King
Sent: Thursday, September 27, 2012 10:47 AM
To: Ryan Novosielski
Cc: xymon at xymon.com
Subject: Re: [Xymon] xymon-rclient.sh
Ryan, I am going to do that next. I did that the first time and it helped me figure out the shell needed to be bash rather than sh. The script writer has some good debugging in the code and I was setting his debug options.
When I look on the remote client it did start the vmstat and create the tempfile output.
I think the sed might be barfing on some output from the remote host at login.
-Kevin
On Thu, Sep 27, 2012 at 11:20 AM, Ryan Novosielski <user-ae4522577e16@xymon.invalid<mailto:user-ae4522577e16@xymon.invalid>> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Do set -x or change the top line to read #!/bin/whatever -x -- adding
in the -x. That will tell you like by line what is happening and show
you which test is failing. Likely a variable isn't defined somewhere.
On 09/27/2012 09:42 AM, Kevin King wrote:I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin
- -- - ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer
|$&| |__| | | |__/ | \| _| |user-ae4522577e16@xymon.invalid<mailto:user-ae4522577e16@xymon.invalid> - 973/972.0922<tel:973%2F972.0922> (2-0922)
▸
\__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBkbsgACgkQmb+gadEcsb722wCdHWEJgkPHlUH4CBPH261+PKwq 9oIAoKR7Qa9cD9fnmXLLYoWtoyMc/Aj/ =lfmu -----END PGP SIGNATURE-----
list Kevin King
Paul, That did the trick! I need to watch that closer, I learned when the world ran on Solaris. :)
▸
-Kevin
On Thu, Sep 27, 2012 at 11:49 AM, Root, Paul <user-76fdb6883669@xymon.invalid>wrote:
It could be a matter of a Linux sed (gnu) verses the Solaris (SysV) sed command. You might a gnu sed package.**** ** ** Paul Root - Senior Engineer**** Managed Services Systems - CenturyLink**** ** ** ** ** *From:* xymon-bounces at xymon.com [mailto:xymon-bounces at xymon.com] *On Behalf Of *Kevin King *Sent:* Thursday, September 27, 2012 10:47 AM *To:* Ryan Novosielski *Cc:* xymon at xymon.com *Subject:* Re: [Xymon] xymon-rclient.sh**** ** ** Ryan, I am going to do that next. I did that the first time and it helped me figure out the shell needed to be bash rather than sh. The script writer has some good debugging in the code and I was setting his debug options.** ** ** ** When I look on the remote client it did start the vmstat and create the tempfile output.**** I think the sed might be barfing on some output from the remote host at login.**** ** ** -Kevin****
On Thu, Sep 27, 2012 at 11:20 AM, Ryan Novosielski <user-ae4522577e16@xymon.invalid>
▸
wrote:**** -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Do set -x or change the top line to read #!/bin/whatever -x -- adding in the -x. That will tell you like by line what is happening and show you which test is failing. Likely a variable isn't defined somewhere.**** On 09/27/2012 09:42 AM, Kevin King wrote:I am trying to get your script (xymon-rclient.sh) running on my xymon and have hit some issue that must have something to do with my environment. Wednesday, September 26, 2012 03:25:55 PM CDT: starting //usr/local/xymon/server/ext/xymon-rclient.sh //usr/local/xymon/server/ext/xymon-rclient.sh: trap: bad trap Wednesday, September 26, 2012 03:25:55 PM CDT: finished //usr/local/xymon/server/ext/xymon-rclient.sh (completed 0 out of 0) I have ssh keys all setup and I can ssh to the client no problem. So I set the debug option them get this: //usr/local/xymon/server/ext/xymon-rclient.sh: test: argument expected the xymon server is solaris 10. and I am running xymon 4.3.10 -Kevin ******** - -- - ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _| |user-ae4522577e16@xymon.invalid - 973/972.0922 (2-0922) \__/ Univ. of Med. and Dent.|IST/EI-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBkbsgACgkQmb+gadEcsb722wCdHWEJgkPHlUH4CBPH261+PKwq 9oIAoKR7Qa9cD9fnmXLLYoWtoyMc/Aj/ =lfmu -----END PGP SIGNATURE-----**** ** **
list Kris Springer
I'm trying to get rclient working and I'm not understanding the SSH requirements. The whole point of this is to not need to configure the client, so what am I supposed to do with SSH keys? I can SSH into the client with user:pass but how do I do that with this script? It wants me to create SSH keys? Anyone have a clue for me? I'd rather just use the user:pass Signature - Kris Thank you. Kris Springer
list Jeremy Laidman
▸
On 26 July 2014 04:24, Kris Springer <user-c2caa0a7a8d5@xymon.invalid> wrote:
I'm trying to get rclient working and I'm not understanding the SSH requirements. The whole point of this is to not need to configure the client, so what am I supposed to do with SSH keys? I can SSH into the client with user:pass but how do I do that with this script? It wants me to create SSH keys? Anyone have a clue for me? I'd rather just use the user:pass
Kris It's not clear to me if you're saying a) you want to use key authentication but can't work out how; or b) you don't want to use key authentication and would prefer to use password authentication. The requirement for key-based authentication (rather than user:password) is so that a human doesn't need to type a password every 5 minutes when the script runs. If you want (prefer) to use a password, you will need a way to get the password entered into the ssh client. Alternatively, use a non-ssh client that supports fetching a password some other way and tell xymon-rclient.sh to use that (eg telnet and expect), but this is generally less secure than using a key pair for authentication. If you can ssh with username and password, then setting up keys for authentication is fairly quick to do. In case you need help with this, here's a brief set of instructions. First, login to the Xymon server as the xymon user (or su), and create a key pair with no passphrase: $ ssh-keygen -N "" -f ~/.ssh/xymon-rclient This creates two key files called xymon-rclient and xymon-rclient.pub, both in the .ssh subdirectory of the xymon user's home directory. The contents of the ".pub" file needs to be copied into a file on the host(s) you want to monitor. The other file should be kept secret and secure, because it's not protected by a password, yet is a "password equivalent". Second, append the contents of the .pub file into the .ssh/authorized_keys file on the host you want to manage, perhaps by doing this: $ ssh xymon at host-to-manage "cat >> ~/.ssh/authorized_keys" < ~/.ssh/xymon-rclient.pub Now you should be able to login using the private key instead of a password, and as long as it matches the public key at the other end, you should get in: $ ssh -i ~/.ssh/xymon-rclient xymon at host-to-manage uname -n Now, you have key authentication setup, and can start using xymon-rclient.sh. J
list Bill Arlofski
▸
On 07/27/14 23:26, Jeremy Laidman wrote:
Second, append the contents of the .pub file into the .ssh/authorized_keys file on the host you want to manage, perhaps by doing this: $ ssh xymon at host-to-manage "cat >> ~/.ssh/authorized_keys" < ~/.ssh/xymon-rclient.pub
Or, while still the xymon user, simply: $ ssh-copy-id xymon at host-to-manage -- Bill Arlofski Reverse Polarity, LLC http://www.revpol.com/ -- Not responsible for anything below this line --
list Jeremy Laidman
On 28 July 2014 20:17, Bill Arlofski <user-0b8af203a56e@xymon.invalid> wrote:
Or, while still the xymon user, simply: $ ssh-copy-id xymon at host-to-manage
I never knew this existed. Thanks.
list Kris Springer
I believe I've gotten the SSH authentication working correctly. My problem now is that the remote client that I'm attempting to monitor is a FreeNAS box with a Read-Only file system. I can manually enter 'mount -uw /' directly on the client machine to overcome the Read-Only issue, but I can't seem to figure out what to do in the rclient script that will accomplish the same thing. Any ideas?
▸
Signature - Kris
Thank you.
Kris Springer
On 7/27/2014 8:26 PM, Jeremy Laidman wrote:On 26 July 2014 04:24, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
I'm trying to get rclient working and I'm not understanding the
SSH requirements. The whole point of this is to not need to
configure the client, so what am I supposed to do with SSH keys? I can SSH into the client with user:pass but how do I do that with
this script? It wants me to create SSH keys? Anyone have a clue
for me? I'd rather just use the user:pass
Kris
It's not clear to me if you're saying a) you want to use key authentication but can't work out how; or b) you don't want to use key authentication and would prefer to use password authentication.
The requirement for key-based authentication (rather than user:password) is so that a human doesn't need to type a password every 5 minutes when the script runs. If you want (prefer) to use a password, you will need a way to get the password entered into the ssh client. Alternatively, use a non-ssh client that supports fetching a password some other way and tell xymon-rclient.sh to use that (eg telnet and expect), but this is generally less secure than using a key pair for authentication.
If you can ssh with username and password, then setting up keys for authentication is fairly quick to do. In case you need help with this, here's a brief set of instructions.
First, login to the Xymon server as the xymon user (or su), and create a key pair with no passphrase:
$ ssh-keygen -N "" -f ~/.ssh/xymon-rclient
This creates two key files called xymon-rclient and xymon-rclient.pub, both in the .ssh subdirectory of the xymon user's home directory. The contents of the ".pub" file needs to be copied into a file on the host(s) you want to monitor. The other file should be kept secret and secure, because it's not protected by a password, yet is a "password equivalent".
Second, append the contents of the .pub file into the .ssh/authorized_keys file on the host you want to manage, perhaps by doing this:
$ ssh xymon at host-to-manage "cat >> ~/.ssh/authorized_keys" < ~/.ssh/xymon-rclient.pub
Now you should be able to login using the private key instead of a password, and as long as it matches the public key at the other end, you should get in:
$ ssh -i ~/.ssh/xymon-rclient xymon at host-to-manage uname -n
Now, you have key authentication setup, and can start using xymon-rclient.sh.
J
list Jeremy Laidman
▸
On 30 July 2014 16:48, Kris Springer <user-c2caa0a7a8d5@xymon.invalid> wrote:
I believe I've gotten the SSH authentication working correctly. My problem now is that the remote client that I'm attempting to monitor is a FreeNAS box with a Read-Only file system. I can manually enter 'mount -uw /' directly on the client machine to overcome the Read-Only issue, but I can't seem to figure out what to do in the rclient script that will accomplish the same thing. Any ideas?
I'm not sure I follow. If you manually run "mount -uw /" then you don't need to do anything in the rclient script. If you want to do this every time, simply create an extra task.cfg entry that uses "ssh" to do this for you. I'm puzzled why rclient needs a writeable root filesystem. Does it give an error message? J
list Kris Springer
I think I'm misunderstanding exactly how the rclient script functions and how it aquires the info from the client machine. It appears that I have the SSH keys setup and working because I can enter ' *ssh -i ~/.ssh/xymon-rclient root at freenas.*mydomainname*.com uname -n' from a command line on the xymon server and it displays the hostname of the cli*ent without requesting a password, but it's not collecting the data for some reason. (I've manually edited my specific IP and domain name in all the following due to this being a public post) I can verify that there are SSH keys listed in the client's /root/.ssh/ directory and they're labeled with my xymon server's user at hostname confirming that they uploaded into the client correctly when I ran the following commands from the xymon server. #su xymon *#ssh-keygen -N "" -f ~/.ssh/xymon-rclient* # *ssh user-b217e4b1eaae@xymon.invalid "cat >> ~/.ssh/authorized_keys" < ~/.ssh/xymon-rclient.pub Here's what I have in my tasks.cfg file. * * [xymon-rclient] ENVFILE $XYMONHOME/etc/xymonserver.cfg CMD $XYMONHOME/ext/xymon-rclient.sh -d 1 LOGFILE $XYMONSERVERLOGS/xymon-rclient.log INTERVAL 5m* Signature - Kris Here's what I have in my hosts.cfg file. 1.2.3.4 FreeNAS *# trace ssh https://freenas.mydomainname.com "RCLIENT:cmd(ssh -T root@*freenas.mydomainname.com*),ostype(freebsd)"* Here's what I get in the logs. Wed Jul 30 13:20:00 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh Wed Jul 30 13:20:00 PDT 2014 Adding hosts from hosts.cfg Server 1 freenas.mydomainname.com(freebsd) Command: ssh -T user-b217e4b1eaae@xymon.invalid Wed Jul 30 13:20:01 PDT 2014: Failed to collect data for freenas.mydomainname.com Wed Jul 30 13:20:01 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1) Hopefully this gives some sort of clue as to what's going on or what I'm doing wrong. Thank you. Kris Springer
▸
On 7/30/2014 12:02 AM, Jeremy Laidman wrote:On 30 July 2014 16:48, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
I believe I've gotten the SSH authentication working correctly. My problem now is that the remote client that I'm attempting to
monitor is a FreeNAS box with a Read-Only file system. I can
manually enter 'mount -uw /' directly on the client machine to
overcome the Read-Only issue, but I can't seem to figure out what
to do in the rclient script that will accomplish the same thing. Any ideas?
I'm not sure I follow. If you manually run "mount -uw /" then you don't need to do anything in the rclient script. If you want to do this every time, simply create an extra task.cfg entry that uses "ssh" to do this for you.
I'm puzzled why rclient needs a writeable root filesystem. Does it give an error message?
J
list Paul Root
Have you tried scping the xymonclient-freebsd.sh over to the machine and seeing if it will run?
You may need to create your own that is specific to FreeNas. I had to for my tripplite terminal server.
10.5.114.209 stncs6 # testip "RCLIENT:cmd(ssh -T xymon@%{H}),ostype(linux),scriptos(tripplite)"
Also, I’m wondering if, once you do get it running, you won’t end up with a ghost client, since your hostname doesn’t match the command line (hostname vs fqdn).
So do this:
Scp ~xymon/client/bin/xymonclient-freebsd.sh user-b217e4b1eaae@xymon.invalid:/tmp<mailto:user-b217e4b1eaae@xymon.invalid:/tmp>
Ssh –T user-b217e4b1eaae@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> /tmp/xymonclient-freebsd.sh
And see what happens.
Let us know.
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Kris Springer
Sent: Wednesday, July 30, 2014 3:28 PM
To: Jeremy Laidman; Xymon MailingList
Subject: Re: [Xymon] xymon-rclient.sh
I think I'm misunderstanding exactly how the rclient script functions and how it aquires the info from the client machine. It appears that I have the SSH keys setup and working because I can enter ' ssh -i ~/.ssh/xymon-rclient user-b217e4b1eaae@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> uname -n' from a command line on the xymon server and it displays the hostname of the client without requesting a password, but it's not collecting the data for some reason.
▸
(I've manually edited my specific IP and domain name in all the following due to this being a public post)
I can verify that there are SSH keys listed in the client's /root/.ssh/ directory and they're labeled with my xymon server's user at hostname confirming that they uploaded into the client correctly when I ran the following commands from the xymon server.
#su xymon
#ssh-keygen -N "" -f ~/.ssh/xymon-rclient
# ssh user-b217e4b1eaae@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> "cat >> ~/.ssh/authorized_keys" < ~/.ssh/xymon-rclient.pub
▸
Here's what I have in my tasks.cfg file.
[xymon-rclient]
ENVFILE $XYMONHOME/etc/xymonserver.cfg
CMD $XYMONHOME/ext/xymon-rclient.sh -d 1
LOGFILE $XYMONSERVERLOGS/xymon-rclient.log
INTERVAL 5m
Here's what I have in my hosts.cfg file.1.2.3.4 FreeNAS # trace ssh https://freenas.mydomainname.com "RCLIENT:cmd(ssh -T user-b217e4b1eaae@xymon.invalid),ostype(freebsd)<mailto:user-b217e4b1eaae@xymon.invalid),ostype(freebsd)>"
▸
Here's what I get in the logs.
Wed Jul 30 13:20:00 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh
Wed Jul 30 13:20:00 PDT 2014
Adding hosts from hosts.cfg
Server 1 freenas.mydomainname.com(freebsd)
Command: ssh -T user-b217e4b1eaae@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid>
▸
Wed Jul 30 13:20:01 PDT 2014: Failed to collect data for freenas.mydomainname.com
Wed Jul 30 13:20:01 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1)
Hopefully this gives some sort of clue as to what's going on or what I'm doing wrong.
Thank you.
Kris Springer
On 7/30/2014 12:02 AM, Jeremy Laidman wrote:
On 30 July 2014 16:48, Kris Springer <user-c2caa0a7a8d5@xymon.invalid<mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
I believe I've gotten the SSH authentication working correctly. My problem now is that the remote client that I'm attempting to monitor is a FreeNAS box with a Read-Only file system. I can manually enter 'mount -uw /' directly on the client machine to overcome the Read-Only issue, but I can't seem to figure out what to do in the rclient script that will accomplish the same thing. Any ideas?
I'm not sure I follow. If you manually run "mount -uw /" then you don't need to do anything in the rclient script. If you want to do this every time, simply create an extra task.cfg entry that uses "ssh" to do this for you.
I'm puzzled why rclient needs a writeable root filesystem. Does it give an error message?
J
list Jeremy Laidman
▸
On 31 July 2014 06:27, Kris Springer <user-c2caa0a7a8d5@xymon.invalid> wrote:
I can enter ' *ssh -i ~/.ssh/xymon-rclient root at freenas.*mydomainname*.com uname -n' from a command line on the xymon server and it displays the hostname of the cli*ent
Good
▸
Here's what I have in my hosts.cfg file.1.2.3.4 FreeNAS *# trace ssh https://freenas.mydomainname.com
<https://freenas.mydomainname.com>; "RCLIENT:cmd(ssh -T root@* freenas.mydomainname.com*),ostype(freebsd)"*
I wonder if this is the problem. By default, ssh will try to use a key file called "identity", then it will try "id_rsa" and finally "id_dsa" (all in the .ssh directory). So to use a different key file, you use "-i <dirname/filename>" on the command-line. If you need to do this when you do the "uname -n" test, then you probably also need to specify it in the cmd() specification in hosts.cfg. J
list Paul Root
Oh, I glossed right over that. If you aren’t going to use the default file name for the identity file, then you have to tell xymon to use that non-standard file as well. That doesn’t seem to be an option for the command. So you’d need to either change the command to take that as input, or make the filename the default.
▸
From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Jeremy Laidman
Sent: Wednesday, July 30, 2014 9:45 PM
To: Kris Springer
Cc: Xymon MailingList
Subject: Re: [Xymon] xymon-rclient.sh
On 31 July 2014 06:27, Kris Springer <user-c2caa0a7a8d5@xymon.invalid<mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
I can enter ' ssh -i ~/.ssh/xymon-rclient user-b217e4b1eaae@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> uname -n' from a command line on the xymon server and it displays the hostname of the client
Good
Here's what I have in my hosts.cfg file.1.2.3.4 FreeNAS # trace ssh https://freenas.mydomainname.com "RCLIENT:cmd(ssh -T user-b217e4b1eaae@xymon.invalid<http://freenas.mydomainname.com>;),ostype(freebsd)"
▸
I wonder if this is the problem. By default, ssh will try to use a key file called "identity", then it will try "id_rsa" and finally "id_dsa" (all in the .ssh directory). So to use a different key file, you use "-i <dirname/filename>" on the command-line. If you need to do this when you do the "uname -n" test, then you probably also need to specify it in the cmd() specification in hosts.cfg.
J
list Kris Springer
I've modified a few things but haven't gotten any successful results. See below.
My hosts.cfg. I've tried (freebsd) and also (linux) with the same failed results.
1.2.3.4 freenas.domain.com # trace ssh "RCLIENT:cmd(ssh -T -i /home/xymon/.ssh/xymon-rclient root@%{H}),ostype(freebsd)"
Log results.
Thu Jul 31 07:58:23 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh
Thu Jul 31 07:58:23 PDT 2014
Adding hosts from hosts.cfg
Server 1 freenas.domain.com(freebsd)
Command: ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid
Thu Jul 31 07:58:24 PDT 2014: Failed to collect data for freenas.domain.com
Thu Jul 31 07:58:24 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1)
Thu Jul 31 08:03:23 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh
Thu Jul 31 08:03:23 PDT 2014
Adding hosts from hosts.cfg
Server 1 freenas.domain.com(linux)
Command: ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid
Thu Jul 31 08:03:24 PDT 2014: Failed to collect data for freenas.domain.com
Thu Jul 31 08:03:24 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1)
Signature - Kris I can enter the following at command line and get positive result without a password being requested from the client.
#su xymon
# ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid <mailto:user-b217e4b1eaae@xymon.invalid> uname -n
Thank you.
Kris Springer
▸
On 7/31/2014 7:19 AM, Root, Paul T wrote:Oh, I glossed right over that. If you aren’t going to use the default file name for the identity file, then you have to tell xymon to use that non-standard file as well. That doesn’t seem to be an option for the command. So you’d need to either change the command to take that as input, or make the filename the default.
*From:*Xymon [mailto:xymon-bounces at xymon.com] *On Behalf Of *Jeremy Laidman
▸
*Sent:* Wednesday, July 30, 2014 9:45 PM
*To:* Kris Springer
*Cc:* Xymon MailingList
*Subject:* Re: [Xymon] xymon-rclient.sh
On 31 July 2014 06:27, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
I can enter ' ssh -i ~/.ssh/xymon-rclient user-b217e4b1eaae@xymon.invalid <mailto:user-b217e4b1eaae@xymon.invalid> uname -n' from a command line on the xymon server and it displays the hostname of the client
▸
Good Here's what I have in my hosts.cfg file. 1.2.3.4 FreeNAS # trace ssh https://freenas.mydomainname.com
"RCLIENT:cmd(ssh -T user-b217e4b1eaae@xymon.invalid <http://freenas.mydomainname.com>;),ostype(freebsd)"
▸
I wonder if this is the problem. By default, ssh will try to use a key file called "identity", then it will try "id_rsa" and finally "id_dsa" (all in the .ssh directory). So to use a different key file, you use "-i <dirname/filename>" on the command-line. If you need to do this when you do the "uname -n" test, then you probably also need to specify it in the cmd() specification in hosts.cfg.
J
list Paul Root
I believe FreeNas is based on FreeBSD. So that should be close. Can you provide the output of what I sent yesterday? That is scping the freebsd client script and running it. That is going to provide the debugging info needed. My guess is that the FreeBSD client script will need to be modified (and renamed) to work for FreeNas.
▸
From: Kris Springer [mailto:user-c2caa0a7a8d5@xymon.invalid]
Sent: Thursday, July 31, 2014 10:18 AM
To: Root, Paul T; Jeremy Laidman
Cc: Xymon MailingList
Subject: Re: [Xymon] xymon-rclient.sh
I've modified a few things but haven't gotten any successful results. See below.
My hosts.cfg. I've tried (freebsd) and also (linux) with the same failed results.
1.2.3.4 freenas.domain.com # trace ssh "RCLIENT:cmd(ssh -T -i /home/xymon/.ssh/xymon-rclient root@%{H}),ostype(freebsd)"
Log results.
Thu Jul 31 07:58:23 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh
Thu Jul 31 07:58:23 PDT 2014
Adding hosts from hosts.cfg
Server 1 freenas.domain.com(freebsd)
Command: ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid<mailto:user-0d16a14a207c@xymon.invalid>
▸
Thu Jul 31 07:58:24 PDT 2014: Failed to collect data for freenas.domain.com
Thu Jul 31 07:58:24 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1)
Thu Jul 31 08:03:23 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh
Thu Jul 31 08:03:23 PDT 2014
Adding hosts from hosts.cfg
Server 1 freenas.domain.com(linux)
Command: ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid<mailto:user-0d16a14a207c@xymon.invalid>
▸
Thu Jul 31 08:03:24 PDT 2014: Failed to collect data for freenas.domain.com
Thu Jul 31 08:03:24 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1)
I can enter the following at command line and get positive result without a password being requested from the client.
#su xymon
# ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> uname -n
▸
Thank you. Kris Springer On 7/31/2014 7:19 AM, Root, Paul T wrote: Oh, I glossed right over that. If you aren’t going to use the default file name for the identity file, then you have to tell xymon to use that non-standard file as well. That doesn’t seem to be an option for the command. So you’d need to either change the command to take that as input, or make the filename the default. From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Jeremy Laidman Sent: Wednesday, July 30, 2014 9:45 PM To: Kris Springer Cc: Xymon MailingList Subject: Re: [Xymon] xymon-rclient.sh On 31 July 2014 06:27, Kris Springer <user-c2caa0a7a8d5@xymon.invalid<mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: I can enter ' ssh -i ~/.ssh/xymon-rclient user-b217e4b1eaae@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> uname -n' from a command line on the xymon server and it displays the hostname of the client Good Here's what I have in my hosts.cfg file. 1.2.3.4 FreeNAS # trace ssh https://freenas.mydomainname.com "RCLIENT:cmd(ssh -T user-b217e4b1eaae@xymon.invalid<http://freenas.mydomainname.com>;),ostype(freebsd)" I wonder if this is the problem. By default, ssh will try to use a key file called "identity", then it will try "id_rsa" and finally "id_dsa" (all in the .ssh directory). So to use a different key file, you use "-i <dirname/filename>" on the command-line. If you need to do this when you do the "uname -n" test, then you probably also need to specify it in the cmd() specification in hosts.cfg. J
list Kris Springer
Xymon server is Ubuntu and Scp is not installed. Could that have something to do with my problems? Signature - Kris Thank you. Kris Springer On 7/31/2014 8:29 AM, Root, Paul T wrote:
Signature - Kris
▸
I believe FreeNas is based on FreeBSD. So that should be close.
Can you provide the output of what I sent yesterday? That is scping
the freebsd client script and running it.
That is going to provide the debugging info needed.
My guess is that the FreeBSD client script will need to be modified
(and renamed) to work for FreeNas.
*From:*Kris Springer [mailto:user-c2caa0a7a8d5@xymon.invalid]
▸
*Sent:* Thursday, July 31, 2014 10:18 AM
*To:* Root, Paul T; Jeremy Laidman
*Cc:* Xymon MailingList
*Subject:* Re: [Xymon] xymon-rclient.sh
I've modified a few things but haven't gotten any successful results.
See below.
My hosts.cfg. I've tried (freebsd) and also (linux) with the same
failed results.
1.2.3.4 freenas.domain.com # trace ssh "RCLIENT:cmd(ssh -T -i
/home/xymon/.ssh/xymon-rclient root@%{H}),ostype(freebsd)"
Log results.
Thu Jul 31 07:58:23 PDT 2014: starting
/usr/lib/xymon/server/ext/xymon-rclient.sh
Thu Jul 31 07:58:23 PDT 2014
Adding hosts from hosts.cfg
Server 1 freenas.domain.com(freebsd)
Command: ssh -T -i /home/xymon/.ssh/xymon-rclient
user-0d16a14a207c@xymon.invalid <mailto:user-0d16a14a207c@xymon.invalid>
▸
Thu Jul 31 07:58:24 PDT 2014: Failed to collect data for
freenas.domain.com
Thu Jul 31 07:58:24 PDT 2014: finished
/usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1)
Thu Jul 31 08:03:23 PDT 2014: starting
/usr/lib/xymon/server/ext/xymon-rclient.sh
Thu Jul 31 08:03:23 PDT 2014
Adding hosts from hosts.cfg
Server 1 freenas.domain.com(linux)
Command: ssh -T -i /home/xymon/.ssh/xymon-rclient
user-0d16a14a207c@xymon.invalid <mailto:user-0d16a14a207c@xymon.invalid>
▸
Thu Jul 31 08:03:24 PDT 2014: Failed to collect data for freenas.domain.com Thu Jul 31 08:03:24 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1) I can enter the following at command line and get positive result without a password being requested from the client. #su xymon # ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid <mailto:user-b217e4b1eaae@xymon.invalid> uname -n Thank you. Kris Springer On 7/31/2014 7:19 AM, Root, Paul T wrote: Oh, I glossed right over that. If you aren’t going to use the default file name for the identity file, then you have to tell xymon to use that non-standard file as well. That doesn’t seem to be an option for the command. So you’d need to either change the command to take that as input, or make the filename the default. *From:*Xymon [mailto:xymon-bounces at xymon.com] *On Behalf Of *Jeremy Laidman *Sent:* Wednesday, July 30, 2014 9:45 PM *To:* Kris Springer *Cc:* Xymon MailingList *Subject:* Re: [Xymon] xymon-rclient.sh On 31 July 2014 06:27, Kris Springer <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: I can enter ' ssh -i ~/.ssh/xymon-rclient user-b217e4b1eaae@xymon.invalid <mailto:user-b217e4b1eaae@xymon.invalid> uname -n' from a command line on the xymon server and it displays the hostname of the client Good Here's what I have in my hosts.cfg file. 1.2.3.4 FreeNAS # trace ssh https://freenas.mydomainname.com "RCLIENT:cmd(ssh -T user-b217e4b1eaae@xymon.invalid <http://freenas.mydomainname.com>;),ostype(freebsd)" I wonder if this is the problem. By default, ssh will try to use a key file called "identity", then it will try "id_rsa" and finally "id_dsa" (all in the .ssh directory). So to use a different key file, you use "-i <dirname/filename>" on the command-line. If you need to do this when you do the "uname -n" test, then you probably also need to specify it in the cmd() specification in hosts.cfg. J
list Paul Root
Yes. The xymon-rclient script scp’s the proper script from ~/client/bin to the client and runs it. You’ll have to look at the script to see if it is using scp or if it is using a perl module for scp. I’m guessing the former.
▸
From: Kris Springer [mailto:user-c2caa0a7a8d5@xymon.invalid] Sent: Thursday, July 31, 2014 10:48 AM To: Root, Paul T; Jeremy Laidman Cc: Xymon MailingList Subject: Re: [Xymon] xymon-rclient.sh Xymon server is Ubuntu and Scp is not installed. Could that have something to do with my problems? Thank you. Kris Springer On 7/31/2014 8:29 AM, Root, Paul T wrote: I believe FreeNas is based on FreeBSD. So that should be close. Can you provide the output of what I sent yesterday? That is scping the freebsd client script and running it. That is going to provide the debugging info needed. My guess is that the FreeBSD client script will need to be modified (and renamed) to work for FreeNas. From: Kris Springer [mailto:user-c2caa0a7a8d5@xymon.invalid] Sent: Thursday, July 31, 2014 10:18 AM To: Root, Paul T; Jeremy Laidman Cc: Xymon MailingList Subject: Re: [Xymon] xymon-rclient.sh I've modified a few things but haven't gotten any successful results. See below. My hosts.cfg. I've tried (freebsd) and also (linux) with the same failed results. 1.2.3.4 freenas.domain.com # trace ssh "RCLIENT:cmd(ssh -T -i /home/xymon/.ssh/xymon-rclient root@%{H}),ostype(freebsd)" Log results. Thu Jul 31 07:58:23 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh Thu Jul 31 07:58:23 PDT 2014 Adding hosts from hosts.cfg Server 1 freenas.domain.com(freebsd) Command: ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid<mailto:user-0d16a14a207c@xymon.invalid> Thu Jul 31 07:58:24 PDT 2014: Failed to collect data for freenas.domain.com Thu Jul 31 07:58:24 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1) Thu Jul 31 08:03:23 PDT 2014: starting /usr/lib/xymon/server/ext/xymon-rclient.sh Thu Jul 31 08:03:23 PDT 2014 Adding hosts from hosts.cfg Server 1 freenas.domain.com(linux) Command: ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid<mailto:user-0d16a14a207c@xymon.invalid> Thu Jul 31 08:03:24 PDT 2014: Failed to collect data for freenas.domain.com Thu Jul 31 08:03:24 PDT 2014: finished /usr/lib/xymon/server/ext/xymon-rclient.sh (completed 0 out of 1) I can enter the following at command line and get positive result without a password being requested from the client. #su xymon # ssh -T -i /home/xymon/.ssh/xymon-rclient user-0d16a14a207c@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> uname -n Thank you. Kris Springer On 7/31/2014 7:19 AM, Root, Paul T wrote: Oh, I glossed right over that. If you aren’t going to use the default file name for the identity file, then you have to tell xymon to use that non-standard file as well. That doesn’t seem to be an option for the command. So you’d need to either change the command to take that as input, or make the filename the default. From: Xymon [mailto:xymon-bounces at xymon.com] On Behalf Of Jeremy Laidman Sent: Wednesday, July 30, 2014 9:45 PM To: Kris Springer Cc: Xymon MailingList Subject: Re: [Xymon] xymon-rclient.sh On 31 July 2014 06:27, Kris Springer <user-c2caa0a7a8d5@xymon.invalid<mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: I can enter ' ssh -i ~/.ssh/xymon-rclient user-b217e4b1eaae@xymon.invalid<mailto:user-b217e4b1eaae@xymon.invalid> uname -n' from a command line on the xymon server and it displays the hostname of the client Good Here's what I have in my hosts.cfg file. 1.2.3.4 FreeNAS # trace ssh https://freenas.mydomainname.com "RCLIENT:cmd(ssh -T user-b217e4b1eaae@xymon.invalid<http://freenas.mydomainname.com>;),ostype(freebsd)" I wonder if this is the problem. By default, ssh will try to use a key file called "identity", then it will try "id_rsa" and finally "id_dsa" (all in the .ssh directory). So to use a different key file, you use "-i <dirname/filename>" on the command-line. If you need to do this when you do the "uname -n" test, then you probably also need to specify it in the cmd() specification in hosts.cfg. J
list Jeremy Laidman
▸
On 1 August 2014 10:45, Root, Paul T <user-76fdb6883669@xymon.invalid> wrote:
Yes. The xymon-rclient script scp’s the proper script from ~/client/bin to the client and runs it.
Actually, that's not correct. It uses "ssh" (or rsh, or whatever you want
to give it) to run a shell, then pipes the contents of the
xymonclient-freebsd.sh file into the pipe. Essentially like this:
$ cat /usr/lib/xymon/client/bin/xymonclient-freebsd.sh | ssh -T -i
path/to/keyfile hostname
and the output is saved into a temporary file to be fed into $XYMON $XYMSRV
"@", but prefixed with a "client" message header.
If you run that "cat ..." command manually it should give you client data
as its output. Try it and see.
If it works, then xymon-rclient should also work and might have a bug. If
this doesn't work, then we can reproduce the problem outside of
xymon-rclient and it will be easier to work on.
I wonder if it's to do with the shell on the FreeNAS. If it's a
non-standard shell, you might need to force a shell in the ssh parameters,
with something like:
cmd(ssh -T -i /home/xymon/.ssh/xymon-rclient root@%{H}
/bin/bash),ostype(freebsd)
J
list Kris Springer
Well done!! Adding the '/bin/bash' to the cmd line worked! Results are flowing in and all is well. Thanks for help. Good job. :-)
▸
Signature - Kris
Thank you.
Kris Springer
On 7/31/2014 7:21 PM, Jeremy Laidman wrote:On 1 August 2014 10:45, Root, Paul T <user-76fdb6883669@xymon.invalid <mailto:user-76fdb6883669@xymon.invalid>> wrote:
Yes. The xymon-rclient script scp’s the proper script from
~/client/bin to the client and runs it.
Actually, that's not correct. It uses "ssh" (or rsh, or whatever you want to give it) to run a shell, then pipes the contents of the xymonclient-freebsd.sh file into the pipe. Essentially like this:
$ cat /usr/lib/xymon/client/bin/xymonclient-freebsd.sh | ssh -T -i path/to/keyfile hostname
and the output is saved into a temporary file to be fed into $XYMON $XYMSRV "@", but prefixed with a "client" message header.
If you run that "cat ..." command manually it should give you client data as its output. Try it and see.
If it works, then xymon-rclient should also work and might have a bug. If this doesn't work, then we can reproduce the problem outside of xymon-rclient and it will be easier to work on.
I wonder if it's to do with the shell on the FreeNAS. If it's a non-standard shell, you might need to force a shell in the ssh parameters, with something like:
cmd(ssh -T -i /home/xymon/.ssh/xymon-rclient root@%{H} /bin/bash),ostype(freebsd)
J
list Jeremy Laidman
Great news. Thanks for the update. I'll add FreeNAS to the compatibility list, with the shell caveat.
▸
On 01/08/2014 4:02 PM, "Kris Springer" <user-c2caa0a7a8d5@xymon.invalid> wrote:
Well done!! Adding the '/bin/bash' to the cmd line worked! Results are flowing in and all is well. Thanks for help. Good job. :-) Thank you. Kris Springer On 7/31/2014 7:21 PM, Jeremy Laidman wrote: On 1 August 2014 10:45, Root, Paul T <user-76fdb6883669@xymon.invalid> wrote:Yes. The xymon-rclient script scp’s the proper script from ~/client/bin to the client and runs it.Actually, that's not correct. It uses "ssh" (or rsh, or whatever you want to give it) to run a shell, then pipes the contents of the xymonclient-freebsd.sh file into the pipe. Essentially like this: $ cat /usr/lib/xymon/client/bin/xymonclient-freebsd.sh | ssh -T -i path/to/keyfile hostname and the output is saved into a temporary file to be fed into $XYMON $XYMSRV "@", but prefixed with a "client" message header. If you run that "cat ..." command manually it should give you client data as its output. Try it and see. If it works, then xymon-rclient should also work and might have a bug. If this doesn't work, then we can reproduce the problem outside of xymon-rclient and it will be easier to work on. I wonder if it's to do with the shell on the FreeNAS. If it's a non-standard shell, you might need to force a shell in the ssh parameters, with something like: cmd(ssh -T -i /home/xymon/.ssh/xymon-rclient root@%{H} /bin/bash),ostype(freebsd) J
list Kris Springer
I'm not getting any log files from FreeNAS using the rclient. The server website says "The client did not report any logfile data". Any
▸
ideas?
Signature - Kris
Thank you.
Kris Springer
On 8/5/2014 10:39 PM, Jeremy Laidman wrote:Great news. Thanks for the update. I'll add FreeNAS to the compatibility list, with the shell caveat. On 01/08/2014 4:02 PM, "Kris Springer" <user-c2caa0a7a8d5@xymon.invalid <mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote: Well done!! Adding the '/bin/bash' to the cmd line worked! Results are flowing in and all is well. Thanks for help. Good job. :-) Thank you. Kris Springer On 7/31/2014 7:21 PM, Jeremy Laidman wrote:On 1 August 2014 10:45, Root, Paul T <user-76fdb6883669@xymon.invalid <mailto:user-76fdb6883669@xymon.invalid>> wrote: Yes. The xymon-rclient script scp’s the proper script from ~/client/bin to the client and runs it. Actually, that's not correct. It uses "ssh" (or rsh, or whatever you want to give it) to run a shell, then pipes the contents of the xymonclient-freebsd.sh file into the pipe. Essentially like this: $ cat /usr/lib/xymon/client/bin/xymonclient-freebsd.sh | ssh -T -i path/to/keyfile hostname and the output is saved into a temporary file to be fed into $XYMON $XYMSRV "@", but prefixed with a "client" message header. If you run that "cat ..." command manually it should give you client data as its output. Try it and see. If it works, then xymon-rclient should also work and might have a bug. If this doesn't work, then we can reproduce the problem outside of xymon-rclient and it will be easier to work on. I wonder if it's to do with the shell on the FreeNAS. If it's a non-standard shell, you might need to force a shell in the ssh parameters, with something like: cmd(ssh -T -i /home/xymon/.ssh/xymon-rclient root@%{H} /bin/bash),ostype(freebsd) J
list Jeremy Laidman
On 10 September 2014 03:26, Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
▸
wrote:
I'm not getting any log files from FreeNAS using the rclient. The server website says "The client did not report any logfile data". Any ideas?
Alas, xymon-rclient doesn't support logfile monitoring. This is because to do so requires executing the "logfetch" binary, which is supplied as part of the Xymon client package. When the target system doesn't have the Xymon client installed, there's no logfetch binary, and no way of processing logfiles. This is on my list of things to do. But it's non-trivial, because such a binary has to keep state between executions. I should probably put a note about this on the webpage. Cheers Jeremy
list Galen Johnson
Have you considered using rsync to bring logs to a local folder (IIRC, this already requires "passwordless" ssh). Then use that copy to run a local "logfetch" process. That way, it gets to keep the state locally and since rsync should only do block copies, it will only bring over the changes so should be relatively quick. NB: I've not looked at xymon-rclient closely so this is said blindly. =G=
▸
From: Xymon <xymon-bounces at xymon.com> on behalf of Jeremy Laidman <user-71895fb2e44c@xymon.invalid>
Sent: Tuesday, September 9, 2014 5:03 PM
To: Kris Springer
Cc: xymon at xymon.com
Subject: Re: [Xymon] xymon-rclient.sh
On 10 September 2014 03:26, Kris Springer <user-c2caa0a7a8d5@xymon.invalid<mailto:user-c2caa0a7a8d5@xymon.invalid>> wrote:
I'm not getting any log files from FreeNAS using the rclient. The server website says "The client did not report any logfile data". Any ideas?
Alas, xymon-rclient doesn't support logfile monitoring. This is because to do so requires executing the "logfetch" binary, which is supplied as part of the Xymon client package. When the target system doesn't have the Xymon client installed, there's no logfetch binary, and no way of processing logfiles.
This is on my list of things to do. But it's non-trivial, because such a binary has to keep state between executions.
I should probably put a note about this on the webpage.
Cheers
Jeremy
list Jeremy Laidman
▸
On 10 September 2014 08:15, Galen Johnson <user-87f955643e3d@xymon.invalid> wrote:
Have you considered using rsync to bring logs to a local folder (IIRC, this already requires "passwordless" ssh).
That's an interesting idea. I'd prefer to not have to transfer to and store the logs on the Xymon server, as this can be a significant traffic burden if the logfiles rotate often. This is one of the reasons that client-side processing is attractive (to me). After all, I could simply use syslog to transfer the log messages in real-time. Actually, I've been tinkering with a version that emulates some of the logfetch processing using shell scripting, but not all of them. There are 2 main functions that need to be emulated. First, logfetch has to keep track of where it last looked at the logfile. This can be done with wc (to capture current log size) and tail or dd (to simulate "seek"). Second, it applies the ignore and trigger terms from the local-client.cfg file, which we can do with egrep. But then it gets significantly more complicated. It has to handle checksum checks, "dir" directives, "linecount" (which is a multi-line configuration block), all of which require a bit of scripting gymnastics. When I realised that I would also need to handle backticks, I decided it was becoming almost an exercise in demonstrating how much a lowly shell script could accomplish, regardless of how sensible it was to do so. Nevertheless, at the risk of increasing run-times and complicating the code, I implemented a new version that supports many of the features of logfetch. What's missing is the state processing for "log" files (it sends the whole log every time), and handling of "trigger" and "ignore". I even have backticks working OK. There are probably some assumptions, which mean the new features might not work properly on some flavours of UNIX, but so far it seems to be working OK on some Solaris clients. I don't think it would take a lot of work to get the statefulness working. But it's time I don't have just at the moment, nor do I have a need for this feature at present. I'll upload version 0.6 to the website in the next few hours. If anyone wants to hack on it, they're welcome to do so, and submit patches. Cheers Jeremy
list Alexander Bech
Am 10.09.2014 03:55, schrieb Jeremy Laidman:
▸
What's missing is the state processing for "log" files (it sends the whole log every time), and handling of "trigger" and "ignore".
Hi, here is a version of xymon-rclient.sh with support of logfile monitoring. The added function do_host_logs() does following: - read local preserved logfetch.cfg files for each remote host - on next and each run tail 100 loglines from logfiles on monitored host over remote connection - on each run emulates syslog on rclient-side for each remote logfile with "grep -Fvx newdata prevdata >> logfile" - generate a modified logfetch.cfg2 file for local logfetch - run local logfetch and report [msgs:...] data Based on version 0.5. Produces not much traffic and periodically rotates local emulated logfiles. Works like the original xymonclient and handling of "trigger" and "ignore". Other modification: assign class name which the rclient reports. Maybe it's possible to integrate the code into xymon-rclient 0.6? Greetings, Alex