Page 2 of 2

Re: Working through problems with Vmware SDK

Posted: Mon Aug 02, 2010 10:36 am
by mmestnik
Use yum's "provides" feature. Something like `yum provides "perl::version"`

This should list all the pkgs that satisfy this requirement. We have constructed a system for doing this in our installer scripts, here is an example that installs "SNMP" and "Config::IniFiles".

Code: Select all

#
# Copyright (c) 2010 Nagios Enterprises, LLC.  All rights reserved.
#
# $Id: NagiosXI-SNMPTrap.sh 322 2010-06-23 17:12:33Z mmestnik $
export MEID='$Id: NagiosXI-SNMPTrap.sh 322 2010-06-23 17:12:33Z mmestnik $'

# Check whether we have sufficient privileges
if [ $(( $(id -u) )) -ne 0 ]; then
        echo "This script needs to be run as root/superuser."
        echo "$MEID"
        exit 1
fi

# Install prerequisite packages
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
yum -yq check-update > /dev/null
yum -yq install rpmdevtools

# Install prerequisite Perl modules
function yumperlget () {
        echo "Some packages will fail to install, this is normal."
        yum -yq provides perl"($1)" |
                awk '/^Repo/ { print pkg; next; };
                                /^[^ ].* : / { pkg = $1; next; };' | {
                # Here we write our guidelines for pkg selection.
                        read verlist
                        while read i
                                do for topver in $verlist; do rpmdev-vercmp "$topver" "$i"
                                        ret=$(( $? ))
                                        [ $(( $ret )) -eq 11 -o $(( $ret )) -eq 0 ] && {
                                                verlist="$(sed "s/$topver/$i $topver/" \
                                                                <<< "$verlist")"
                                                break
                                        }
                                        [ $(( $ret )) -eq 1 ] && {
                                                # Bail.
                                                echo "Failed to sort a version: $i"
                                                verlist="$verlist $i"
                                                break
                                        }
                                        done
                                grep -qF "$i" <<< "$verlist" || verlist="$verlist $i"
                        done
                        for ech in $verlist; do yum -qy install "$ech"; done
                }
}
yumperlget "SNMP"
yumperlget "Config::IniFiles"

Re: Working through problems with Vmware SDK

Posted: Mon Aug 02, 2010 3:53 pm
by toddac
TSCAdmin wrote:Sorry, I'm using a custom repository where I placed those packages, which I should have checked before giving you that command to try.

I just went through the EPEL, Dag, and Core repositories ... looks like the packages that you're using are the highest available versions for a standard Nagios system install. That being said, I just tried the VMware check scripts using the standard URI and version packages, and the VMware wizard and checks worked just fine. So you should be good to go with what you've got.

When you say you're having problems with the vmware-nagios.zip, have you attempted to import the wizard using the "Admin" page, under "Manage Config Wizards"?
Right - I used to be able to see in the config wizard of the several options available - one for VMware - now that is gone. I had removed the wizard thinking it needed all of the backend working before uploading the wizard - .zip file. Now that I think I'm about there - I can't seem to cross the finish line.

I have the wizard there now - stopped for a second before posting to make sure what I was seeing....and now when I run the wizard - select the radio button and hit next - this is the error message

"Error: It appears as though you have not installed the VMware SDK or ESX plugins on your Nagios XI server. You must have these components properly installed on your system before using this wizard. "

Ideas?

Re: Working through problems with Vmware SDK

Posted: Mon Aug 02, 2010 4:55 pm
by mmestnik
This message is as indicated.

It attempts to load the component and if that fails displays this message.

Re: Working through problems with Vmware SDK

Posted: Tue Aug 03, 2010 8:29 am
by TSCAdmin
I don't think we're running the same VMware wizard (I'm using this one). But you should still have a /usr/local/nagios/libexec/check_esx3.pl check script from op5, so I'd try running that script on the command line and seeing what your output is.

Re: Working through problems with Vmware SDK

Posted: Tue Aug 03, 2010 2:35 pm
by toddac
mmestnik wrote:This message is as indicated.

It attempts to load the component and if that fails displays this message.
Thing is - I have installed it - I've installed the SDK version4 and then the newer 4.1 that was released. I've installed it 4-5 times. Now within the NAGIOS gui via Firefox - trying to run the wizard and it tells me the SDK isn't there. This shouldn't be this hard.

Re: Working through problems with Vmware SDK

Posted: Tue Aug 03, 2010 2:40 pm
by toddac
TSCAdmin wrote:I don't think we're running the same VMware wizard (I'm using this one). But you should still have a /usr/local/nagios/libexec/check_esx3.pl check script from op5, so I'd try running that script on the command line and seeing what your output is.
No luck. I checked that directory and I don't have that perl script present.

And your link is exactly where I got the VMware links for NAGIOS for my vSphere 4.0 update 2 install. If there is an easier way to do this via another wizard - I'm game for it. I noticed there are 2 within the Nagios Exchange. Is one better for VMware than the other? Has anyone compared what they do differently?

Re: Working through problems with Vmware SDK

Posted: Tue Aug 03, 2010 2:43 pm
by toddac
mmestnik wrote:Use yum's "provides" feature. Something like `yum provides "perl::version"`

This should list all the pkgs that satisfy this requirement. We have constructed a system for doing this in our installer scripts, here is an example that installs "SNMP" and "Config::IniFiles".

Code: Select all

#
# Copyright (c) 2010 Nagios Enterprises, LLC.  All rights reserved.
#
# $Id: NagiosXI-SNMPTrap.sh 322 2010-06-23 17:12:33Z mmestnik $
export MEID='$Id: NagiosXI-SNMPTrap.sh 322 2010-06-23 17:12:33Z mmestnik $'

# Check whether we have sufficient privileges
if [ $(( $(id -u) )) -ne 0 ]; then
        echo "This script needs to be run as root/superuser."
        echo "$MEID"
        exit 1
fi

# Install prerequisite packages
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
yum -yq check-update > /dev/null
yum -yq install rpmdevtools

# Install prerequisite Perl modules
function yumperlget () {
        echo "Some packages will fail to install, this is normal."
        yum -yq provides perl"($1)" |
                awk '/^Repo/ { print pkg; next; };
                                /^[^ ].* : / { pkg = $1; next; };' | {
                # Here we write our guidelines for pkg selection.
                        read verlist
                        while read i
                                do for topver in $verlist; do rpmdev-vercmp "$topver" "$i"
                                        ret=$(( $? ))
                                        [ $(( $ret )) -eq 11 -o $(( $ret )) -eq 0 ] && {
                                                verlist="$(sed "s/$topver/$i $topver/" \
                                                                <<< "$verlist")"
                                                break
                                        }
                                        [ $(( $ret )) -eq 1 ] && {
                                                # Bail.
                                                echo "Failed to sort a version: $i"
                                                verlist="$verlist $i"
                                                break
                                        }
                                        done
                                grep -qF "$i" <<< "$verlist" || verlist="$verlist $i"
                        done
                        for ech in $verlist; do yum -qy install "$ech"; done
                }
}
yumperlget "SNMP"
yumperlget "Config::IniFiles"

That's a bit over my head I think.

I ran the command - here is the output.

[root@mybox ~]# yum provides "perl::version"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: linux.mirrors.es.net
* base: mirror.its.uidaho.edu
* epel: linux.mirrors.es.net
* extras: mirror.nic.uoregon.edu
* updates: mirror.ash.fastserv.com
Warning: 3.0.x versions of yum would erroneously match against filenames.
You can use "*/perl::version" and/or "*bin/perl::version" to get that behaviour
No Matches found

Re: Working through problems with Vmware SDK

Posted: Wed Aug 04, 2010 10:25 am
by mmestnik
I'm sorry, that was the wrong syntax, this is exactly what you should type:

Code: Select all

yum provides perl"(version)"
Just so it's clear for future the term "Something like" means I know this is not the correct syntax, but it's what I get off the top of my head. The referance here used:

Code: Select all

yum -yq provides perl"($1)"
I'm sorry for not making this clearer in the first place.