box293 check vmware

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

box293 check vmware

Post by kwhogster »

ESXI 6.0 Host
Nagios Core 4.1.1 on Ubuntu Server 16.04.1
vMA-6.0.0.0-2503728 Host
Following these instructions https://exchange.nagios.org/components/ ... 0&cf_id=29

I have one problem and one issue

first when I got to the section for generating the ssh key that all worked except I was still unable to ssh to the vMA host without a password until I ran this command ssh-copy-id [email protected]
Now I can ssh from the Nagios account on the Nagios host without a password

I was then able to create the readonly account on the ESXi host

Next step is where I am stuck now
vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check vCenter_Name_Version
-bash: /home/vi-admin/box293_check_vmware.pl: cannot execute binary file


here is ls -la from the folder
vi-admin@localhost:~> ls -la
total 636
drwxr-xr-x 7 vi-admin root 4096 Jul 30 10:34 .
drwxr-xr-x 4 root root 4096 Feb 9 2015 ..
-rw------- 1 vi-admin root 471 Jul 30 10:21 .bash_history
-rw-r----- 1 vi-admin root 1211 Feb 9 2015 .bashrc
-rw-r----- 1 vi-admin root 1637 Feb 9 2015 .emacs
drwxr-xr-x 2 vi-admin root 4096 Feb 9 2015 .fonts
-rw-r----- 1 vi-admin root 861 Feb 9 2015 .inputrc
drwxr-xr-x 2 vi-admin root 4096 Feb 9 2015 .mozilla
-rw-r----- 1 vi-admin root 1028 Feb 9 2015 .profile
drwx------ 2 vi-admin root 4096 Jul 30 10:20 .ssh
-rw-r----- 1 vi-admin root 849 Feb 9 2015 .vimrc
drwxr-xr-x 3 vi-admin root 4096 Jul 30 10:34 .vmware
drwxr-xr-x 2 vi-admin root 4096 Feb 9 2015 bin
-rwxr-xr-x 1 vi-admin root 592908 Jul 29 21:14 box293_check_vmware.pl
vi-admin@localhost:~>
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: box293 check vmware

Post by kwhogster »

Everyone
My mistake on this the file was a zipped file and not the script OOOOOOOOOOOOOOOOOOOPS my bad

Now it runs but I get this message

nagios@tgcs017:~$ ssh [email protected]

Welcome to SUSE Linux Enterprise Server 11 SP3 for VMware (x86_64) - Kernel \r (\l).


Last login: Sat Jul 30 14:15:57 EDT 2016 from tgkw001.our.network.tgcsnet.com on ssh
Last login: Sat Jul 30 14:19:18 2016 from nagios.our.network.tgcsnet.com
Welcome to vMA
vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check vCenter_Name_Version
UNKNOWN: Error: Cannot complete login due to an incorrect user name or password.
vi-admin@localhost:~>
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: box293 check vmware

Post by kwhogster »

Update

I do not have vCenter I just have a ESXi 6.0 Host running so I skipped that step and went to the ESXi Host Only step

vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl add --server 10.2.8.10 --username root
Enter password:
Re-enter password:
New entry added successfully
vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check Host_OS_Name_Version
Enter username: root
UNKNOWN: Error: Cannot complete login due to an incorrect user name or password.

what am I missing here?
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: box293 check vmware

Post by kwhogster »

Update

From my vSphere Client I create a new user called Thomas with administrative rights

vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check Host_OS_Name_Version
Enter username: thomas
Enter password:
OK: VMware ESXi 6.0.0 build-3620759

Then from vSphere Client I reset the user root password

vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check Host_OS_Name_Version
Enter username: root
UNKNOWN: Error: Cannot complete login due to an incorrect user name or password.

It does not ask for password when I use root

Does box293_check_vmware.pl check for account root and just try to pass it thru?
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: box293 check vmware

Post by kwhogster »

update

The problem I found is with the Credentials repository

vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl list
Server User Name
10.2.8.10 readonly
10.2.8.10 root

Server Thumbprint

vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl remove --server 10.2.8.10 --username readonly
Existing entry deleted successfully.
vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl list Server User Name
10.2.8.10 root

Server Thumbprint


According to the manual the credstore should only have one account listed otherwise you would have to add --username and --password to the command line really do not want to do that in my cfg file

I then removed root from the credstore

added a new account box293

vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl remove --server 10.2.8.10 --username root
Existing entry deleted successfully.
vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl list Server User Name

Server Thumbprint
vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl add --server 10.2.8.10 --username box293
Enter password:
Re-enter password:
New entry added successfully
vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl list
Server User Name
10.2.8.10 box293

Server Thumbprint
vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check Host_OS_Name_Version UNKNOWN: Error: Cannot complete login due to an incorrect user name or password.

even with --username and --password it fails to use the credstore correctly

vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check Host_OS_Name_Version --username box293 --password "##MyPassw0rd"
UNKNOWN: Error: Cannot complete login due to an incorrect user name or password.


This works

vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check Host_OS_Name_Version --username thomas --password "@@MyPass0rd"
OK: VMware ESXi 6.0.0 build-3620759

I created thomas using vSphere client

Anyone use this? is box293 available ?

Thanks in advanace

Tom
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: box293 check vmware

Post by kwhogster »

Update

after clearing all the accounts in the credstore I ran this

vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl list
Server User Name

Server Thumbprint
vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl add --server 10.2.8.10 --username root
Enter password:
Re-enter password:
New entry added successfully
vi-admin@localhost:~> /usr/lib/vmware-vcli/apps/general/credstore_admin.pl list
Server User Name
10.2.8.10 root

Server Thumbprint
vi-admin@localhost:~> ~/box293_check_vmware.pl --server 10.2.8.10 --check Host_OS_Name_Version
OK: VMware ESXi 6.0.0 build-3620759


Now working this issue is now solved
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: box293 check vmware

Post by tmcdonald »

Glad to see you got it sorted! You caught us on our weekend so we were unable to see this until just now, but good news is good news. Mind if we lock this up?
Former Nagios employee
kwhogster
Posts: 644
Joined: Wed Oct 14, 2015 6:51 pm
Location: Wood Ridge NJ USA
Contact:

Re: box293 check vmware

Post by kwhogster »

Yes go ahead and close this as resolved
Locked