PHP SNMP采集のWeblogic jdbcConnectionPoolRuntimeTable

<?PHPの
date_default_timezone_set( "アジア/上海");
(0)するerror_reporting。
    クラスWeblogicJDBCConnectionPools
    {
        パブリック関数の__construct($のhost_address、$ポート、$コミュニティ)
        {
            の$ this - > host_address = $ host_address。
            の$ this - >ポート= $ポート。
            の$ this - >コミュニティ= $コミュニティー;
            の$ this - > create_data_array();
        }
        プライベート関数create_data_array()
        {
            // ----------システムの説明ここから始まる
            場合(のsnmpwalk(の$ this - > host_addressを。 ':'。の$ this - >ポート、ます$ this->コミュニティ' 1.3.6.1.4.1.140.625.360.1.65' )!= FALSE)
            {
                の$ this - > data_fetched = 'YES';
                $データ=のsnmpwalk(。。の$ this - > host_address ':'の$ this - >ポート、ます$ this->コミュニティ、 '1.3.6.1.4.1.140.625.360.1.65');
                //ますprint_r($データ)。
                IF(STRLEN($データ[0])== 0)
                {
                    $データ[0] = '<スパンID = "no_data_received">データなし</スパン>を受信していません'。
                }
                他
                {
                    IF($データ[0] == 'STRING:')
                    {
                        $データ[0] = '<スパンID = "no_data_received">データなし</スパン>を受信していません'。



                        IF(substr_count($データ[0]、 'STRING: ')> 0)
                        {
                            $データ[0]のsubstr =($データ[0]、strlenを(' STRING:')、strlenを($データを[0])) ;
                        }
                        他
                        {
                            $データ[0] = $データ[0]。
                        }
                        $ data_lower = strtolower($データ[0])。
                        //ますprint_r($のdata_lower)。
                        (substr_count($のdata_lower、 'のWebLogic')> 0)であれば
                        {
                            の$ this - > OPERATING_SYSTEM = 'のWebLogic'。
                        }
                        IF(substr_count($ data_lower、 '8.1')> 0)
                        {
                            の$ this - >バージョン= '8.1'。
                        }
                        IF(substr_count($ data_lower、'10 .3.6.0 ')> 0)
                        {
                            の$ this - >バージョン= '10 .3.6.0'。
                        }
                    }
                }
            }

            // ----------システムの説明はここで終了
            
            $システム=配列();
         $結果=のsnmpwalk(の$ this - > host_address ':'。。の$ this - >ポート、ます$ this->コミュニティ、 '1.3.6.1.4.1.140.625.190.1'); 
        //プリントます$ this-> host_address。
        //プリントます$ this->コミュニティ。
        //ますprint_r($結果);
        IF(の$ this - >バージョン== '8.1')
        {
            $結果= array_chunk($結果、カウント($結果)/ 24)。
            $ NAME = $結果[3]。
            $ LeakedConnectionCount = $結果[20]。
            $ MAXCAPACITY = $結果[12]。
            $ CurrCapacity = $結果[16]。
            $ ConnectionDelayTime = $結果[14]。
            $ ActiveConnectionsCurrentCount = $結果[5]。
            $ WaitingForConnectionCurrentCount = $結果[6]。
            $ VersionJDBCDriver = $結果[7]。
            $ ActiveConnectionsHighCountと= $結果[8]。
            $ ConnectionsTotalCount = $結果[11]。
            
        }
        IF(の$ this - >バージョン== '10 .3.6.0' )
        {
            $結果= array_chunk($結果、($結果をカウント)/ 29)。
            $ NAME = $結果[3]。
            $ LeakedConnectionCount = $結果[20]。
            $ MAXCAPACITY = $結果[12]。
            $ CurrCapacity = $結果[16]。
            $ ConnectionDelayTime = $結果[14]。
            $ ActiveConnectionsCurrentCount = $結果[5]。
            $ WaitingForConnectionCurrentCount = $結果[6]。
            $ VersionJDBCDriver = $結果[7]。
            $ ActiveConnectionsHighCountと= $結果[8]。
            $ ConnectionsTotalCount = $結果[11]。
            
        }

            //ますprint_r($ resultOperStatus)。
            もし(
                $名!= FALSEと
                $ LeakedConnectionCount!= FALSEと
                $ MAXCAPACITY!= FALSEと
                $ CurrCapacity!= FALSEと
                $ ConnectionDelayTime!= FALSEと
                $ ActiveConnectionsCurrentCount!= FALSEと
                $ WaitingForConnectionCurrentCount!= FALSEと
                $ VersionJDBCDriver!= FALSEと
                !$ ActiveConnectionsHighCountと= FALSEと
                !$ ConnectionsTotalCount = FALSE
            )
            {
                
                $長=数($名)。
                $カウント=配列();
                $ [0] =カウント数($名)カウント。
                $ [1] =カウント($ LeakedConnectionCount)数えます。
                $ [2] =カウント($ MAXCAPACITY)数えます。
                $ [3] =カウント数($ CurrCapacity)カウント。
                $ [4] =カウント($ ConnectionDelayTime)数えます。
                $ [5] =カウント数($ ActiveConnectionsCurrentCount)カウント。
                $ [6] =カウント($ WaitingForConnectionCurrentCount)数えます。
                $ [7] =カウント($ VersionJDBCDriver)数えます。
                $ [8] =カウント数($ ActiveConnectionsHighCountと)数えます。
                $ [9] =カウント($ ConnectionsTotalCount)数えます。
                                                                
                               
                
                以下のために($ i = 0; $ iの数($カウント)<; $ iの++)
                {
                    もし($ [$ i]を== $長をカウント)
                    {
                        の$ this - > data_fetched = 'YES';
                    }
                    他
                    {
                        の$ this - > data_fetched = 'no'を。
                    }
                }
            }
            他
            {
                の$ this - > data_fetched = 'no'を。
            }
            //プリント(の$ this - > data_fetched);
            もし(の$ this - > data_fetched == 'はい')
            {
                //プリント( '移入の前に');
                の$ this - > populate_data_array($名、$ LeakedConnectionCount、$ MAXCAPACITY、$ CurrCapacity、$ ConnectionDelayTime、$ ActiveConnectionsCurrentCount、$ WaitingForConnectionCurrentCount、$ VersionJDBCDriver、$ ActiveConnectionsHighCountと、$ ConnectionsTotalCount)。
            }
        }
        プライベート関数populate_data_array($名、$ LeakedConnectionCount、$ MAXCAPACITY、$ CurrCapacity、$ ConnectionDelayTime、$ ActiveConnectionsCurrentCount、$ WaitingForConnectionCurrentCount、$ VersionJDBCDriver、$ ActiveConnectionsHighCountと、$ ConnectionsTotalCount)
        {
            $ parameter0 =配列();
            $パラメーター1 =配列();
            $パラメーター2 =配列();
            $パラメーター3 =配列();
            $パラメーター4 =配列();
            $ parameter5 =配列();
            $ parameter6 =配列();
            $ parameter7 =配列();
            $ parameter8 =配列();
            $ parameter9 =配列();

                                    
            // ------------------------------------------------ ---------------------------------------
            $ I = 0;
            foreachの($キー=> $値として$名)
            { 
                $データ= str_replace( 'STRING:'、 ''、$値)。
                $ parameter0 [$ I] = str_replace( " ''、 ''、$データ);
                //プリント($データ);
                $ i = $ I + 1;
            }
            $ NAME = NULL;
            // ------ -------------------------------------------------- -------------------------------
                        
            $ i = 0;
            foreachの($キー=> $値として$ LeakedConnectionCount)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $パラメーター1 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ LeakedConnectionCount = NULL;

 
                        // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ MAXCAPACITY)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $パラメーター2 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ MAXCAPACITY = NULL;
            // ------------------------------------------------ ---------------------------------------

            // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ CurrCapacity)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $パラメーター3 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ CurrCapacity = NULL;
            // ------------------------------------------------ ---------------------------------------


            // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ ConnectionDelayTime)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $パラメーター4 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ ConnectionDelayTime = NULL;
            // ------------------------------------------------ ---------------------------------------

            // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ ActiveConnectionsCurrentCount)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $ parameter5 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ ActiveConnectionsCurrentCount = NULL;
            // ------------------------------------------------ ---------------------------------------

            // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ WaitingForConnectionCurrentCount)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $ parameter6 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ WaitingForConnectionCurrentCount = NULL;
            // ------------------------------------------------ ---------------------------------------

            // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ VersionJDBCDriver)
            {
                $データ= str_replace( 'STRING:'、 ''、$値)。
                $ parameter7 [$ I] = str_replace( " ''、 ''、$データ);
                $ i = $ I + 1;
            }
            $ VersionJDBCDriver = NULL;
            // -------------- -------------------------------------------------- -----------------------

            // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ ActiveConnectionsHighCountと)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $ parameter8 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ ActiveConnectionsHighCountと= NULL;
            // ------------------------------------------------ ---------------------------------------

            // ------------------------------------------------ ---------------------------------------
                        
            $ I = 0;
            foreachの($キー=> $値として$ ConnectionsTotalCount)
            {
                $データ= str_replace( 'INTEGER:'、 ''、$値)。
                $ parameter9 [$ i]を= $データ。
                $ I = $ I + 1;
            }
            $ ConnectionsTotalCount = NULL;
            // ------------------------------------------------ ---------------------------------------

                        // ------------------------------------------------ ---------------------------------------
                        


                                    
            の$ this - > data_array [0] = $ parameter0。
            の$ this - > data_array [1] = $パラメーター1。
            の$ this - > data_array [2] = $パラメータ2。
            の$ this - > data_array [3] = $パラメーター3。
            の$ this - > data_array [4] = $パラメーター4。
            の$ this - > data_array [5] = $ parameter5。
            の$ this - > data_array [6] = $ parameter6。
            の$ this - > data_array [7] = $ parameter7。
            の$ this - > data_array [8] = $ parameter8。
            の$ this - > data_array [9] = $ parameter9。

                                            

                                                
        }
        パブリック関数get_data_array()
        {
            data_array>の$ this -を返します。
        }
        パブリック関数get_operating_system()
        {
            戻りの$ this - > OPERATING_SYSTEM。
        }
        パブリック関数GET_VERSION()
        {
            戻りの$ this - >バージョン。
        }        
        パブリック関数__destruct()
        {
            / *
             *ここでは必要ありませんコード
             * /
        }
        公共の$ data_fetched。
        民間の$ host_address。
        プライベート$ポート。
        プライベート$コミュニティー;
        民間の$ data_array =配列();
        民間の$ OPERATING_SYSTEM。
        プライベート$バージョン。
    }
?>

おすすめ

転載: blog.csdn.net/allway2/article/details/94393430