![]() ![]() The typical method is WMI: $wmisvc_pid = (Get-WmiObject -Class Win32_Service -Filter "Name = 'splunk'").ProcessId That's somewhat more complex because the above class doesn't expose the PID for some stupid reason. If you want your script to be able to kill the process, you'll probably need to get the PID. You can take a look at $svc | Get-Member or $svc | Format-List to get more information about the object and what you can do with it. Or you can tell it to wait indefinitely: $svc = Get-Service splunk $svc.WaitForStatus('Stopped','00:00:05') Īnd then you can look at $svc.Status to see what it's doing. (not location-lookup-script-powered-by-maxmind in these slides) 42 43. It gives you real-time visibility and intelligence into what’s happening across your IT infrastructure whether it’s physical, virtual or in the cloud. You can also do this to wait, say, 5 seconds: $svc = Get-Service splunk Splunk is a data engine for your machine data. Note that net.exe and sc.exe are not native PowerShell commands or cmdlets. The PowerShell cmdlet Stop-Service will do the same thing, IIRC. It sends the stop command and immediately returns. What you can do instead is: sc.exe stop splunk My guess it that net.exe stop splunk is hitting whatever timeout that net.exe uses sometimes. Wait an amount of time (either 30s or 60s, IIRC) to see if the service has stopped.Stopping a service with net.exe actually does two things: splunk restart without problems.Īnyone know what's going on or have advice on next-steps for troubleshooting? I've also found if I interact with splunk directly through the executable file in C:\Program Files\SplunkUniversalForwarder\bin\splunk.exe that everything works fine. #Maxmind splunk windowsAt this point I have no idea what's going on because I'm not used to working on Windows (or with Splunk), and am not sure if the error from Chef and the net stop splunkforwarder errors are related. However, because we used a Splunk specific version of the DB, you still had to wait for a new version of Splunk to get a new copy of the DB. We did this by shipping a custom version of the MaxMind DB in the 6.0.x release. Somtimes stopping the service works, but rarely. When Splunk added the new version of the iplocation command in v6.0, it added the ability to add location info without the need for internet concenttivity. The service is not responding to the control function. I decided to try going through the restart (stop/start) process manually in Powershell, and now when I try to stop the service with net stop splunkfowarder I get an error: Once the Chef run fails, I'm able to start the service with net start splunkforwarder. Start or control request in a timely fashion. ControlService: The service did not respond to the The request did not respond to the start or control request in a I'm trying to manage Splunk with Chef and ran across a problem when using Chef to programmatically start/stop/restart the Splunkforwarder service: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |