Forum Discussion

Idan's avatar
8 years ago

PropertySources - Windows Service / FTP Site

Hi,

I created two new PropertySources and you are welcome to use them or as an example:

This one will check if a FTP service was installed on Windows machine, and if yes, will create auto properties name FTPService

hostname=hostProps.get("system.hostname");
my_query="Select name FROM Win32_Service where Name ='ftpsvc'"
import com.santaba.agent.groovyapi.win32.WMI;
import com.santaba.agent.groovyapi.win32.WMISession;
def session = WMI.open(hostname);
def obj = session.queryFirst("CIMv2", my_query, 10);
if (obj.NAME == "ftpsvc") {
    println "FTPService=Yes"

return 0

This one will check if a FTP site was configured inside the IIS on Windows machine, if yes, will create auto properties name FTPSite


hostname=hostProps.get("system.hostname");
my_query="Select name FROM Site where Name like '%FTP%'"
import com.santaba.agent.groovyapi.win32.WMI;
import com.santaba.agent.groovyapi.win32.WMISession;
def session = WMI.open(hostname);
def obj = session.queryFirst("WebAdministration", my_query, 10);
if (obj.NAME =~ "FTP") {
    println "FTPSite=Yes"

return 0

Using the PropertySources, you can target data sources or you can filter a group of computers

Good luck

  • One small comment,

    The scripts and the names are case sensitive 

  • On 4/30/2017 at 11:14 PM, Idan said:

    Hi,

    I created two new PropertySources and you are welcome to use them or as an example:

    This one will check if a FTP service was installed on Windows machine, and if yes, will create auto properties name FTPService

    hostname=hostProps.get("system.hostname");
    my_query="Select name FROM Win32_Service where Name ='ftpsvc'"
    import com.santaba.agent.groovyapi.win32.WMI;
    import com.santaba.agent.groovyapi.win32.WMISession;
    def session = WMI.open(hostname);
    def obj = session.queryFirst("CIMv2", my_query, 10);
    if (obj.NAME == "ftpsvc") {
        println "FTPService=Yes"

    return 0

    This one will check if a FTP site was configured inside the IIS on Windows machine, if yes, will create auto properties name FTPSite


    hostname=hostProps.get("system.hostname");
    my_query="Select name FROM Site where Name like '%FTP%'"
    import com.santaba.agent.groovyapi.win32.WMI;
    import com.santaba.agent.groovyapi.win32.WMISession;
    def session = WMI.open(hostname);
    def obj = session.queryFirst("WebAdministration", my_query, 10);
    if (obj.NAME =~ "FTP") {
        println "FTPSite=Yes"

    return 0

    Using the PropertySources, you can target data sources or you can filter a group of computers

    Good luck

     

    Hey @Idan thanks for the sharing your propertySource.

    For easier sharing & importing of datasources, submit the datasource to the LogicMonitor Exchange and a locator ID will be generated. This way, there is no need to copy and paste.

    See https://www.logicmonitor.com/support/settings/logicmodules/lm-exchange/ for guidance.

    Thanks!

  • 15 hours ago, Idan said:

    Hi Andrey

    This is done now

     

    Awesome.

    Share that locator ID for others to try it out.