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:kspringer at innovateteam.com] 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:kspringer at innovateteam.com] 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 root at freenas.domain.com<mailto:root at freenas.domain.com> 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 root at freenas.domain.com<mailto:root at freenas.domain.com> 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 root at freenas.domain.com<mailto:root at freenas.mydomainname.com> 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 <kspringer at innovateteam.com<mailto:kspringer at innovateteam.com>> wrote: I can enter ' ssh -i ~/.ssh/xymon-rclient root at freenas.mydomainname.com<mailto:root at freenas.mydomainname.com> 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 root at freenas.mydomainname.com<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
On 1 August 2014 10:45, Root, Paul T <Paul.Root at centurylink.com> 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
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 <Paul.Root at centurylink.com <mailto:Paul.Root at centurylink.com>> 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
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" <kspringer at innovateteam.com> 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 <Paul.Root at centurylink.com> 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
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" <kspringer at innovateteam.com <mailto:kspringer at innovateteam.com>> 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 <Paul.Root at centurylink.com <mailto:Paul.Root at centurylink.com>> 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
On 10 September 2014 03:26, Kris Springer <kspringer at innovateteam.com> 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
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 <jlaidman at rebel-it.com.au> 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 <kspringer at innovateteam.com<mailto:kspringer at innovateteam.com>> 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
On 10 September 2014 08:15, Galen Johnson <Galen.Johnson at sas.com> 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
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
participants (5)
-
alex@bakarasse.de
-
Galen.Johnson@sas.com
-
jlaidman@rebel-it.com.au
-
kspringer@innovateteam.com
-
Paul.Root@CenturyLink.com