站長資訊網
        最全最豐富的資訊網站

        深度剖析Zabbix Web scenarios數據表結構

        深度剖析Zabbix Web scenarios數據表結構

        前言

        因開發需求,需要解析Zabbix web監控數據表結構;因為網上關于Zabbix數據表結構解析的比較少,所以心血來潮寫了一篇作為記錄。

        突破口

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

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

        直接查數據庫里有哪些表

        show tables like "%http%";

        +—————————+

        | Tables_in_zabbix (%http%) |

        +—————————+

        | httpstep |

        | httpstep_field |

        | httpstepitem |

        | httptest |

        | httptest_field |

        | httptestitem |

        +—————————+

        用屁股猜已經猜出大概存儲的是什么內容:

        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 |

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

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

        獲取這個場景的幾個監控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】

        # 場景總下載速度,歷史數據存儲在history表.

        #

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

        # 場景返回狀態碼, 0表示場景正常, 每個步驟異常為1.歷史數據存儲在history_uint表.

        #

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

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

        #

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

        接下來根據場景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】

        # 步驟的下載速度,歷史數據存儲在history表.

        #

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

        # 步驟返回時間,歷史數據存儲在history表.

        #

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

        # 步驟的返回狀態碼, 其中0為無法連接,無狀態碼.歷史數據存儲在history_uint表.

        #

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

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

        根據ID查詢場景信息

        自行對應ZabbixWEB界面

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

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

        httptestid: 398

        name: 業務接口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: 業務接口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.

        后記

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

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

        贊(0)
        分享到: 更多 (0)
        網站地圖   滬ICP備18035694號-2    滬公網安備31011702889846號
        主站蜘蛛池模板: 亚洲AV永久无码精品网站在线观看| japanese乱人伦精品| 在线涩涩免费观看国产精品| 精品国产免费一区二区三区香蕉| 中国精品18videosex性中国| 国产精品自在线拍国产手机版| 国产精品视频一区二区三区无码| 久久久久国产精品三级网| 精品亚洲永久免费精品| 免费精品国产自产拍在线观看| 久久精品中文字幕久久| 久久精品国产亚洲AV无码娇色| 亚洲韩精品欧美一区二区三区| 国产精品网址在线观看你懂的| 久久国产精品99精品国产987| 精品日韩亚洲AV无码一区二区三区| 日韩福利视频精品专区| 精品99又大又爽又硬少妇毛片| 老司机99精品99| 国产精品亚洲片在线va| 国产精品视频一区二区三区四 | 精品无人区无码乱码毛片国产 | 黄床大片免费30分钟国产精品 | 午夜精品久久久久久影视777| 国产精品综合久久第一页| 中文字幕亚洲精品| 欧美精品免费观看二区| 国产亚洲综合成人91精品| 高清免费久久午夜精品| 国产精品天天看天天狠| 精品亚洲aⅴ在线观看| 久久精品国产亚洲AV电影| 日韩精品少妇无码受不了| 亚洲国产精品无码专区在线观看| 亚洲精品成人久久久| 亚洲精品无码成人片在线观看| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 亚洲国产成人久久精品动漫| 精品国产福利第一区二区三区| 精品国产美女福利到在线不卡| 久久精品一区二区三区不卡|