Using resxtop utility in your shell script
search cancel

Using resxtop utility in your shell script

book

Article ID: 387032

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vSphere ESXi 7.0 VMware vSphere ESXi 8.0

Issue/Introduction

'resxtop' can be used on a remote linux machine to get the same output of 'esxtop' in esxi terminal session. but cannot be used in your shell script due to not be able to pass a password credential as a command line argument. It is quite useful in some use case such as batch mode data collection or launching as a cron job if can be used in a shell script. 

Environment

Using 'resxtop' utility accessing VMware vSphere ESXi environment.

Cause

In usual usage 'resxtop' assumes that reading a password of an access credential from a terminal device (tty) so can't pass the password as command line argument. 

Resolution

Use the following environment variables to pass the access credentials to 'resxtop' utility.

  • VI_SERVER Specifying esx host name or IP address
  • VI_USERNAME Specifying user name.
  • VI_PASSWORD Specifying user password.

Ex)

#!/bin/bash

export VI_SERVER=XXX.YYY.ZZZ.AAA

export VI_USERNAME=root

export VI_PASSWORD=12345678abcdefg

resxtop -b -n 100 > output.txt

 

 

Additional Information

General introduction of 'resxtop' is described in Using the resxtop Utility.