久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      深度剖析Zabbix Web scenarios數(shù)據(jù)表結構

      深度剖析Zabbix Web scenarios數(shù)據(jù)表結構

      前言

      因開發(fā)需求,需要解析Zabbix web監(jiān)控數(shù)據(jù)表結構;因為網(wǎng)上關于Zabbix數(shù)據(jù)表結構解析的比較少,所以心血來潮寫了一篇作為記錄。

      突破口

      對Zabbix數(shù)據(jù)庫表結構做解析的時候,我有個習慣,直接針對某個itemid懟。

      這次當然不例外,隨便找了個Zabbix web itemid。

      直接查數(shù)據(jù)庫里有哪些表

      show tables like "%http%";

      +—————————+

      | Tables_in_zabbix (%http%) |

      +—————————+

      | httpstep |

      | httpstep_field |

      | httpstepitem |

      | httptest |

      | httptest_field |

      | httptestitem |

      +—————————+

      用屁股猜已經(jīng)猜出大概存儲的是什么內容:

      httpstep 存儲的為場景信息 httpstepitem 存儲的為場景ID httptest 存儲的為步驟信息 httptestitem 存儲的為步驟ID

      剖析

      以itemid為突破口

      獲取到這個場景的itemID

      查詢這個item所在的testID與testitemID

      select * from httptestitem where itemid="56263" ;

      +—————-+————+——–+——+

      | httptestitemid | httptestid | itemid | type |

      +—————-+————+——–+——+

      | 1194 | 398 | 56263 | 4 |

      +—————-+————+——–+——+

      根據(jù)這個itemid我們找到他對應的場景id。

      獲取這個場景的幾個監(jiān)控item值

      Last error message of scenario Download speed for scenario Failed step of scenario

      select * from httptestitem where httptestid="398";

      +—————-+————+——–+——+

      | httptestitemid | httptestid | itemid | type |

      +—————-+————+——–+——+

      | 1192 | 398 | 56261 | 2 |

      | 1193 | 398 | 56262 | 3 |

      | 1194 | 398 | 56263 | 4 |

      +—————-+————+——–+——+

      解析一波,具體自己參照Latest data

      #############

      # 各Type剖析

      #

      # type類型為2代表【Download speed for scenario】

      # 場景總下載速度,歷史數(shù)據(jù)存儲在history表.

      #

      # type類型為3代表【Failed step of scenario】

      # 場景返回狀態(tài)碼, 0表示場景正常, 每個步驟異常為1.歷史數(shù)據(jù)存儲在history_uint表.

      #

      # type類型為4代表【Last error message of scenario】

      # 上一次場景返回錯誤信息,歷史數(shù)據(jù)存儲在history_str表.

      #

      #############

      接下來根據(jù)場景ID找出步驟

      查詢http場景下的步驟

      Download speed for step Response time for step Response code for step

      select * from httpstepitem where httpstepid="398";

      +—————-+————+——–+——+

      | httpstepitemid | httpstepid | itemid | type |

      +—————-+————+——–+——+

      | 1192 | 398 | 56180 | 2 |

      | 1193 | 398 | 56181 | 1 |

      | 1194 | 398 | 56182 | 0 |

      +—————-+————+——–+——+

      解析一波,具體自己參照Latest data

      #############

      # 各Type剖析

      #

      # type類型為2代表【Download speed for step】

      # 步驟的下載速度,歷史數(shù)據(jù)存儲在history表.

      #

      # type類型為1代表【Response time for step】

      # 步驟返回時間,歷史數(shù)據(jù)存儲在history表.

      #

      # type類型為0代表【Response code for step】

      # 步驟的返回狀態(tài)碼, 其中0為無法連接,無狀態(tài)碼.歷史數(shù)據(jù)存儲在history_uint表.

      #

      #############

      接下來剖析詳細場景與步驟

      根據(jù)ID查詢場景信息

      自行對應ZabbixWEB界面

      select * from httptest where httptestid="398" G;

      *************************** 1. row ***************************

      httptestid: 398

      name: 業(yè)務接口A

      applicationid: 800

      nextcheck: 1542984224

      delay: 1m

      status: 0

      agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36

      authentication: 0

      http_user:

      http_password:

      hostid: 10084

      templateid: 397

      http_proxy:

      retries: 1

      ssl_cert_file:

      ssl_key_file:

      ssl_key_password:

      verify_peer: 0

      verify_host: 0

      順便簡單介紹下場景下的字段表,也就是一些自定宏

      select * from httptest_field limit 1;

      +——————+————+——+———-+——————-+

      | httptest_fieldid | httptestid | type | name | value |

      +——————+————+——+———-+——————-+

      | 1 | 535 | 1 | {IP} | 10.1.1.1 |

      +——————+————+——+———-+——————-+

      # type為1表示 Variables.

      # type為0表示 Headers.

      接下來查看場景里面的步驟 自行參照Steps頁面

      查詢指定ID的步驟

      select * from httpstep where httptestid="398"G;

      *************************** 1. row ***************************

      httpstepid: 412

      httptestid: 398

      name: 業(yè)務接口A

      no: 1

      url: https://baidu.com

      timeout: 15s

      posts:

      required:

      status_codes:

      follow_redirects: 0

      retrieve_mode: 0

      post_type: 0

      # no代表場景的步驟

      # required表示步驟正常返回字符串,填寫內容為正則表達式.

      步驟也有map字段表

      select * from httpstep_field limit 1;

      +——————+————+——+———-+———————+

      | httpstep_fieldid | httpstepid | type | name | value |

      +——————+————+——+———-+———————+

      | 1 | 129 | 1 | {rentid} | regex:([0-9]{4,10}) |

      +——————+————+——+———-+———————+

      # type為0表示 Headers.

      # type為1表示 Variables.

      # type為2表示 Post fields.

      后記

      文章一些數(shù)據(jù)表字段不明白都可以參照ZabbixWEB配置頁面。

      另外建議大家Zabbix二次開發(fā)的時候可以懟庫就懟庫,遇到邏輯復雜沒有把握才使用API。

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號