Win32-UninterruptiblePowerSupply - WMI Perl sample
The foundations for Manageability in Windows 2019/2016/2012/2008 and Windows 10/7/XP are Windows Management Instrumentation (WMI; formerly WBEM) and WMI extensions for Windows Driver Model (WDM).
ActiveXperts Network Monitor provides the ability to build monitor check routines based on WMI. ActiveXperts has collected more than a hundred WMI samples. You can use these samples as a base for new check routines you can write yourself.
On this site, you can find many WMI samples.
The Win32_UninterruptiblePowerSupply WMI class can be used in ActiveXperts Network Monitor to monitor your servers.
Win32-UninterruptiblePowerSupply
Description
The Win32_UninterruptiblePowerSupply WMI class represents the capabilities and management capacity of an uninterruptible power supply (UPS). The properties of the UPS device indicate when incoming power is trimmed or boosted, and the aggregated information of the batteries, generators, and so on, that comprise the device. These individual components (for example, multiple batteries) can also be independently modeled and associated with the UPS.
Example(s)
use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my @computers = ("DELL17"); foreach my $computer (@computers) { print "\n"; print "==========================================\n"; print "Computer: $computer\n"; print "==========================================\n"; my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_UninterruptiblePowerSupply", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print "ActiveInputVoltage: $objItem->{ActiveInputVoltage}\n"; print "Availability: $objItem->{Availability}\n"; print "BatteryInstalled: $objItem->{BatteryInstalled}\n"; print "CanTurnOffRemotely: $objItem->{CanTurnOffRemotely}\n"; print "Caption: $objItem->{Caption}\n"; print "CommandFile: $objItem->{CommandFile}\n"; print "ConfigManagerErrorCode: $objItem->{ConfigManagerErrorCode}\n"; print "ConfigManagerUserConfig: $objItem->{ConfigManagerUserConfig}\n"; print "CreationClassName: $objItem->{CreationClassName}\n"; print "Description: $objItem->{Description}\n"; print "DeviceID: $objItem->{DeviceID}\n"; print "ErrorCleared: $objItem->{ErrorCleared}\n"; print "ErrorDescription: $objItem->{ErrorDescription}\n"; print "EstimatedChargeRemaining: $objItem->{EstimatedChargeRemaining}\n"; print "EstimatedRunTime: $objItem->{EstimatedRunTime}\n"; print "FirstMessageDelay: $objItem->{FirstMessageDelay}\n"; print "InstallDate: $objItem->{InstallDate}\n"; print "IsSwitchingSupply: $objItem->{IsSwitchingSupply}\n"; print "LastErrorCode: $objItem->{LastErrorCode}\n"; print "LowBatterySignal: $objItem->{LowBatterySignal}\n"; print "MessageInterval: $objItem->{MessageInterval}\n"; print "Name: $objItem->{Name}\n"; print "PNPDeviceID: $objItem->{PNPDeviceID}\n"; print "PowerFailSignal: $objItem->{PowerFailSignal}\n"; print "PowerManagementCapabilities: " . join(",", (in $objItem->{PowerManagementCapabilities})) . "\n"; print "PowerManagementSupported: $objItem->{PowerManagementSupported}\n"; print "Range1InputFrequencyHigh: $objItem->{Range1InputFrequencyHigh}\n"; print "Range1InputFrequencyLow: $objItem->{Range1InputFrequencyLow}\n"; print "Range1InputVoltageHigh: $objItem->{Range1InputVoltageHigh}\n"; print "Range1InputVoltageLow: $objItem->{Range1InputVoltageLow}\n"; print "Range2InputFrequencyHigh: $objItem->{Range2InputFrequencyHigh}\n"; print "Range2InputFrequencyLow: $objItem->{Range2InputFrequencyLow}\n"; print "Range2InputVoltageHigh: $objItem->{Range2InputVoltageHigh}\n"; print "Range2InputVoltageLow: $objItem->{Range2InputVoltageLow}\n"; print "RemainingCapacityStatus: $objItem->{RemainingCapacityStatus}\n"; print "Status: $objItem->{Status}\n"; print "StatusInfo: $objItem->{StatusInfo}\n"; print "SystemCreationClassName: $objItem->{SystemCreationClassName}\n"; print "SystemName: $objItem->{SystemName}\n"; print "TimeOnBackup: $objItem->{TimeOnBackup}\n"; print "TotalOutputPower: $objItem->{TotalOutputPower}\n"; print "TypeOfRangeSwitching: $objItem->{TypeOfRangeSwitching}\n"; print "UPSPort: $objItem->{UPSPort}\n"; print "\n"; } }sub WMIDateStringToDate(strDate) { return "blah"; }