You are here

VMWare VMWAREHOSTCREDENTIALS syntax

6 posts / 0 new
Last post
c0mputernick
c0mputernick's picture
VMWare VMWAREHOSTCREDENTIALS syntax

Hello,

In previous versions of opsview there was a esxuser and esxpass for defining user/pass variables for adding VMWare hosts.  This new version only has one VMWAREHOSTCREDENTIALS.  Do we make two variables like the old way and assume it can figure out which one is the username %1 and password %2 or do we somehow combine the two onto one line now?  I get errors that it cannot login with the combinations ive tried, but when i troubleshoot the problem, i can manually put the user/pass in and it will connect and give me the results of the check so i know the credentials are correct but i cant figure out how to use the new variable option.  Ive been over the docs and forum and cant seem to find any info related to this.  Sorry if ive missed where this was discussed.  Thanks for the help. 

Duncan Ferguson
dferguson's picture
The checks for both VMWare

The checks for both VMWare hosts and guests that use this variable are defined using:

  • Arg 1 - username
  • Arg 2 - password

The guest checks additionally use:

  • Arg 3 - VMWare host
  • Arg 4 - VMWare guest

  Duncs

c0mputernick
c0mputernick's picture
Thanks for the reply, thats

Thanks for the reply, thats what the docs said, but how do you define Arg1 and Arg2?  They arent labeled as such in that window when you are setting them up. Also, when you add a new variable it adds it to the top of the list.  I guess the interface is just a little confusing.  Will the first variable i create always be Arg1?  I just wish it was labeled somehow when you create them.

c0mputernick
c0mputernick's picture
Also, is it all one line or

Also, is it all one line or do you need two separate variable definitions?  If its one line, how do you format that? If its not two lines, is there anything special you need to do to define the variable so that it knows which is arg1 and which is arg2?

Thanks for the help.

Duncan Ferguson
dferguson's picture
A quick overview of variables

A quick overview of variables:

A list of available variables can be seen on the "Menu => Settings => Variable Settings" page in 5.x

Variables can be added to hosts on the "Menu => Settings => Host Settings => <hostname> => Variables" tab.

To add a variable onto a host it must first be defined on the global 'Variable Settings' page.

Each variable can be broken down into 4 arguments, with labels for each argument and their default values set on the 'Variable Settings' page.  Each argument can have the default value overridden on the host they are assigned to.

Taking the variable VMWAREHOSTCREDENTIALS  as an example, the default label for arg 1 is 'Username' and for arg 2 it is 'Password' (which is also marked as encrypted by default).  These labels can be seen when adding the variable to a host.

When adding a variable to a host, you set an "overall value" for the variable (in the Value column).  When this has been set and the value saved, the arguments are then shown in the bottom section of the modal window under 'Host variable details'.   You can override the default arguments by selecting the appropriate checkbox and typing in the new value as appropriate.

To see how the variable and the arguments are used, here is plugin commands used as aprt of the 'Host CPU Usage' service check:

check_vmware_api.pl -H $HOSTADDRESS$ -u '%VMWAREHOSTCREDENTIALS:1%' -p '%VMWAREHOSTCREDENTIALS:2%' -l cpu -s usage %VMWARE_API_ARGUMENTS:1%

You can see there are two variables used here; VMWAREHOSTCREDENTIALS and VMWARE_API_ARGUMENTS.  The VMWAREHOSTCREDENTIALS variable is broken down like this:

Macro used  Value returned
%VMWAREHOSTCREDENTIALS% 'overall value' - not used in the above check definition
%VMWAREHOSTCREDENTIALS:1% username aka arg 1
%VMWAREHOSTCREDENTIALS:2% password aka arg 2
%VMWAREHOSTCREDENTIALS:3% arg 3 - not used in the above check definition
%VMWAREHOSTCREDENTIALS:4% arg 4 - not used in the above check definition

 

Passwords cannot be stored in the 'overall value' of the variable as it is limited to alphabetic characters (the arguments section should always used for passwords as they can be encrypted). 

A number of variables do not have the 'overall value' used in check arguments, but this must be set to something so it can be saved (since you can have multiple variables of the same type assigned to a host, such as DISK), and other variables may use the arguments section.  THey can be set up and used in whatever appropriate fashion is required.  

The order of the variables should be alphabetical by name, and then sorted by 'overall value'.

There are more in-depth details in our documentation at: https://knowledge.opsview.com/articles/opsview-monitor-520/48-variables....

  Duncs

c0mputernick
c0mputernick's picture
Thank you for your reply, it

Thank you for your reply, it was "To add a variable onto a host it must first be defined on the global 'Variable Settings' page." that was throwing me off.  After settings some default values in the global settings it started to work.

Thanks for the help.