Using the vSphere Diagnostic Tool Fling


Technology keeps moving but this post has not.

What you're about to read hasn't been updated in more than a year. The information may be out of date. Let me know if you see anything that needs fixing.

VMware vCenter does wonders for abstracting away the layers of complexity involved in managing a large virtual infrastructure, but when something goes wrong it can be challenging to find exactly where the problem lies. And it can be even harder to proactively address potential issues before they occur.

Fortunately there's a super-handy utility which can making diagnosing vCenter significantly easier, and it comes in the form of the vSphere Diagnostic Tool Fling. VDT is a Python script which can be run directly on a vCenter Server appliance (version 6.5 and newer) to quickly check for problems and misconfigurations affecting:

  • vCenter Basic Info
  • Lookup Service
  • Active Directory
  • vCenter Certificates
  • Core Files
  • Disk Health
  • vCenter DNS
  • vCenter NTP
  • vCenter Port
  • Root Account
  • vCenter Services
  • VCHA

For any problems which are identified, VDT will provide simple instructions and/or links to Knowledge Base articles for more detailed instructions on how to proceed with resolving the issues. Sounds pretty useful, right? And yet, somehow, I keep forgetting that VDT is a thing. So here's a friendly reminder to myself of how to obtain and use VDT to fix vSphere woes. Let's get started.

1. Obtain

Obtaining the vSphere Diagnostic Tool is very easy. Just point a browser to https://flings.vmware.com/vsphere-diagnostic-tool, tick the box to agree to the Technical Preview License, and click the big friendly Download button. Download

It will show up in .zip format.

2. Deploy

This needs to be run directly on the vCenter appliance so you'll need to copy the .zip package onto that server. Secure Copy Protocol (SCP) is a great way to make that happen. By default, though, the VCSA uses a limited Appliance Shell which won't allow for file transfers. Fortunately it's easy to follow this KB to switch that to a more conventional bash shell:

  1. SSH to the VCSA.
  2. Execute shell to launch the bash shell.
  3. Execute chsh -s /bin/bash to set bash as the default shell.

Once that's done, just execute this on your local workstation to copy the .zip from your ~/Downloads/ folder to the VCSA's /tmp/ directory:

1scp ~/Downloads/vdt-v1.1.4.zip root@vcsa.lab.bowdre.net:/tmp/

3. Extract

Now pop back over to an SSH session to the VCSA, extract the .zip, and get ready for action:

 1root@VCSA [ ~ ]# cd /tmp
 2
 3root@VCSA [ /tmp ]# unzip vdt-v1.1.4.zip
 4Archive:  vdt-v1.1.4.zip
 53557676756cffd658fd61aab5a6673269104e83c
 6  creating: vdt-v1.1.4/
 7  ...
 8  inflating: vdt-v1.1.4/vdt.py
 9
10root@VCSA [ /tmp ]# cd vdt-v1.1.4/

4. Execute

Now for the fun part:

1root@VCSA [ /tmp/vdt-v1.1.4 ]# python vdt.py
2_________________________
3   RUNNING PULSE CHECK
4
5Today: Sunday, August 28 19:53:00
6Version: 1.1.4
7Log Level: INFO
8
9Provide password for administrator@vsphere.local:

After entering the SSO password, VDT will run for a few minutes and generate an on-screen report of its findings. Reports can also be found in the /var/log/vmware/vdt/ directory.

5. Review

Once the script has completed, it's time to look through the results and fix whatever can be found. As an example, here are some of the findings from my deliberately-broken-for-the-purposes-of-this-post vCenter:

Hostname/PNID mismatch

 1   VCENTER BASIC INFO
 2BASIC:
 3        Current Time: 2022-08-28 19:54:08.370889
 4        vCenter Uptime: up 2 days
 5        vCenter Load Average: 0.26, 0.19, 0.12
 6        Number of CPUs: 2
 7        Total Memory: 11.71
 8        vCenter Hostname: VCSA
 9        vCenter PNID: vcsa.lab.bowdre.net
10        vCenter IP Address: 192.168.1.12
11        Proxy Configured: "no"
12        NTP Servers: pool.ntp.org
13        vCenter Node Type: vCenter with Embedded PSC
14        vCenter Version: 7.0.3.00800 - 20150588
15DETAILS:
16        vCenter SSO Domain: vsphere.local
17        vCenter AD Domain: No DOMAIN
18        Number of ESXi Hosts: 2
19        Number of Virtual Machines: 25
20        Number of Clusters: 1
21        Disabled Plugins: None
22
23[FAIL]  The hostname and PNID do not match!
24        Please see https://kb.vmware.com/s/article/2130599 for more details.

Silly me - I must have changed the hostname at some point, which is not generally a Thing Which Should Be done. I can quickly consult the referenced KB to figure out how to fix my mistake using the /opt/vmware/share/vami/vami_config_net utility.

Missing DNS

 1Nameserver Queries
 2192.168.1.5
 3 [FAIL] DNS with UDP - unable to resolve vcsa to 192.168.1.12
 4 [FAIL] Reverse DNS - unable to resolve 192.168.1.12 to vcsa
 5 [FAIL] DNS with TCP - unable to resolve vcsa to 192.168.1.12
 6
 7 Commands used:
 8  dig +short <fqdn> <nameserver>
 9  dig +noall +answer -x <ip> <namserver>
10  dig +short +tcp <fqdn> <nameserver>
11
12RESULT: [FAIL]
13Please see KB: https://kb.vmware.com/s/article/54682

Whoops - I guess I should go recreate the appropriate DNS records.

Old core files

 1   CORE FILE CHECK
 2INFO:
 3These core files are older than 72 hours.  consider deleting them
 4at your discretion to reduce the size of log bundles.
 5  FILES:
 6        /storage/core/core.SchedulerCron.p.11919 Size: 34.36MB Last Modified: 2022-08-03T22:28:01
 7        /storage/core/core.python.1445 Size: 20.8MB Last Modified: 2022-08-03T22:13:37
 8        /storage/core/core.python.27513 Size: 41.12MB Last Modified: 2022-07-28T04:43:55
 9        /storage/core/core.ParGC.6 Size: 802.82MB Last Modified: 2022-07-28T04:38:54
10        /storage/core/core.python.12536 Size: 39.82MB Last Modified: 2022-07-28T04:18:41
11        /storage/core/core.python.50223 Size: 281.55MB Last Modified: 2022-07-13T22:22:13
12        /storage/core/core.lsassd.56082 Size: 256.82MB Last Modified: 2022-07-13T22:16:53
13        /storage/core/core.SchedulerCron.p.21078 Size: 29.52MB Last Modified: 2022-06-25T11:05:01
14        /storage/core/core.python.19815 Size: 25.44MB Last Modified: 2022-06-25T11:03:06
15        /storage/core/core.python.51946 Size: 25.8MB Last Modified: 2022-06-18T10:22:08
16        /storage/core/core.python.40291 Size: 25.44MB Last Modified: 2022-06-13T11:21:26
17        /storage/core/core.python.14872 Size: 43.97MB Last Modified: 2022-06-13T10:35:04
18        /storage/core/core.python.11833 Size: 20.71MB Last Modified: 2022-06-13T10:30:01
19        /storage/core/core.python.35275 Size: 42.87MB Last Modified: 2022-06-13T07:17:27
20        /storage/core/core.VM.6 Size: 1.21GB Last Modified: 2022-06-13T00:38:56
21[INFO]  Number of core files: 15

Those core files can be useful for investigating specific issues, but holding on to them long-term doesn't really do much good. After checking to be sure I don't need them, I can get rid of them all pretty easily like so:

1find /storage/core/ -name "core.*" -type f -mtime +3 -exec rm {} \;

NTP status

1   VC NTP CHECK
2[FAIL] NTP and Host time are both disabled!

Oh yeah, let's turn that back on with systemctl start ntpd.

Account status

1   Root Account Check
2[FAIL]  Root password expires in 13 days
3        Please search for 'Change the Password of the Root User'
4        in vCenter documentation.

That's a good thing to know. I'll take care of that while I'm thinking about it.

1chage -M -1 -E -1 root

Recheck

Now that I've corrected these issues, I can run VDT again to confirm that everything is back in a good state:

 1   VCENTER BASIC INFO
 2  BASIC:
 3        Current Time: 2022-08-28 20:13:25.192503
 4        vCenter Uptime: up 2 days
 5        vCenter Load Average: 0.28, 0.14, 0.10
 6        Number of CPUs: 2
 7        Total Memory: 11.71
 8        vCenter Hostname: vcsa.lab.bowdre.net
 9        vCenter PNID: vcsa.lab.bowdre.net
10        vCenter IP Address: 192.168.1.12
11        Proxy Configured: "no"
12        NTP Servers: pool.ntp.org
13        vCenter Node Type: vCenter with Embedded PSC
14        vCenter Version: 7.0.3.00800 - 20150588
15DETAILS:
16        vCenter SSO Domain: vsphere.local
17        vCenter AD Domain: No DOMAIN
18        Number of ESXi Hosts: 2
19        Number of Virtual Machines: 25
20        Number of Clusters: 1
21        Disabled Plugins: None
22[...]
23Nameserver Queries
24192.168.1.5
25 [PASS] DNS with UDP - resolved vcsa.lab.bowdre.net to 192.168.1.12
26 [PASS] Reverse DNS - resolved 192.168.1.12 to vcsa.lab.bowdre.net
27 [PASS] DNS with TCP - resolved vcsa.lab.bowdre.net to 192.168.1.12
28 Commands used:
29  dig +short <fqdn> <nameserver>
30  dig +noall +answer -x <ip> <namserver>
31  dig +short +tcp <fqdn> <nameserver>
32RESULT: [PASS]
33[...]
34   CORE FILE CHECK
35[PASS]  Number of core files: 0
36[PASS]  Number of hprof files: 0
37[...]
38NTP Status Check
39+-----------------------------------LEGEND-----------------------------------+
40| remote: NTP peer server                                                    |
41| refid: server that this peer gets its time from                            |
42| when: number of seconds passed since last response                         |
43| poll: poll interval in seconds                                             |
44| delay: round-trip delay to the peer in milliseconds                        |
45| offset: time difference between the server and client in milliseconds      |
46+-----------------------------------PREFIX-----------------------------------+
47| * Synchronized to this peer                                                |
48| # Almost synchronized to this peer                                         |
49| + Peer selected for possible synchronization                               |
50| – Peer is a candidate for selection                                        |
51| ~ Peer is statically configured                                            |
52+----------------------------------------------------------------------------+
53     remote           refid      st t when poll reach   delay   offset  jitter
54==============================================================================
55*104.171.113.34  130.207.244.240  2 u    1   64   17   16.831  -34.597   0.038
56RESULT: [PASS]
57[...]
58   Root Account Check
59[PASS]  Root password never expires

All better!

Conclusion

The vSphere Diagnostic Tool makes a great addition to your arsenal of troubleshooting skills and utilities. It makes it easy to troubleshoot errors which might occur in your vSphere environment, as well as to uncover dormant issues which could cause serious problems in the future.


runtimeterror


 jbowdre