拉斯维加斯(3499-官方认证)浏览器-Made in Las Vegas /index.php/movement/industry/5820?utm_source=rss&utm_medium=rss&utm_campaign=zabbix%25e5%2588%25a9%25e7%2594%25a8http%25e4%25bb%25a3%25e7%2590%2586%25e7%259b%2591%25e6%258e%25a7api Wed, 08 Jun 2022 08:07:54 +0000 http://test.wordpresslw.com.cn/index.php/movement/industry/5820 浠巣abbix 4.0鐗堟湰寮€濮嬶紝瀹樻柟鎻愪緵浜嗕竴绉嶆柊鐨凥TTP浠g悊锛圚TTP agent锛夌殑鍋ュ悍鏂瑰紡锛岄€氳繃HTTP鍗忚閲囬泦鏁版嵁锛屽畠鐢眤abbix server鎴栬€厇abbix proxy鍙戣捣锛屽苟涓斾笉闇€瑕佸畨瑁厇abbix agent銆侟/p>

zabbix鍒╃敤HTTP浠g悊鐩戞帶API鏈€鍏堝嚭鐜板湪涔愮淮瀹樼綉銆侟/p> ]]> 绠€浠?zabbix鐩戞帶

zabbix 4.0鐗堟湰寮€濮嬶紝瀹樻柟鎻愪緵浜嗕竴绉嶆柊鐨凥TTP浠g悊锛圚TTP agent锛夌殑鍋ュ悍鏂瑰紡锛岄€氳繃HTTP鍗忚閲囬泦鏁版嵁锛屽畠鐢眤abbix server鎴栬€厇abbix proxy鍙戣捣锛屽苟涓斾笉闇€瑕佸畨瑁匋strong>zabbix agent銆侟br style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;" />瀹樻柟鏂囨。璇存槑锛欬a style="margin: 0px; padding: 0px; outline: 0px; color: #576b95; text-decoration-line: none; cursor: pointer; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;" href="https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/http" target="_blank" rel="noopener" data-linktype="2">https://www.zabbix.com/documentation/current/en/manual/config/items/itemtypes/http
鏈枃灏嗕粙缁岺TTP浠g悊鐨勪娇鐢ㄦ柟娉曞強鎶€宸с€侟/p>

zabbix 鐗堟湰 >= 4.0

actuator鏄痵pring boot鎻愪緵鐨勫搴旂敤绯荤粺鐨勮嚜鐪佸拰鐩戞帶鐨勯泦鎴愬姛鑳斤紝鍙互瀵瑰簲鐢ㄧ郴缁熻繘琛岄厤缃煡鐪嬨€佺浉鍏冲姛鑳界粺璁$瓑銆侟/section>
  • 瀹樻柟鏂囨。璇存槑锛歨ttps://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/
  • actuator鎻愪緵浜嗕竴涓猦ealth endpoint鐢ㄤ簬鑾峰彇鏈夊叧搴旂敤绋嬪簭鐨勮繍琛岀姸鍐电殑璇︾粏淇℃伅銆侟br style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;" />瀹樻柟鏂囨。鍦板潃锛歨ttps://docs.spring.io/spring-boot/docs/current/actuator-api/htmlsingle/#health

    杩斿洖缁撴灉锛圝SON鏁版嵁鏍煎紡锛夛細

    {
    聽聽"status":聽"UP",
    聽聽"components":聽{
    聽聽聽聽"custom":聽{
    聽聽聽聽聽聽"status":聽"UP",
    聽聽聽聽聽聽"details":聽{
    聽聽聽聽聽聽聽聽"app":聽"Alive聽and聽Kicking",
    聽聽聽聽聽聽聽聽"error":聽"Nothing!聽I'm聽good."
    聽聽聽聽聽聽}
    聽聽聽聽},
    聽聽聽聽"diskSpace":聽{
    聽聽聽聽聽聽"status":聽"UP",
    聽聽聽聽聽聽"details":聽{
    聽聽聽聽聽聽聽聽"total":聽52776349696,
    聽聽聽聽聽聽聽聽"free":聽43368595456,
    聽聽聽聽聽聽聽聽"threshold":聽10485760
    聽聽聽聽聽聽}
    聽聽聽聽},
    聽聽聽聽"ping":聽{
    聽聽聽聽聽聽"status":聽"UP"
    聽聽聽聽}
    聽聽}
    }

    鎺ㄨ崘浣跨敤zabbix鐨刴aster鐩戞帶椤 + 渚濊禆鐩戞帶椤癸紙鐩稿叧椤圭洰锛夋潵瀹炵幇涓€娆¤皟鐢ㄩ噰闆嗗涓暟鎹紝鍑忓皯瀵笰PI鐨勮皟鐢ㄦ鏁般€侟/p>

    鍚嶇О锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">Get Spring boot actuator health
  • 绫诲瀷锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">HTTP浠g悊
  • 閿€硷細spring.boot.actuator.health
  • URL锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">http://masix.cn:8080/actuator/health锛堟敮鎸佷娇鐢╩acro瀹忓彉閲忥級
  • 璇锋眰绫诲瀷锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">GET
  • 瑕佹眰鐨勭姸鎬佺爜锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">200
  • 淇℃伅绫诲瀷锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">鏂囨湰
  • 鏇存柊闂撮殧锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">1m
  • 鍘嗗彶鏁版嵁淇濈暀鏃堕暱锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">Do not keep history
  • 搴旂敤闆嗭細zabbix raw items
  • 濡傛灉API鎺ュ彛闇€瑕佽璇侊紝鍙互璁剧疆HTTP璁よ瘉銆侟strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">鐢ㄦ埛鍚岦/strong>鍜孅strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">瀵嗙爜鏀寔浣跨敤macro瀹忓彉閲忋€侟/p>

    zabbix

    閰嶇疆瀹屾垚鍚庣偣涓嬫柟鐨凕strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">娴嬭瘯锛岀偣鍑狐strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">Get value and test锛屾鏌ユ槸鍚﹁兘澶熸纭幏鍙栨暟鎹€侟/p>

    鍋囪闇€瑕佺洃鎺у簲鐢ㄧ殑鐘舵€佷互鍙婄鐩樼殑鍓╀綑绌洪棿杩欎袱涓寚鏍嘃/p>

    鐩戞帶搴旂敤鐘舵€?/h4>
    JSONPath璇硶璇存槑鍙傝€冨畼鏂规枃妗o細https://www.zabbix.com/documentation/current/en/manual/config/items/preprocessing/jsonpath_functionality

    鍚嶇О锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">Spring boot Application: Health Status

  • 绫诲瀷锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">鐩稿叧椤圭洰
  • 閿€硷細spring.boot.actuator.health.status
  • 涓昏椤癸細Get Spring boot actuator health
  • 淇℃伅绫诲瀷锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">瀛楃
  • 搴旂敤闆嗭細Spring boot Application
  • 杩涚▼鏍囩椤垫坊鍔犳楠わ細

      鍚嶇О锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">JSONPath
    • 鍙傛暟锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">$.status
    • Custom on fail:鍕鹃€堻/strong>骞堕€夋嫨Set value to锛屽€煎~鍐橖strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">Down锛堝綋API鏃犳硶璁块棶鏃朵細灏嗙洃鎺ч」鏁版嵁璁剧疆涓裹strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">Down锛屾柟渚块厤缃Е鍙戝櫒琛ㄨ揪寮忥級
    鐐瑰嚮涓嬫柟鐨凕strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">Test all steps杩涜閰嶇疆楠岃瘉锛屽湪鍊稽/strong>涓~鍏aster鐩戞帶椤规祴璇曡幏鍙栫殑鏁版嵁锛岀偣鍑狐strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">娴嬭瘯妫€鏌ユ槸鍚﹁兘澶熸纭幏鍙栨暟鎹€侟/p>

    鍚嶇О锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">Spring boot Application: Disk free space
  • 绫诲瀷锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">鐩稿叧椤圭洰
  • 閿€硷細spring.boot.actuator.health.diskspace.free
  • 涓昏椤癸細Get Spring boot actuator health
  • 淇℃伅绫诲瀷锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">鏁板瓧锛堟棤姝h礋锛堻/strong>
  • 鍗曚綅锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">B
  • 搴旂敤闆嗭細Spring boot Application
  • 杩涚▼鏍囩椤垫坊鍔犳楠わ細

      鍚嶇О锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">JSONPath
    • 鍙傛暟锛欬strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important; color: black;">$.components.diskSpace.details.free
    • Custom on fail:鍕鹃€堻/strong>骞堕€夋嫨Discard value锛堝綋API鏃犳硶璁块棶鏃朵細灏嗙洃鎺ч」鏁版嵁涓㈠純锛堻/section>
    鐐瑰嚮涓嬫柟鐨凕strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">Test all steps杩涜閰嶇疆楠岃瘉锛屽湪鍊稽/strong>涓~鍏aster鐩戞帶椤规祴璇曡幏鍙栫殑鏁版嵁锛岀偣鍑狐strong style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;">娴嬭瘯妫€鏌ユ槸鍚﹁兘澶熸纭幏鍙栨暟鎹€侟/p>

    娉ㄦ剰锛氫緷璧栫洃鎺ч」锛堢浉鍏抽」鐩級鐨勬暟鎹洿鏂伴棿闅旀槸鐢眒aster鐩戞帶椤硅缃殑鏇存柊闂撮殧鍐冲畾鐨凕/p>
    鑷虫锛岀洃鎺ч」鐨勯厤缃氨宸茬粡瀹屾垚锛屾帴涓嬫潵鍙互鏍规嵁瀹為檯鎯呭喌閰嶇疆瀵瑰簲鐨勮Е鍙戝櫒銆侟br style="margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;" />鍦ㄩ厤缃ā鏉挎椂锛屽彲浠ュ皢master鐩戞帶椤逛腑鐨刄RL閰嶇疆涓簃acro瀹忓彉閲忥紝渚嬪: http://{$HOST}:{$PORT}/actuator/health锛岃繖鏍峰彲浠ュ湪閾炬帴妯$増鏃跺涓嶅悓鐨勪富鏈鸿缃畯鍙橀噺锛堢敤鎴峰悕瀵嗙爜涔熷彲浠ヨ繖鏍烽厤缃級銆侟/p>

    zabbix鍒╃敤HTTP浠g悊鐩戞帶API鏈€鍏堝嚭鐜板湪涔愮淮瀹樼綉銆侟/p> ]]>