Skip navigation
1 2 Previous Next 44849 Views 23 Replies Latest reply: Apr 21, 2010 12:07 PM by mlist RSS
mlist Rank: White Belt 49 posts since
Mar 27, 2009
Currently Being Moderated

Apr 1, 2010 11:59 AM

Problem executing check_by_ssh and Nagios plugins: access denied from GUI

Hi

 

I need to use Nagios plugins using ssh because this is extremely useful and flexible. Moreover on nagiosexchange.org you can find hundreds of out-of-the-box plugins and I need to use them for an important project.

I'm running some nagios plugins (check_http,check_snmp_interfacestatus etc...) without problems but I'm not able to run Nagios plugins using ssh. I have read some post in the forum and I spent 2 days but I didn't find a solution.

This is the problem:

 

remote server: 192.168.252.59

Nagios-plugins installed on remote server in /usr/local/nagios

 

On Zenoss server I have executed from command line the following plugins:

[zenoss@svxzems1mc libexec]$ pwd
/opt/zenoss/libexec

[zenoss@svxzems1mc libexec]$ ./check_by_ssh -l root -H 192.168.252.59 -C '/usr/local/nagios/libexec/check_file_age -f /usr/local/nagios/libexec/check_fping'
root@192.168.252.59's password:
FILE_AGE CRITICAL: /usr/local/nagios/libexec/check_fping is 9323 seconds old and 95842 bytes

 

As you can see it works correctly from command line. It works both using root user or zenoss user.

 

Using Zenoss GUI I created a new template and copied the same command but the error message is:

Executing command
/opt/zenoss/libexec/check_by_ssh -l root -H 192.168.252.59 -C '/usr/local/nagios/libexec/check_file_age -f /usr/local/nagios/libexec/check_fping'
against 192.168.252.59
Remote command execution failed: Permission denied, please try again.
DONE in 0 seconds

 


I have tried the option "Use SSH" but nothing is changed.On the zproperties of the device I have configured correctly both the "zCommandUsername" and "zCommandPassword" in fact the modeling is working correctly (using ssh). In this case I'm using root user.

In attachment a screenshot that shows how the template is configured.

 

Could someone give me a tip? Did someone tried to use successfully the check_by_ssh command + Nagios plugins? What is wrong in your opinion? Why from command line it works instead not using the GUI?


This is VERY IMPORTANT for me, I hope that someone can help me asap

 

Thanks

Attachments:
  • Matt Ray Rank: Zen Master 2,484 posts since
    Apr 5, 2008

    When you enable "Use SSH", you're telling Zenoss to SSH to that box and make the call there, so check_by_ssh is redundant. It appears to me that you want to

     

    1) ssh to 192.168.252.59 as root and

    2) call '/usr/local/nagios/libexec/check_file_age -f  /usr/local/nagios/libexec/check_fping' on the remote machine

     

    For #1 to work you need to either have the 'zCommandPassword' and 'zCommandUsername' (or the 'zKeyPath') propertly set for that user on that device, in your case root.

     

    For #2 to work the user on the remote machine needs to have the proper privileges to make that call.

  • jmp242 ZenossMaster 4,060 posts since
    Mar 7, 2007

    I think you may be the first one, and you may be confusing how to do

    this with Zenoss... The output of your check_file_age doesn't look like

    something Zenoss would use in a command data source unless it's been

    changed a bunch in 2.5 (Matt Ray, please correct me if I'm wrong, heck,

    any community member).

     

    I wonder if your problem isn't Permission Denied per se, but that Zenoss

    doesn't like the output? I.e. the "nagios format" that I've always used

    in Zenoss as output is:

     

    Datasource|Datapoint=value

     

    I know there were problems with ':' (colons) in the output, but they

    caused a different error.

     

    Anyway, I wouldn't use check_by_ssh as that seems redundant - use

    Zenoss's built in ssh facility.

    --

    James Pulver

    Information Technology Area Supervisor

    LEPP Computer Group

    Cornell University

     

     

     

    mlist wrote, On 4/2/2010 5:50 AM:

    Hi matt

     

    before all thanks for your kind reply.

    What I'm trying to do is simply to use check_by_ssh + "plugins" that I always used with Nagios. As explained, ON ZENOSS SERVER executing the command from command line it works perfectly (using both root user or zenoss user). Just to be sure to avoid permission problems, I have added the remote device in in /devices/server/ssh/linux and in the zproperties I used "root" as remote user. The modeling and the monitoring work both correctly. The problem is just related to the "chech_by_ssh" command that strangely works from command line but not from the GUI even disabling "Use Ssh" option.

    I also tried leaving "Use SSH" enabled but changing the command in this way:

    '/usr/local/nagios/libexec/check_file_age -f /usr/local/nagios/libexec/check_fping'

    As you can see I have removed the check_by_ssh command but executing the "test", the output is:

    Executing command

    /usr/local/nagios/libexec/check_file_age -f /usr/local/nagios/libexec/check_fping

    against 192.168.252.59

    /bin/sh: /usr/local/nagios/libexec/check_file_age: No such file or directory

    DONE in 0 seconds

     

    Just to be sure that the problems wasn't related to the command, I tried from command line and it worked.

    Re: Problem executing check_by_ssh and Nagios plugins: access denied from GUI$ ssh root@192.168.252.59 '/usr/local/nagios/libexec/check_file_age -f /usr/local/nagios/libexec/check_fping'

    root@192.168.252.59's password:

    FILE_AGE CRITICAL: /usr/local/nagios/libexec/check_fping is 73922 seconds old and 95842 bytes

     

    Thus..as you can see the problem seems to bt just related to the GUI.

     

    Do you have any other suggestion? Did someone already tried to execute Nagios check_by_ssh command or am I the first one?

    >

  • jmp242 ZenossMaster 4,060 posts since
    Mar 7, 2007

    On the remote computer you would need the check_file_age program and

    would point to that and run it...

    --

    James Pulver

    Information Technology Area Supervisor

    LEPP Computer Group

    Cornell University

     

     

     

    mlist wrote, On 4/2/2010 9:33 AM:

    Ok maybe zenoss isn't really able to manage check_by_ssh format but at this point I have some important questions:

     

    1) When Zenoss claim to be able to run Nagios plugins, does it mean ONLY plugins that doesn't require ssh? I mean: using chech_http or plugins that requires snmp I have no problems but I'm not able to use those plugins that require ssh.

    2) Supposing that is possible to run remote Nagios plugins like check_file_age using NATIVE zenoss ssh falicity (thus not using check_by_ssh), what is the correct way to proceed? As explained in my previous post I have already tried to execute remote command in this way:

    "Use SSH" enabled

     

  • linuxdynasty ZenossMaster 156 posts since
    Apr 10, 2007

    Instead of using the check_by_ssh command in zenoss, use the "Use SSH" option in the command datasource just like Matt Ray said. I use quite a few commands like that. Follow Matt Ray's advice and it will work as we also use the check file age command too.

  • linuxdynasty ZenossMaster 156 posts since
    Apr 10, 2007

    In your zProperties, did you add the username/password of the user that is going to ssh into the remote node? I have attached a screen shot of zproperties.

    Attachments:
  • linuxdynasty ZenossMaster 156 posts since
    Apr 10, 2007

    Here is how we use the command ..
    check_file_age -c 100000000 -w 100000000 -W 1000000000 -C 1000000000 -f /tmp/nearJobs.out | awk '{print "OK|fileAge="$$5, "fileSize="$$9}'

     

    with the zpath set to the directory where the plugin lives... /usr/loca/nagios/libexec

  • linuxdynasty ZenossMaster 156 posts since
    Apr 10, 2007

    On a side note, you do realize you have Enabled set to false... Another suggestion, is to not use the root user.. if you are having issues with utils.pm you should try adding this inside the script...use lib "/usr/local/nagios/libexec"; or in your case use lib "/opt/zenoss/libexec"; on your remote box

1 2 Previous Next

More Like This

  • Retrieving data ...

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points