7 years ago
LM "Actions"
I would love to see LM implement a new feature for taking a built-in, self prescribed, action on an alert. To minimize any exposure that LM might have in an action gone awry, the actions taken cou...
This would be an INCREDIBLY USEFUL feature in my environment right now. Mike's script looks great, but I can't seem to make it work. I downloaded it, installed it, and added the monitored service, but it only ever shows a "4" and I get the errors below. I thought it might be a permissions error or something so I jumped onto the collector using the same credentials and ran the commands in Powershell. This worked fine. Any ideas what might be wrong here?
Get-Service : Cannot find any service with service name 'hidserv'.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:8 char:20
+ ... e_status = (Get-Service -Name $service -ComputerName $hostname).Statu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (hidserv:String) [Get-Service],
ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.
Commands.GetServiceCommand
get-service : Cannot find any service with service name 'hidserv'.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:11 char:6
+ if ((get-service -name $service -ComputerName $hostname).Status -eq " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (hidserv:String) [Get-Service],
ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.
Commands.GetServiceCommand
Get-Service : Cannot find any service with service name 'hidserv'.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:15 char:32
+ ... ervice -InputObject $(Get-Service -Computer $hostname -Name $service)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (hidserv:String) [Get-Service],
ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.
Commands.GetServiceCommand
Start-Service : Cannot validate argument on parameter 'InputObject'. The
argument is null or empty. Provide an argument that is not null or empty, and
then try the command again.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:15 char:30
+ ... ervice -InputObject $(Get-Service -Computer $hostname -Name $service)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Start-Service], ParameterBindi
ngValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
Shell.Commands.StartServiceCommand
get-service : Cannot find any service with service name 'hidserv'.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:21 char:8
+ if ((get-service -name $service -ComputerName $hostname).Status -e ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (hidserv:String) [Get-Service],
ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.
Commands.GetServiceCommand
Get-Service : Cannot find any service with service name 'hidserv'.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:25 char:38
+ ... ervice -InputObject $(Get-Service -Computer $hostname -Name $service)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (hidserv:String) [Get-Service],
ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.
Commands.GetServiceCommand
Start-Service : Cannot validate argument on parameter 'InputObject'. The
argument is null or empty. Provide an argument that is not null or empty, and
then try the command again.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:25 char:36
+ ... ervice -InputObject $(Get-Service -Computer $hostname -Name $service)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Start-Service], ParameterBindi
ngValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
Shell.Commands.StartServiceCommand
get-service : Cannot find any service with service name 'hidserv'.
At C:\Program Files (x86)\LogicMonitor\Agent\tmp\scr1001001-Service_restart-Ser
vice_restart-Human_Interface_Device_Service.ps1:31 char:14
+ ... if ((get-service -name $service -ComputerName $hostname).Statu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (hidserv:String) [Get-Service],
ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.
Commands.GetServiceCommand