<?xml version="1.0" encoding="windows-1251"?>
<document type="SelFTrendxTest" version="0.0" xmlns:m="xTest">
    <xTest type="SNMP" alias="CiscoPIX_base" 
           TitleRus="Тест оценки 'здоровья' Cisco PIX Firewall" 
           TitleEng="Cisco PIX Firewall Health Check Test" 
           TitleRootRus="Тесты оценки «здоровья» оборудования, поддерживающего SNMP" 
           TitleRootEng="SNMP Devices Performance Tests" 
           TrafficLightsName="Cisco PIX Firewall Health Check Test"
           Version="1.1">
	<Files>
		<File type="conf" name="SNMP.CISCO-PIX_FIREWALL.xTest.xml"/>
		<File type="help" name="XT.SNMP.start.html"/>
		<File type="dll" name="x_snmp.dll"/>
	</Files>
  <Keywords>
    <Keyword>SNMP</Keyword>
    <Keyword>Cisco</Keyword>
    <Keyword>Firewall</Keyword>
    <Keyword>PIX</Keyword>
  </Keywords>

      <!--     $Id: SNMP.CISCO-PIX_FIREWALL.xTest.xml,v 1.1 2008/09/16 09:14:59 slw Exp $
    -->
	<xTestProps>
		<AverInervDuration>60</AverInervDuration>
		<pollinterval>25</pollinterval>
        <snmp_timeout_ms>10000</snmp_timeout_ms>
        <snmp_retry_count>5</snmp_retry_count>
        <log_level_def>1</log_level_def>
        <truncate_log>1</truncate_log>
	</xTestProps>

	<VarSet>
<!--
	Value attributes:
		usetype: "hidden" | "pure" | "discovery" | "calculated"
		proctype: "absolute" | "delta"


		OID: for scalar values ("1.3.6.1.2.1.1.1")
		ROOT_OID: for tables  ("1.3.6.1.2.1.2.2.1" - A list of interface entries.)
		COLNUM_OID:  for table values
		alias: short ascii name w/o white spaces

		discovery_func
		work_func
		tlights_func

-->
		<tlights_func>TLights_Proc</tlights_func>
		<discovery_func>OnDiscovery</discovery_func>
		<work_func>OnDataReceived</work_func>
        <common_attribs TitleRus="Список параметров (общие):" TitleEng="Parameters List (common):" SubTitleRus="Параметр" SubTitleEng="Parameter">
            <!--  Type: "String", "Bool", "Integer", "Double", "Enum"  --> 
            <Attrib Type="Integer" TitleRus="Пороговое значение числа соединений" TitleEng="Number of connections threshold" Alias="number_of_connections">
                "250"
            </Attrib>
           
            <Attrib Type="String" TitleRus="Число активных соединений" TitleEng="Number of connections (filtr)" Alias="filtr_of_connections">
                "number of connections currently in use"
            </Attrib>
                
        </common_attribs>
		<ScalarValues>
            <Value usetype="calculated" proctype="absolute" alias="data_availability">
				"Cisco PIX Data Availability (%)"
			</Value>
			<Value usetype="calculated" proctype="absolute" alias="Availability">
				"Cisco PIX SNMP Availability (%)"
			</Value>
        </ScalarValues>

		<TableValues>                                               
			<Table name="Cisco Memory Pool Objects table" ROOT_OID="1.3.6.1.4.1.9.9.48.1.1.1">

				<Value usetype="hidden" proctype="absolute" COLNUM_OID="5" alias="MemoryPoolUsed">
					"ciscoMemoryPoolUsed"
				</Value>
				
				<Value usetype="hidden" proctype="absolute" COLNUM_OID="6" alias="MemoryPoolFree">
					"ciscoMemoryPoolFree"
				</Value>

				<Value usetype="discovery" proctype="absolute" COLNUM_OID="2" alias="MemoryPoolName">
					"ciscoMemoryPoolName"
				</Value>
				
				<Value usetype="hidden" proctype="absolute" COLNUM_OID="4" alias="MemoryPoolValid">
					"MemoryPoolValid"
				</Value>
			</Table>
			
			<Table name="Table of firewall statistic instances" ROOT_OID="1.3.6.1.4.1.9.9.147.1.2.2.2.1">
				<Value usetype="discovery" proctype="absolute" COLNUM_OID="3" alias="cfwConnectionStatDescription">
					"cfwConnectionStatDescription"
				</Value>
				
				<Value usetype="hidden" proctype="absolute" COLNUM_OID="4" alias="cfwConnectionStatCount">
					"cfwConnectionStatCount"
				</Value>
				
				<Value usetype="hidden" proctype="absolute" COLNUM_OID="5" alias="cfwConnectionStatValue">
					"cfwConnectionStatValue"
				</Value>
			</Table>
			
			<Table name="A table of overall CPU statistics" ROOT_OID="1.3.6.1.4.1.9.9.109.1.1.1.1">
				<Value usetype="hidden" proctype="absolute" COLNUM_OID="4" alias="cpmCPUTotal1min">
					"cpmCPUTotal1min"
				</Value>
				<Value usetype="discovery" proctype="absolute" COLNUM_OID="2" alias="cpmCPUTotalPhysicalIndex">
					"cpmCPUTotalPhysicalIndex"
				</Value>
			</Table>
			
		</TableValues>
	</VarSet>


	<popupdisplay>
		<!-- Function: "EventCount", "Average", "Maximum", "Minimum" </PRE></SPAN><SPAN -->
		<description ru="Тест оценки 'здоровья' Cisco PIX Firewall" en="Cisco Secure PIX Firewall Теst"></description>
		<display_item ru="Cisco PIX Data Availability (%)" en="Cisco PIX Data Availability (%)" alias="data_availability" sign="&lt;"> 100 100 100 100 </display_item>
		<display_item ru="Cisco PIX SNMP Availability (%)" en="Cisco PIX SNMP Availability (%)" alias="Availability" sign="&lt;"> 90.0 94.0 96.0 99.0 </display_item>
	</popupdisplay>



<Script language="VBScript">
<!--
Dim g_dBadValue

g_dBadValue = 1.0e+308

'Connection name filter
g_strConnectionNameFilter = "number of connections currently in use"

Sub OnDiscovery(ByRef snmpDev)
    
    'stop
    
    Dim portTab, lportTab
    Dim sValue, TabSet, ScalarTab, sifType
    Dim TablesCount, pIndx, tIndx
    Dim logMessage

    'On Error Resume Next

    logMessage = "+=========================================================="
    snmpDev.LogMsg(logMessage)

    logMessage = "VBscrip discovery start, ip: " & snmpDev.IpAddress & " device: " & snmpDev.DeviceName
    snmpDev.LogMsg(logMessage)

    Set ScalarTab = snmpDev.ScalarTable
    Set TabSet = snmpDev.TablesSet
    Set portTab = TabSet.PPortsTableByName("Cisco Memory Pool Objects table")

    l_strConnNum = snmpDev.ResSet.CommonProp.Attrib("number_of_connections").Value
    ConnNum_green = CInt(l_strConnNum)
    If  ConnNum_green < 1 Then
        ConnNum_green = 1
    End If 
    
    l_bFilter = True
    g_strConnectionNameFilter = snmpDev.ResSet.CommonProp.Attrib("filtr_of_connections").Value
    g_strConnectionNameFilter = LCase(g_strConnectionNameFilter)
        
    If Len(g_strConnectionNameFilter) = 0 Then
        l_bFilter = False
    End If
    
    If InStr(snmpDev.DeviceName, "Cisco") > 0 Then
        
        
        TablesCount = portTab.Count

        If TablesCount > 0 Then
            snmpDev.Disable = False
            
            For tIndx = 0 To TablesCount - 1
                
                Set lportTab = portTab.Table(tIndx)
                Set sValue = lportTab.Value("MemoryPoolName")
                Set ciscoMemoryPoolFree = lportTab.Value("MemoryPoolFree")
                
                lportTab.PortDescription = sValue.SValue
                logMessage = "Port[" & tIndx+1 & "]: " & lportTab.PortDescription
                snmpDev.LogMsg(logMessage)
                
                l_strEventName = "Cisco PIX " & lportTab.PortDescription & " Free (%)" 
                l_strAlias = lportTab.PortDescription & "_free_memory_dev" 
                l_strTag = lportTab.PortDescription
                sValue.Tag = l_strTag
                ciscoMemoryPoolFree.Tag = l_strTag

                SLAError = snmpDev.ResSet.EventAddEx(l_strEventName, l_strAlias, "", l_strTag, -1)
                l_strTLName_ru = l_strEventName
                l_strTLName_en = l_strEventName
                
                TLError = snmpDev.ResSet.AddTrafficLight(l_strAlias, l_strTLName_ru, l_strTLName_en, "Maximum", "<", 5.0, 10.0, 20.0, 30.0)
                logMessage = "VB script: snmpDev.ResSets.AddTrafficLight return: " & TLError  & " ('" & snmpDev.ResSet.InternalErrorInfo & "')"
                snmpDev.LogMsg(logMessage)

                l_strEventName = "Cisco PIX " & lportTab.PortDescription & " Free (bytes)" 
                l_strAlias = lportTab.PortDescription & "_free_memory_bytes_dev" 
                l_strTag = lportTab.PortDescription
                SLAError = snmpDev.ResSet.EventAddEx(l_strEventName, l_strAlias, "", l_strTag, -1)
      
                l_strEventName = "Cisco PIX " & lportTab.PortDescription & " Total (bytes)" 
                l_strAlias = lportTab.PortDescription & "_totalmemory_dev" 
                l_strTag = lportTab.PortDescription
                SLAError = snmpDev.ResSet.EventAddEx(l_strEventName, l_strAlias, "", l_strTag, -1)
                
            Next
        Else
            snmpDev.Disable = True
        End If
        
        Set sValue = Nothing
        Set portTab = Nothing
        
        '// Connections table process =========================================
        Set portTab = TabSet.PPortsTableByName("Table of firewall statistic instances")
        TablesCount = portTab.Count
        
        'stop
        If TablesCount > 0 Then
            snmpDev.Disable = False
            
            For tIndx = 0 To TablesCount - 1
                
                Set lportTab = portTab.Table(tIndx)
                Set sValue = lportTab.Value("cfwConnectionStatDescription")
                Set ConnectionStatCount = lportTab.Value("cfwConnectionStatCount")
                Set ConnectionStatValue = lportTab.Value("cfwConnectionStatValue")
                
                lportTab.PortDescription = sValue.SValue
                logMessage = "Port[" & tIndx+1 & "]: " & lportTab.PortDescription
                snmpDev.LogMsg(logMessage)
                
                l_strDescr = Trim(lportTab.PortDescription)
                l_strEventName = LCase(lportTab.PortDescription)    
                
                If InStr(1, l_strEventName, "number of connections currently in use by the entire firewall", 1) >= 1 Then
                    l_strEventName = "Cisco PIX number of connections in use"
                ElseIf InStr(1, l_strEventName, "highest number of connections in use at any one time since system startup", 1) >= 1 Then   
                    l_strEventName = "Cisco PIX highest number of connections in use"
                Else
                    l_strEventName = "Cisco PIX " & l_strEventName
                End If
                
                l_strAlias = lportTab.PortDescription & "_cfwConnectionStatValue" 
                l_strTag = lportTab.PortDescription
                sValue.Tag = l_strTag
                ConnectionStatCount.Tag = l_strTag

                SLAError = snmpDev.ResSet.EventAddEx(l_strEventName, l_strAlias, "", l_strTag, -1)
                
                l_strTLName_ru = l_strEventName
                l_strTLName_en = l_strEventName
                
                l_bTLAdd = False
                
                If l_bFilter = False Then
                    l_bTLAdd = True
                Else
                    l_strDescr = LCase(lportTab.PortDescription)    
                    If InStr(1, l_strDescr, g_strConnectionNameFilter, 1) >= 1 Then
                        l_bTLAdd = True
                    End If
                End If    
                
                If l_bTLAdd = True Then
                    TLError = snmpDev.ResSet.AddTrafficLight(l_strAlias, l_strTLName_ru, l_strTLName_en, "Average", ">", 1.4*ConnNum_green, 1.3*ConnNum_green, 1.2*ConnNum_green, 1.1*ConnNum_green)
                    logMessage = "VB script: snmpDev.ResSets.AddTrafficLight return: " & TLError  & " ('" & snmpDev.ResSet.InternalErrorInfo & "')"
                    snmpDev.LogMsg(logMessage)
                End If
            Next
        Else
            snmpDev.Disable = True
        End If
        
        Set sValue = Nothing
        Set portTab = Nothing
        
        Set portTab = TabSet.PPortsTableByName("A table of overall CPU statistics")
        TablesCount = portTab.Count
        
        If TablesCount > 0 Then
            snmpDev.Disable = False
            
            For tIndx = 0 To TablesCount - 1
                
                Set lportTab = portTab.Table(tIndx)
                Set sValue = lportTab.Value("cpmCPUTotalPhysicalIndex")
                Set CPUTotal1min = lportTab.Value("cpmCPUTotal1min")
                
                lportTab.PortDescription = "Processor(" & CInt(sValue.NumericValue) & ")"
                logMessage = "Port[" & tIndx+1 & "]: " & lportTab.PortDescription
                snmpDev.LogMsg(logMessage)
                
                l_strEventName = "Cisco PIX CPU" 
                If TablesCount > 1 Then
                    l_strEventName = l_strEventName & "(" & CInt(sValue.NumericValue) & ")"
                End If
                
                l_strEventName = l_strEventName & " busy (%)"
                l_strAlias = lportTab.PortDescription & "_cpmCPUTotal1min" 
                l_strTag = lportTab.PortDescription
                sValue.Tag = l_strTag
                CPUTotal1min.Tag = l_strTag

                SLAError = snmpDev.ResSet.EventAddEx(l_strEventName, l_strAlias, "", l_strTag, -1)
                
                l_strTLName_ru = l_strEventName
                l_strTLName_en = l_strEventName                                                                    
                
                TLError = snmpDev.ResSet.AddTrafficLight(l_strAlias, l_strTLName_ru, l_strTLName_en, "Maximum", ">", 70, 50, 40, 25)
                logMessage = "VB script: snmpDev.ResSets.AddTrafficLight return: " & TLError  & " ('" & snmpDev.ResSet.InternalErrorInfo & "')"
                snmpDev.LogMsg(logMessage)
            Next
        Else
            snmpDev.Disable = True
        End If
        
        
        
        
    Else
        snmpDev.Disable = True
    End If

'    logMessage = "VBscrip dump Device Data:"
'    snmpDev.LogMsg(logMessage)


    snmpDev.Dump()

    logMessage = "+=========================================================="
    snmpDev.LogMsg(logMessage)

    logMessage = "VBscrip discovery end, ip: " & snmpDev.IpAddress & " device: " & snmpDev.DeviceName
    snmpDev.LogMsg(logMessage)

End Sub


Sub OnDataReceived(ByRef snmpDev)
    
    'stop
    
    logMessage = "+=========================================================="
    snmpDev.LogMsg(logMessage)

    logMessage = "VBscrip OnDataReceived start, ip: " & snmpDev.IpAddress & " device: " & snmpDev.DeviceName
    snmpDev.LogMsg(logMessage)

    Set ScalarTab = snmpDev.ScalarTable
    Set TabSet = snmpDev.TablesSet
    Set portTab = TabSet.PPortsTableByName("Cisco Memory Pool Objects table")
    TablesCount = portTab.Count

    '// Set bad Value to all calculated Events
    ResetCalculatedEvenst(ScalarTab)


    MemoryPoll snmpDev
    PIX_Connections snmpDev
    CPU_Calc snmpDev

    logMessage = "+=========================================================="
    snmpDev.LogMsg(logMessage)

    logMessage = "VBscrip OnDataReceived end, ip: " & snmpDev.IpAddress & " device: " & snmpDev.DeviceName
    snmpDev.LogMsg(logMessage)

End Sub

Sub MemoryPoll(ByRef snmpDev)

    Set ScalarTab = snmpDev.ScalarTable
    Set TabSet = snmpDev.TablesSet
    Set portTab = TabSet.PPortsTableByName("Cisco Memory Pool Objects table")
    TablesCount = portTab.Count

    For tIndx = 0 To TablesCount - 1
        Set lportTab = portTab.Table(tIndx)
        Set ciscoMemoryPoolUsed = lportTab.Value("MemoryPoolUsed")
        Set ciscoMemoryPoolFree = lportTab.Value("MemoryPoolFree")
        Set ciscoMemoryPoolValid = lportTab.Value("MemoryPoolValid")
        Set DataAvailVal = ScalarTab.Value("data_availability") 
        
        if  ciscoMemoryPoolUsed.NumericValue = g_dBadValue Or ciscoMemoryPoolFree.NumericValue = g_dBadValue Or ciscoMemoryPoolValid.NumericValue = g_dBadValue Then
            Exit Sub
        End If

        if ciscoMemoryPoolValid.NumericValue = 1 Then
            l_strAlias =  ciscoMemoryPoolFree.Tag & "_free_memory_bytes_dev" 
            Set CalcVal = ScalarTab.Value(l_strAlias)
            CalcVal.NumericValue = ciscoMemoryPoolFree.NumericValue
            
            l_strAlias =  ciscoMemoryPoolFree.Tag & "_totalmemory_dev" 
            Set CalcVal = ScalarTab.Value(l_strAlias)
            CalcVal.NumericValue = ciscoMemoryPoolUsed.NumericValue + ciscoMemoryPoolFree.NumericValue

            l_iFreePC = (ciscoMemoryPoolFree.NumericValue/CalcVal.NumericValue) * 100.0
            l_strAlias =  ciscoMemoryPoolFree.Tag & "_free_memory_dev" 
            Set CalcVal = ScalarTab.Value(l_strAlias)
            CalcVal.NumericValue = l_iFreePC
        
            DataAvailVal.NumericValue = 100.0
        Else
            DataAvailVal.NumericValue = 0
        End If
    Next


End Sub


Sub PIX_Connections(ByRef snmpDev)

    Set ScalarTab = snmpDev.ScalarTable
    Set TabSet = snmpDev.TablesSet
    Set portTab = TabSet.PPortsTableByName("Table of firewall statistic instances")
    TablesCount = portTab.Count

    For tIndx = 0 To TablesCount - 1
        Set lportTab = portTab.Table(tIndx)
        Set ConnectionStatCount = lportTab.Value("cfwConnectionStatCount")
        Set ConnectionStatValue = lportTab.Value("cfwConnectionStatValue")

        if ConnectionStatCount.NumericValue = g_dBadValue Or ConnectionStatValue.NumericValue = g_dBadValue Then
        	Exit Sub
        End If

        l_strAlias =  ConnectionStatCount.Tag & "_cfwConnectionStatValue" 
        Set CalcVal = ScalarTab.Value(l_strAlias)
        
        If ConnectionStatCount.NumericValue > ConnectionStatValue.NumericValue Then
            l_Val = ConnectionStatCount.NumericValue
        Else
            l_Val = ConnectionStatValue.NumericValue
        End If    
        
        CalcVal.NumericValue = l_Val
    Next
End Sub

Sub CPU_Calc(ByRef snmpDev)

    Set ScalarTab = snmpDev.ScalarTable
    Set TabSet = snmpDev.TablesSet
    Set portTab = TabSet.PPortsTableByName("A table of overall CPU statistics")
    TablesCount = portTab.Count

    For tIndx = 0 To TablesCount - 1
        Set lportTab = portTab.Table(tIndx)
        Set CPUTotal1min = lportTab.Value("cpmCPUTotal1min")

        if  CPUTotal1min.NumericValue = g_dBadValue Then
            Exit Sub
        End If

        l_strAlias =  CPUTotal1min.Tag & "_cpmCPUTotal1min" 
        Set CalcVal = ScalarTab.Value(l_strAlias)

        CalcVal.NumericValue = CPUTotal1min.NumericValue
    Next
End Sub




Sub ResetCalculatedEvenst(ByRef ScalarTab)

    l_iValCount =  ScalarTab.Count

    For l_iIndx = 0 To l_iValCount - 1
        Set SValue = ScalarTab.ValueByIndx(l_iIndx)
        SValue.NumericValue = g_dBadValue
    Next
End Sub




-->
</Script>


     </xTest>
</document>
