I checked hash %status, one of its key is 'CurrentState', so I am trying to do this
Win32::Service::GetStatus($hostname, $servicename, \%status);
print MYFILE " ServiceStatus: ", $hostname, $servicename, $status{Curr
+entState}, "\n";
, it is not working.
I also tried to use this to map the number I defined for each status, it is still not working.
if ($status{CurrentState} eq 4 )
{print MYFILE " ServiceStatus: ", $hostname, " ", $servicename,
+ " ", "is running\n";}
else {print MYFILE " ServiceStatus: ", $hostname, " ", $service
+name, " ", "is not running\n";}
4 is map to 'Started'
I have service is Started, but all my statements 'is not running'.