VMware Cloud Community
dcbundy
Contributor
Contributor

Alarm for HOST Uptime > X days?

Hello -


We've recently come to the realization that as hosts have been online for a certain amount of time, in our case about 100days or more, that they are more and more likely to lose connection for a short period of time with the vCenter server.      After rebooting the host, everything is fine... no dropped connections with vCenter.    FWIW - we're ESX4.1 update 1, and vCenter Server version 4.1. build 258902. 

What i'm trying to do that I've not been able to up to now is setup an alarm in vCenter that will alert once a host reaches say, 100 days of uptime. 

Is that possible?   I don't believe it is, but would like some confirmation.     If it is, I'm completely overlooking something.

Thanks,

Chrys Bundy

National Geographic

Reply
0 Kudos
2 Replies
EdWilts
Expert
Expert

I haven't checked for an alarm but vcheck has a canned report for hosts with a high uptime suggesting that it may be time to patch.  I'd say start with the vcheck code if you know any Powershell and modify from there to email you daily.

.../Ed (VCP4, VCP5)
Reply
0 Kudos
chriswahl
Virtuoso
Virtuoso

This PowerCLI code will work in a pinch. Modify $vcenter to your vCenter server name and $days to the age you wish to warn on.

$vcenter = "vcenter5"
$days = 100

$date = (Get-Date).AddDays(-1 * $days)
Connect-VIServer $vcenter
Foreach ($vmhost in (Get-VMHost))
    {
    $uptime = (Get-Date) - ($vmhost.ExtensionData.Runtime.BootTime)
    Write-Host "$vmhost.name - Uptime is $([Math]::Truncate($uptime.TotalDays)) days"
    If ($vmhost.ExtensionData.Runtime.BootTime -le $date) {Write-Host "Warning! $($vmhost.name) has been up for longer than $days days!"}
    }
VCDX #104 (DCV, NV) ஃ WahlNetwork.com ஃ @ChrisWahl ஃ Author, Networking for VMware Administrators
Reply
0 Kudos