Script / Template for windows services
-
I have been trying to make a way so that NETXMS will auto find all services (auto ect) and monitor them, the system supports this for disk space ect but can't seem to map this to services. any ideas or help?
ty
-
I use a script for instance discovery and a filter script to remove unwanted services.
Additional, custom attributes allow to include and exclude services per node.Please see the attached image for usage in the template DCI.
Kind regards,
ThomasScript windows_auto_services:
col_startup = 4; array a; table = AgentReadTable($node, "System.Services"); if (table == null) { println "ERROR: Cannot read table from agent"; return; } index = 0; for (i=0; i<table->rowCount; i++) { startup = table->get(i, col_startup); if (startup == "Auto") { a[index++] = table->get(i, 0); println table->get(i, 0); } } // trace(1, "discover_auto_services: return 0"); return a;Script filter_windows_services:
sub filter_windows_service(svc) { attr = GetCustomAttribute($node, "SERVICE_EXCLUDE"); if (attr != null && inList(attr, ",", svc)) { trace(1, $node->name . ": Service " . svc . " excluded by attribute SERVICE_EXCLUDE"); return false; } attr = GetCustomAttribute($node, "SERVICE_INCLUDE"); if (attr != null && inList(attr, ",", svc)) return true; return (svc != "TBS") && (svc != "KtmRm") && (svc != "iphlpsvc") && (svc != "sppsvc") && (svc != "ShellHWDetection") && (svc != "ccmsetup") && (svc != "SysmonLog") && (!(svc ~= "^clr_optimization_.*") ) && svc != "spupdsvc" && svc != "RDSessMgr" && svc != "DPS" && svc != "FontCache" && svc != "MSDTC" && svc != "WinRM" && svc != "gupdate" && svc != "wscsvc" && svc != "VSS" && svc != "wuauserv" && svc != "TrustedInstaller" && svc != "BackupExecAgentAccelerator" && svc != "CcmExec" ; }
-
HI twenrich,
Thank you!!!!
this is a great script, should be standard in the package!!!!The only thing I have noticed is that for some reason, when I add in extra services to 'ignore' it still shows them AdobeUpdateService and alike but am sure that is something I have done / not doing.
ty
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login