MattHodge / Graphite-PowerShell-Functions

A group of PowerShell functions that allow you to send Windows Performance counters to a Graphite Server, all configurable from a simple XML file.
https://hodgkins.io/using-powershell-to-send-metrics-graphite
GNU General Public License v3.0
218 stars 71 forks source link

Unable to uninstall/delete #50

Closed dancb10 closed 9 years ago

dancb10 commented 9 years ago

Hello, I've been working with your script and indeed it's a really nice method of sending data to graphite. I've used previously perftab. Anyway, everything works good except that nssm cannot be removed without restarting the server It's used by the DHCP client and doesn't work if you restart the service, only if you stop it. If the DHCP service is stopped, it's then used by Windows Event viewer which in turn depends on multiple services. Bottom line, I couldn't implement in chef a method to remove the whole script/exe files. Considering the fact that I want to push it to a production environment, do you guys have an idea on how should i proceed? Thank you, Dan Popescu

Tadas commented 9 years ago

Hi,

How about using a scheduled task that runs at system start up?

dancb10 commented 9 years ago

It's not the fact that I don't know how to implement in chef, it's the fact that nssm.exe is used by services that cannot be stopped in a production environment so if we want to delete the whole graphite folder we have to restart the servers which is not a feasible method. I need somehow to be able to delete it without stopping any additional services. Aslo I don't know why would this executable still be using other resources if I uninstall the graphite service

kasperbrandenburg commented 9 years ago

I've removed the service multiple times without problems. You cant just stop service, and run sc.exe delete ? (CMD edition, not PS alias). Looking at my running services, i dont have any service depencies.

This sounds really weird to me.

dancb10 commented 9 years ago

Hey man, You don't understand by issue. I was also able to uninstall the service but I'm talking about the actual executable man. Please try the following: Run chef and let the script install everything and add the GraphitePowerShell service Stop the GraphitePowerShell service Use nssm or sc method, either way to delete the service Now try to DELETE the \GraphitePowershellFunctions\nssm\nssm-2.24\win64\nssm.exe file. Note that I'm using the 2.24 version so the simlync points to this version You will receive something like: http://i.imgur.com/12gRe2d.png

Please tell me if you receive similar things. Thank you

MattHodge commented 9 years ago

@dancb10, this issue is not related to this PowerShell module in any way.

If you use the method of installation documented in the readme.md, there will be no dependencies on DHCP or anything else from nssm:

5-30-2015 7-08-37 pm

If you installed the module using the cookbook here: https://github.com/tas50/chef-graphite_powershell_functions/, make an issue over there.

If you made a custom cookbook yourself, try and replicate the automated install instructions from the readme.md

peter-taran commented 6 years ago

Probably the cause of issue is that the nssm (a) write messages to Windows event log, (b) register themselves as a source of message strings for event log (see HKLM\System\CurrentControlSet\services\eventlog\Application\NSSM registry key). So every process, who reads event log implicitly loads nssm.exe into it's address space and prevent nssm.exe file from removing or writing over.