If you have machines that cannot run the Dell KACE Agent, you can create your own XML file and use it to upload machine inventory data to the K1000 provided that you have enabled Inventory API Access. The Administrator Guidedescribes this process, and provides a sample Perl script.

 

To upload inventory information for ESXi 5 hosts, follow these steps:

  1. Copy and paste the ESXi Shell script commands into a new .sh file.
  2. Copy the .sh file to the ESXi 5 server.
  3. Access the ESXi Shell using SSH or the console.
  4. Navigate to the directory where you copied the script.
  5. Run the script using the following command: ./<filename>.sh. After script runs, the inventory.xml file is created in same directory.
  6. Do one of the following: 
  • Upload the generated inventory.xml file to the K1000 through the WSAPI. For more information, see theAdministrator Guide.
  • In the Administrator Interface, go to Inventory > Computers, add a new item, and import the inventory.xml file for the new item.
  • Inventory can also be created periodically on a cron schedule and uploaded to K1000 through the WSAPI

 

#!/bin/sh
#
# Copyright 2012 Dell Inc. All rights reserved.
#
# Create a basic minimum inventory.xml for ESXi 5
# and later which can be uploaded to KBOX
#Define the inventory file name
out_file="inventory.xml"
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" > $out_file
echo "<MachineStruct>" >> $out_file
echo "<NAME>"`hostname`"</NAME>" >> $out_file
echo "<CLIENT_VERSION>x.x.xxxx</CLIENT_VERSION>" >> $out_file
echo "<IP>"`esxcli network ip interface ipv4 get | grep vmk0 | awk '{print $2;}'`"</IP>" >> $out_file
echo "<MAC>xxxxxxxxxxxxxxxxxxxxxx</MAC>" >> $out_file
echo "<OS_NAME>"`uname -s` `uname -r`"</OS_NAME>" >> $out_file
echo "<OS_NUMBER>"`uname -r`"</OS_NUMBER>" >> $out_file
echo "<OS_MAJOR>"`uname -r | cut -d . -f 1`"</OS_MAJOR>" >> $out_file
echo "<OS_MINOR>"`uname -r | cut -d . -f 2`"</OS_MINOR>" >> $out_file
echo "<SERVICE_PACK></SERVICE_PACK>" >> $out_file
echo "<INSTALL_DATE></INSTALL_DATE>" >> $out_file
echo "<OS_ARCH>"`uname -m`"</OS_ARCH>" >> $out_file
echo "<OS_FAMILY>linux</OS_FAMILY>" >> $out_file
echo "<OS_VERSION>"`uname -r`"</OS_VERSION>" >> $out_file
echo "<OS_BUILD></OS_BUILD>" >> $out_file
echo "<DOMAIN>(none)</DOMAIN>" >> $out_file
echo "<CS_DOMAIN>(none)</CS_DOMAIN>" >> $out_file
printf "`date +%s` `uptime`" | awk '
{
currdate = $1;
if ($5 ~ /days/) {
uptime_day = $4*86400;
sub(/,/,"",$6);
split($6,a,":");
uptime_hms = (a[1]*60 + a[2] )*60 + a[3];
last_reboot = currdate - (uptime_day + uptime_hms);
} else {
sub(/,/,"",$4)
split($4,a,":");
uptime_hms = (a[1]*60 + a[2] )*60 + a[3];
last_reboot = currdate - uptime_hms;
}
print "<LAST_REBOOT>" strftime("%Y-%m-%d %H:%M:%S",last_reboot) "</LAST_REBOOT>";
}' >> $out_file
echo "<TZ_AGENT>GMT</TZ_AGENT>" >> $out_file
uptime | awk '
{
if ($4 ~ /days/) {
print ("<UPTIME>" $3 "," $5 "</UPTIME>");
} else {
print ("<UPTIME>" $3 "</UPTIME>");
}
}' >> $out_file
echo "<RAM_TOTAL>" `esxcli hardware memory get | grep "Physical Memory" | awk '{print ($3/(1024*1024)) "MB"}'` "</RAM_TOTAL>" >> $out_file
echo "<RAM_USED></RAM_USED>" >> $out_file
echo "<CS_MANUFACTURER>"`esxcli hardware platform get | grep Vendor | cut -d : -f 2`"</CS_MANUFACTURER>" >> $out_file
echo "<CS_MODEL>"`esxcli hardware platform get | grep Product | cut -d : -f 2`"</CS_MODEL>" >> $out_file
echo "<USER_LOGGED>root</USER_LOGGED>" >> $out_file
echo "<USER>root</USER>" >> $out_file
echo "<USER_NAME>root</USER_NAME>" >> $out_file
echo "<USER_FULLNAME></USER_FULLNAME>" >> $out_file
echo "<USER_DOMAIN>(none)</USER_DOMAIN>" >> $out_file
echo "<BIOS_NAME></BIOS_NAME>" >> $out_file
echo "<BIOS_VERSION>"`smbiosDump | grep -i -A 3 "BIOS Info" | grep Version | cut -d : -f 2 | sed s/\"//g`"</BIOS_VERSION>" >> $out_file
echo "<BIOS_MANUFACTURER>"`smbiosDump | grep -i -A 3 "BIOS Info" | grep Vendor | cut -d : -f 2 | sed s/\"//g`"</BIOS_MANUFACTURER>" >> $out_file
echo "<BIOS_DESCRIPTION></BIOS_DESCRIPTION>" >> $out_file
echo "<BIOS_SERIAL_NUMBER>"`smbiosDump | grep -i -A 5 "System Info" | grep Serial | cut -d : -f 2 | sed s/\"//g`"</BIOS_SERIAL_NUMBER>" >> $out_file
echo "<MOTHERBOARD_PRIMARY_BUS></MOTHERBOARD_PRIMARY_BUS>" >> $out_file
echo "<MOTHERBOARD_SECONDARY_BUS></MOTHERBOARD_SECONDARY_BUS>" >> $out_file
echo "<PROCESSORS>" >> $out_file
echo "CPU Core Count:" `esxcli hardware cpu global get | grep "CPU Packages" | awk '{print $3}'` >> $out_file
echo "CPU Chip Count:" `esxcli hardware cpu global get | grep "CPU Cores" | awk '{print $3}'` >> $out_file
echo "</PROCESSORS>" >> $out_file
echo "<SOUND_DEVICES>Unknown</SOUND_DEVICES>" >> $out_file
echo "<CDROM_DEVICES></CDROM_DEVICES>" >> $out_file
echo "<MONITOR></MONITOR>" >> $out_file
echo "<VIDEO_CONTROLLERS></VIDEO_CONTROLLERS>" >> $out_file
echo "<DISK_DRIVES>" >> $out_file
df -k / | awk '
{
if ($1 != "Filesystem") {
print ("<DiskDrive>");
print ("<NAME>Drive " $6 " Used: " $3/(1024*1024) " GB Total: " ($3+$4)/(1024*1024) " GB </NAME>");
print ("<DISK_SIZE>"($3+$4)/(1024*1024)"</DISK_SIZE>");
print ("<DISK_USED>"$3/(1024*1024)"</DISK_USED>");
print ("<DISK_FREE>"$4/(1024*1024)"</DISK_FREE>");
print ("<PERCENT_USED>"$5"</PERCENT_USED>");
print ("</DiskDrive>");
}
}' >> $out_file
echo "</DISK_DRIVES>" >> $out_file
echo "<NETWORK_INTERFACES>" >> $out_file
esxcli network nic list | awk '{
if ($1 !~ /Name/ && $1 !~ /---/) {
print ("<NetworkInterface>");
print ("<NIC>" $1 "</NIC>");
print ("<MAC>" $7 "</MAC>");
print ("<IP></IP>");
print ("<DHCP_ENABLED>Unknown</DHCP_ENABLED>");
print ("</NetworkInterface>");
}
}' >> $out_file
echo "</NETWORK_INTERFACES>" >> $out_file
echo "<PRINTERS></PRINTERS>" >> $out_file
echo "<STARTUP_PROGRAMS>" >> $out_file
for file in `ls /etc/init.d`; do
echo "<StartupProgram>" >> $out_file
echo "<NAME>"$file"</NAME>" >> $out_file
echo "</StartupProgram>" >> $out_file
done
echo "</STARTUP_PROGRAMS>" >> $out_file
echo "<PROCESSES>" >> $out_file
ps -C |awk '
{
if ($4 != "NAME") {
print ("<MachineProcess>");
print ("<NAME>" $4 "</NAME>");
print ("</MachineProcess>");
}
}' >> $out_file
echo "</PROCESSES>" >> $out_file
echo "<INSTALLED_SOFTWARE>" >> $out_file
esxcli software vib list | awk '
{
if ($1 !~ /Name/ && $1 !~ /---/) {
print ("<Software>");
print ("<DISPLAY_VERSION>" $2 "</DISPLAY_VERSION>");
print ("<HELP_LINK></HELP_LINK>");
print ("<README></README>");
print ("<INSTALL_DATE>" $5 "</INSTALL_DATE>");
print ("<PUBLISHER>" $3 "</PUBLISHER>");
print ("<UNINSTALL_STRING></UNINSTALL_STRING>");
print ("<URLINFO_ABOUT></URLINFO_ABOUT>");
print ("<DISPLAY_NAME>" $1 "</DISPLAY_NAME>");
print ("</Software>");
}
}' >> $out_file
echo "</INSTALLED_SOFTWARE>" >> $out_file
echo "</MachineStruct>" >> $out_file