netcool 综合探测规则

netcool omnibus probe rules

netcool 综合规则的 6 美元的可能价值如下。 我想从 $6

中提取 InstanceName
Eg: SQLSERVER1
SQL2012TESTRTM
SQL2012TESTSTD1
SQL2014STD
MSSQLSERVER

以下是 6 美元的价值

6 = "Microsoft.SQLServer.DBEngine:TM-B33F-FAD4.cap.dev.net;SQLSERVER1:1"
6  = "Microsoft.SQLServer.2012.Agent:TM-B33F-FAD4.cap.dev.net;SQL2012TESTRTM;SQLAgent$SQL2012TESTRTM:1"
6 = "Microsoft.SQLServer.2012.Agent:TM-B33F-FAD4.cap.dev.net;SQL2012TESTRTM;SQLAgent$SQL2012TESTRTM:1"
6 = "Microsoft.SQLServer.2012.Agent:TM-B33F-FAD4.cap.dev.net;SQL2012TESTSTD1;SQLAgent$SQL2012TESTSTD1:1"
6 = "Microsoft.SQLServer.Database:TM-B33F-FAD4.cap.dev.net;SQL2012TESTSTD1;DB2:1"
6 = "Microsoft.SQLServer.2012.Agent:TM-B33F-FAD4.cap.dev.net;SQL2012TESTRTM;SQLAgent$SQL2012TESTRTM:1"
6 = "Microsoft.SQLServer.2014.Agent:TM-B33F-FAD4.cap.dev.net;SQL2014STD;SQLAgent$SQL2014STD:1"
6 = "Microsoft.SQLServer.Database:TM-B33F-FAD4.cap.dev.net;SQL2012TESTSTD1;DB2:1"
6 = "Microsoft.SQLServer.2014.DBEngine:TM-B33F-FAD4.cap.dev.net;SQL2014STD:1"
6 = "Microsoft.SQLServer.Database:TM-B33F-FAD4.cap.dev.net;SQL2012TESTSTD1;DB2:1"
6 = "Microsoft.SQLServer.2014.Agent:TM-B33F-FAD4.cap.dev.net;SQL2014STD;SQLAgent$SQL2014STD:1"
6 = "Microsoft.SQLServer.Database:TM-B33F-FAD4.cap.dev.net;SQL2012TURKSTD1;DB1:1"

6 = "Microsoft.SQLServer.2014.DBFile:CTNTV01;MSSQLSERVER;SPOT;1;35:1"

6 = "Microsoft.SQLServer.Library.EventLogCollectionTarget:TM-B33F-FAD4.cap.dev.net:1"

我试过下面的代码来提取,它适用于上面的大部分代码。

            @temp = extract(, ";([^\:]+)\:")
            if (regmatch(@temp, "[\;]"))
            {
                    @temp = extract(@temp, "([^\:]+)\;")
            }

但它不适用于

Microsoft.SQLServer.2014.DBFile:CTNTV01;MSSQLSERVER;SPOT;1;35:1

我认为 if 语句中的第二个摘录需要更正一些。 它一直提取到 MSSQLSERVER;SPOT;1,,但我只想要 MSSQLSERVER

能否请您帮忙更正一下。

试试下面的方法。

@temp = extract(, ";([^\:]+)\:")
        if (regmatch(@temp, "[\;]"))
        {
                @temp = extract(@temp, "([^\;]+)\;")
        }