Skip navigation
1 2 Previous Next 13428 Views 22 Replies Latest reply: Nov 16, 2012 12:07 AM by jlee RSS Go to original post
  • MattRK Rank: White Belt 57 posts since
    Apr 28, 2010
    Currently Being Moderated
    15. Jul 28, 2011 4:13 PM (in response to Dave_the_Dude)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    Hmm. So i'm actually trying to figure out how this ssh key thing. As i said earlier, i'm not very familiar Linux or SSH so i'm a little lost. Just as a test i logged into the Zenoss server as root and ssh'd to the OSX box in question. Logged in as root and everything worked great. I then checked my home folder and found a new directory called .ssh. I changed to that directory and found a single file called known_hosts. This file appears to contain a key. Is that the key we need for thsi to work? This is where i get lost. What do i do with this key? Do i need to copy the key listed in this file and create a new file in the /home/zenoss/.ssh folder? I assume if thats what i need to do that i would then point the zKeyPath configuration property to this new file, correct?

     

    I'm also a little lost as to what the following means:

     

    ....you'll need to verify that the key is added to  the authorized_keys file for whatever user account you are using on the  monitored device for monitoring.

     

    Are you saying i need to add the SSH key to my OSX box? Or are you saying that since i'm using the username of "root" (for example) to access the OSX box i need to add the SSH key of the OSX box to the root account of my Zenoss server? If thats right I'm not really sure what purpose this serves. I was under the impression that Zenoss ran as the Zenoss username. Then again i don't know very much about ssh on linux.

     

    I'm also not sure what this means:

     

    Then, make sure you use this same user  account in zCommandUsername for the monitored device or device class.

     


    So basically i'm completely lost. Any help would be appriciated.

     

    Thanks again!

  • MattRK Rank: White Belt 57 posts since
    Apr 28, 2010
    Currently Being Moderated
    16. Jul 28, 2011 7:34 PM (in response to MattRK)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    Okay well i think did it right but i'm still getting there errors. Here is what i did:

     

    1. Generated an SSH key pair (private and public) on my Zenoss box as the zenoss user. ($ ssh-keygen -t dsa -b 1024)
    2. Installed the public key (id_dsa.pub) into the authorized_keys file  the target OSX box. ($ cat /home/zenoss/.ssh/id_dsa.pub | ssh  root@target.hostname.tld "cat >> /var/root/.ssh/authorized_keys")
    3. From the command line i was able to SSH into the OSX box without using a password. ($ ssh root@target.hostname.tld)
    4. Under the Configuration Properties for the /Server/OSX device  class  i set the zCommandUsername to root. (The user im using to monitor.  The  same user i used to test with in step 3)
    5. I also set the zKeyPath to point to the private key i generated in step 1. (/home/zenoss/.ssh/id_dsa)
    6. I removed/deleted the zCommandPassword field since i didn't need  it  anymore. (Also, as an fyi, i didn't specify a passphrahse when i   generated the key in step 1. So i don't think i need this field)
    7. Restarted Zenoss (Not sure if it was required but i did it to be safe.)

     

    I'm still getting the same errors though. Any suggestions?

  • MattRK Rank: White Belt 57 posts since
    Apr 28, 2010
    Currently Being Moderated
    17. Aug 1, 2011 12:45 PM (in response to jmp242)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    jmp242 wrote:

     

    This isn't entirely true. Because Zenoss (often) uses a version of "stufF" like python and (maybe?) perl, that is a different version from the system, it's usually installed separately / locally to keep it isolated from breaking anything for the rest of the OS. In that case, you cannot use an RPM to install to the local version of the environment, and must use something like CPAN.

     

    So do you think this is part of my problem? I've tried all sorts of troubleshooting and have yet to get anywhere with this pack. I'm still getting a lot of these errors:

     

    Cmd:  /opt/zenoss/ZenPacks/ZenPacks.ddevers.MacOSX-1.8-py2.6.egg/ZenPacks/ddevers/MacOSX/libexec/check_macosx_memory  10.0.0.203 "root" "" "/home/zenoss/.ssh/id_dsa" - Code: 2 -  Msg: Misuse of shell builtins

     

    Any advice or suggestions would be greatly appriciated.

  • jmp242 ZenossMaster 4,060 posts since
    Mar 7, 2007
    Currently Being Moderated
    18. Aug 1, 2011 12:52 PM (in response to MattRK)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    It could be, I haven't used the zenpack...

     

    --

    James Pulver

    Information Technology Area Supervisor

    LEPP Computer Group

    Cornell University

  • MattRK Rank: White Belt 57 posts since
    Apr 28, 2010
    Currently Being Moderated
    19. Aug 1, 2011 7:18 PM (in response to Dave_the_Dude)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    So i did a bit more troubleshooting today and figured out i missed a package during the initial install. Originally i replaced your step 6 with: $ yum install perl-Net-SSH. This was the wrong package. The correct package was perl-Net-SSH-Perl. Once this was installed things progressed a little bit, though not very far.

     

    At this point i'm still getting errors. Specifically:

     

    Cmd:  /opt/zenoss/ZenPacks/ZenPacks.ddevers.MacOSX-1.8-py2.6.egg/ZenPacks/ddevers/MacOSX/libexec/check_macosx_memory  10.1.44.201 "administrator" "" "/home/zenoss/.ssh/id_rsa" - Code: 9 -  Msg: Unknown error code: 9

     

    One thing i tried was generating RSA keys instead of DSA keys. That didn't really do anything. I got the same errors as before. I also updated perl from 5.8.8-27 to 5.8.8-32. That also didn't do much.

     

    Lastly, i took a look at the check_macosx_cpu script you wrote. For the hell of it i made a copy of the script and named it check_macosx_cpu2. I then changed the four variables at the top and input the info for one of my OSX machines i'm trying to monitor. I ran the script several times ($ perl check_macosx_cpu2) with an SSH key as well as several times without a key and just used the password. In ALL cases this is the error i received:

    [zenoss@Zenoss libexec]$ perl check_macosx_cpu2
    Key class 'Net::SSH::Perl::Key::DSA' is unsupported: Math::BigInt version 1.78 required--this is only version 1.77 at /usr/lib/perl5/vendor_perl/5.8.8/Crypt/DSA/KeyChain.pm line 4, <GEN0> line 1.
    BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8.8/Crypt/DSA/KeyChain.pm line 4, <GEN0> line 1.
    Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8.8/Crypt/DSA.pm line 7, <GEN0> line 1.
    BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8.8/Crypt/DSA.pm line 7, <GEN0> line 1.
    Compilation failed in require at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/Key/DSA.pm line 14, <GEN0> line 1.
    BEGIN failed--compilation aborted at /usr/lib/perl5/vendor_perl/5.8.8/Net/SSH/Perl/Key/DSA.pm line 14, <GEN0> line 1.
    Compilation failed in require at (eval 20) line 1, <GEN0> line 1.
    BEGIN failed--compilation aborted at (eval 20) line 1, <GEN0> line 1.

     

    So at this point i think there are two possibilities:

     

    1) Your script is broken. I'm not sure why it gave me the above error even when i was only using the username and password. (No SSH key)

     

    2) I am running the incorrect versions of one or more of the required perl modules. As i previously stated, i am running CentOS 5.4 and installed Zenoss using the native RPM. All of the dependencies for Zenoss (Such as MySQL and Net-SNMP) were installed using the YUM package manager. To stay consistent and avoid conflicts i also used Yum to install the perl modules you required for this ZenPack. Perhaps one of the requirements is out of date?

     

    Here are the versions of Perl and required modules that i have installed via YUM:

     

    Perl - 5.8.8

    Net::SSH::Perl - 1.34

    Math::BigInt::GMP - 1.24

    Math::BigInt::Pari - 1.13

     

    Based on the error message above, i am lead to believe that the problem is that i'm running the wrong version of Math::BigInt. However upon further investigation i found that Math:BigInt is native to Perl 5 and not a seperate module. And as far as i can tell, i have the latest version of Perl. Both BigInt modules are slightly out of date; unfortunately the above is the latest version available via RPMForge.

     

    Anyway, i suppose I’ll just let this rest until you have a chance to look at all my 10,000 posts and formulate a response. Feel free to contact me directly if you wish. I would love to get this zenpack working as i have a lot of important OSX boxes i'd love to monitor.

     

    Thanks!

  • prioret Rank: White Belt 20 posts since
    May 10, 2008
    Currently Being Moderated
    20. Jan 4, 2012 1:37 PM (in response to MattRK)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    I think I'm getting the same error:

     

     


     

    Cmd: /opt/zenoss/ZenPacks/ZenPacks.ddevers.MacOSX-1.8-py2.6.egg/ZenPacks/ddevers/MacOSX/libexec/check_macosx_memory 10.0.1.220 "

     

    Device:10.0.1.220
    Component:/Server/MacOSX/Memory
    Event Class:/Cmd/Fail
    Status:0
    Start Time:2012/01/04 13:26:33.000
    Stop Time:2012/01/04 13:26:33.000
    Count:1
    Message:Cmd: /opt/zenoss/ZenPacks/ZenPacks.ddevers.MacOSX-1.8-py2.6.egg/ZenPacks/ddevers/MacOSX/libexec/check_macosx_memory 10.0.1.220 "admin" "xxxxxx" "" - Code: 9 - Msg: Unknown error code: 9
    Systems:
    Groups:
    Location:
    Device Class:/Server/MacOSX
    Production State:Production
    Device Priority:Normal

     

     

    Hide details

     

     

    agentzencommand
    clearid
    component/Server/MacOSX/Memory
    count1
    dedupid10.0.1.220|/Server/MacOSX/Memory|/Cmd/Fail|/Server/MacOSX/Memory|3
    device10.0.1.220
    DeviceClass/Server/MacOSX
    DeviceGroups|
    DevicePriority3
    eventClass/Cmd/Fail
    eventClassKey
    eventClassMapping
    eventGroup
    eventKey/Server/MacOSX/Memory
    eventState0
    evid655ea141-4201-428a-9bdc-de44ed1fc8f4
    facilityunknown
    firstTime2012/01/04 13:26:33.000
    ipAddress10.0.1.220
    lastTime2012/01/04 13:26:33.000
    Location
    managerlocalhost.localdomain
    messageCmd: /opt/zenoss/ZenPacks/ZenPacks.ddevers.MacOSX-1.8-py2.6.egg/ZenPacks/ddevers/MacOSX/libexec/check_macosx_memory 10.0.1.220 "admin" "xxxxx" "" - Code: 9 - Msg: Unknown error code: 9
    monitorlocalhost
    ntevid0
    ownerid
    priority-1
    prodState1000
    severity3
    stateChange2012/01/04 13:26:33.000
    summaryCmd: /opt/zenoss/ZenPacks/ZenPacks.ddevers.MacOSX-1.8-py2.6.egg/ZenPacks/ddevers/MacOSX/libexec/check_macosx_memory 10.0.1.220 "
    suppid
    Systems|

     

    Event Details

     

     

    performanceData

     


    LOG

     

     

     

     




     

     

     

     

  • rlindell Rank: White Belt 12 posts since
    Nov 1, 2008
    Currently Being Moderated
    21. Nov 15, 2012 10:52 AM (in response to prioret)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    We did not use SSH keys, and used only username/password and this worked well with OS X Server 10.4, but we started having issues adding OS X Server 10.7 hosts and were getting the "Msg: Unknown error code: 9" and the fix for us was enabling 'password' authentication on the OS X Server 10.7 (and restart remote access on the OS X Server). 

     

    Configuration file on OS X 10.7 is (/etc/sshd_config) and the line:

     

    #PasswordAuthentication no

     

    uncomment and change to 'yes' like so:

     

    PasswordAuthentication yes

     

    Presumably, if you got the keys working this would not be required.

  • jlee Newbie 1 posts since
    Nov 16, 2012
    Currently Being Moderated
    22. Nov 16, 2012 12:07 AM (in response to Dave_the_Dude)
    Re: Mac OS X Zenpack (1.8) - it's alive!!

    Hey guys, I had this ZenPack working on several versions on Mac OS X and it broke when we got it running against newer releases.

     

    As rlindell pointed out above, one of the fix was to hack sshd_config to enable PasswordAuthentication.

     

    The next big fix is actually in the perl code. The output of the 'top' command changed when it is being executed without a VT; CPU usage info went to a new line.

     

    Here's the diff of $ZENHOME/ZenPacks/ZenPacks.ddevers.MacOSX-1.8-py2.6.egg/ZenPacks/ddevers/MacOSX/libexec/

     

    44d43
    < my $cmd_OSVer = 'uname -r | sed "s/\..*//g"';
    46d44
    < my $cmd_CpuInfo2 = 'top -l 1 | grep -i "CPU usage" | sed "s/[%,]//g"';
    49,56d46
    < # Get the OS version - 2012/11/16 J.LEE
    < # The top command output changed in newer MacOS X versions
    < #
    < my $osver = 0;
    < my($out0, $err0, $exit0) = $ssh->cmd($cmd_OSVer);
    < if ($err0) { die "$err0"; }
    < if ($out0) { $osver = $out0; }
    < 
    72,81d61
    < # Get more raw CPU Info for newer MacOS X versions - 2012/11/16 J.LEE
    < #
    < my @cpuraw2 = {};
    < if ($osver > 9)
    < {
    <     my($out3, $err3, $exit3) = $ssh->cmd($cmd_CpuInfo2);
    <     if ($err3) { die "$err3"; }
    <     if ($out3) { @cpuraw2 = split(' ', $out3); }
    < }
    < 
    83d62
    < # Added conditional for newer MacOS X versions - 2012/11/16 J.LEE
    85,90c64
    < my $cpustats = "";
    < 
    < if ($osver > 9) { $cpustats = "sysLoad1=".$cpuraw[2]." sysLoad5=".$cpuraw[3]." sysLoad15=".$cpuraw[4]." cpuUsr=".$cpuraw2[2]." cpuSys=".$cpuraw2[4]." cpuIdle=".$cpuraw2[6]." cpuCount=$cpucount"; }
    < else { $cpustats = "sysLoad1=".$cpuraw[2]." sysLoad5=".$cpuraw[3]." sysLoad15=".$cpuraw[4]." cpuUsr=".$cpuraw[7]." cpuSys=".$cpuraw[9]." cpuIdle=".$cpuraw[11]." cpuCount=$cpucount"; }
    < 
    < chomp($cpustats);
    ---
    > my $cpustats = "sysLoad1=".$cpuraw[2]." sysLoad5=".$cpuraw[3]." sysLoad15=".$cpuraw[4]." cpuUsr=".$cpuraw[7]." cpuSys=".$cpuraw[9]." cpuIdle=".$cpuraw[11]." cpuCount=$cpucount";

     

    Hope this helps.

     

    Regards,

    Justin Lee

    Information Officer LLC

    http://www.informationofficer.com

    Hosting * Software * Consulting

1 2 Previous Next

More Like This

  • Retrieving data ...