In Kaseya Network Monitor, we have multiple ways of monitoring VMware platforms. The most recent additions are the specific monitors "VMware performance monitor" and "CIM monitor". These monitors are great for monitoring the health state of various hardware instances on your VMware ESX/ESXi hosts.
Some counters are not available through these monitors though and that's when it could come in handy to be able to connect to your host using SSH2 instead. For example, monitoring the usage of datastores. This KB article will show you how to enable SSH for monitoring with Kaseya Network Monitor / Lua scripts.
Enabling the SSH server
To enable the SSH server on your host, click on the "Configuration" tab for the host and select "Security Profile".
Then select "Properties" for the Security Profile, select "SSH" and then "Option". Select that the server should start and stop with the host and then click "Start".
Also make sure there's an exception for SSH Server in your host's firewall service.
Modifying sshd_config
Now you need to modify the sshd_config file to make authentication work with KNM/Lua. Logon to your host using your preferred SSH2 client, for example putty. Enter the following command:
vi /etc/ssh/sshd_config
Press the letter "i" and search for a line where it says "PasswordAuthentication". Change the value from "no" to "yes" and then press the Esc key followed by ":wq" to save the file and exit the vi editor. For the changes to take effect, you need to restart your SSH server.
Testing
To test that authentication works, use Lua IDE and create a new Lua script. Put the following simple code in the script file (change the credentials):
ssh = TLuaSSH2Client()
iRet = ssh:Open(22, "root", "password")
if iRet == 0 then
print("Could not connect to host, check that the SSH2 port (22) is open on your VMware host")
else
if ssh:ExecuteCommand("df") == false then
print("Could not execute command. " .. ssh:GetErrorDescription())
else
print(ssh:GetStdOut())
end
end
Run this script against your host in Lua IDE, and the response should be with your datastore configuration.