index.html 35.1 KB
Newer Older
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
1 2 3 4 5
<!DOCTYPE html>
<html class="no-js" lang="zh-CN">
  <head>
    <meta charset="utf-8">
    
LinuxSuRen's avatar
LinuxSuRen 已提交
6 7 8
    <link rel="preload" href="https://jenkins-zh.cn/files/muli-latin-200.woff2" as="font" type="font/woff2" crossorigin>
    <link rel="preload" href="https://jenkins-zh.cn/files/muli-latin-400.woff2" as="font" type="font/woff2" crossorigin>
    <link rel="preload" href="https://jenkins-zh.cn/files/muli-latin-800.woff2" as="font" type="font/woff2" crossorigin>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
9 10 11

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     
LinuxSuRen's avatar
LinuxSuRen 已提交
12 13
     <title>使用 Zabbix 监控 Jenkins - Jenkins 中文社区</title>
     <meta name="HandheldFriendly" content="True">
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
14
    <meta name="MobileOptimized" content="320">
LinuxSuRen's avatar
LinuxSuRen 已提交
15 16 17 18
    
    <meta name="description" content="介绍了如何使用 Zabbix 监控 Jenkins">
    
    
LinuxSuRen's avatar
LinuxSuRen 已提交
19
    <meta name="keywords" content="Jenkins,Jenkins中文社区,Jenkins官方公众号,持续集成,持续交付,开源社区,DevOps">
LinuxSuRen's avatar
LinuxSuRen 已提交
20
    
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
21 22

    <meta name="viewport" content="width=device-width,minimum-scale=1">
LinuxSuRen's avatar
LinuxSuRen 已提交
23
     <meta name="generator" content="Hugo 0.54.0" />
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
24 25

      
LinuxSuRen's avatar
LinuxSuRen 已提交
26
        <META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
27 28
      

LinuxSuRen's avatar
LinuxSuRen 已提交
29
    <link href='/dist/main.css' rel='stylesheet' type="text/css" /><style>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
30 31 32 33 34 35 36 37
  img.avatar {
    width: 32px;
    display: inline;
  }
</style>
<meta property="og:title" content="使用 Zabbix 监控 Jenkins" />
<meta property="og:description" content="介绍了如何使用 Zabbix 监控 Jenkins" />
<meta property="og:type" content="article" />
LinuxSuRen's avatar
LinuxSuRen 已提交
38
<meta property="og:url" content="https://jenkins-zh.cn/wechat/articles/2019/04/2019-04-15-zabbix-monitor-jenkins/" />
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
39
<meta property="article:published_time" content="2019-04-15T00:00:00&#43;00:00"/>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
<meta property="article:modified_time" content="2019-04-15T00:00:00&#43;00:00"/>

<meta itemprop="name" content="使用 Zabbix 监控 Jenkins">
<meta itemprop="description" content="介绍了如何使用 Zabbix 监控 Jenkins">


<meta itemprop="datePublished" content="2019-04-15T00:00:00&#43;00:00" />
<meta itemprop="dateModified" content="2019-04-15T00:00:00&#43;00:00" />
<meta itemprop="wordCount" content="423">



<meta itemprop="keywords" content="jenkins,zabbix," />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="使用 Zabbix 监控 Jenkins"/>
<meta name="twitter:description" content="介绍了如何使用 Zabbix 监控 Jenkins"/>

LinuxSuRen's avatar
LinuxSuRen 已提交
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
        
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-4216293-5"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-4216293-5');



var trackOutboundLink = function(id, url) {
  console.log("track:", id, url)
  gtag('event', 'click', {
    'event_category': 'outbound',
    'event_label': id,
    'transport_type': 'beacon',
    'event_callback': function(){document.location = url;}
  });
}

</script>

      
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
81 82 83 84 85 86 87 88
  </head>
  <body class="ma0 sans-serif bg-primary-color-light">
    
<nav class="bg-primary-color-dark pv4 w-100" role="navigation">

  <div class="center flex-ns flex-wrap items-center justify-start mw9">

    <h1 class="dim f3 lh-solid ml0-ns mr0 mr4-l mv0 pl3 pl4-ns">
LinuxSuRen's avatar
LinuxSuRen 已提交
89
      <a href="https://jenkins-zh.cn/" class="link white">
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
90 91 92 93 94 95 96 97 98 99
         Jenkins 中文社区
      </a>
    </h1>
    <ul class="list ma0 pa0 dn dib-l">
      
        <li class="f5 dib mr4" role="menuitem">
            
            
          <a href="/wechat/" class="dim link light-silver"
            >
LinuxSuRen's avatar
LinuxSuRen 已提交
100
            博客
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
              
            
          </a>
        </li>
      
        <li class="f5 dib mr4" role="menuitem">
            
            
          <a href="/event/" class="dim link light-silver"
            >
            活动
              
            
          </a>
        </li>
      
        <li class="f5 dib mr4" role="menuitem">
            
            
          <a href="/about/" class="dim link light-silver"
            >
            关于我们
              
            
          </a>
        </li>
      
        <li class="f5 dib mr4" role="menuitem">
            
            
          <a href="http://jenkins.io/zh" class="dim link light-silver"
            target="_blank">
            Jenkins 官网
              
            
              <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10" viewBox="0 0 32 32" class="fill-current v-base" aria-label="External Link">
<path d="M25.152 16.576v5.696q0 2.144-1.504 3.648t-3.648 1.504h-14.848q-2.144 0-3.648-1.504t-1.504-3.648v-14.848q0-2.112 1.504-3.616t3.648-1.536h12.576q0.224 0 0.384 0.16t0.16 0.416v1.152q0 0.256-0.16 0.416t-0.384 0.16h-12.576q-1.184 0-2.016 0.832t-0.864 2.016v14.848q0 1.184 0.864 2.016t2.016 0.864h14.848q1.184 0 2.016-0.864t0.832-2.016v-5.696q0-0.256 0.16-0.416t0.416-0.16h1.152q0.256 0 0.416 0.16t0.16 0.416zM32 1.152v9.12q0 0.48-0.352 0.8t-0.8 0.352-0.8-0.352l-3.136-3.136-11.648 11.648q-0.16 0.192-0.416 0.192t-0.384-0.192l-2.048-2.048q-0.192-0.16-0.192-0.384t0.192-0.416l11.648-11.648-3.136-3.136q-0.352-0.352-0.352-0.8t0.352-0.8 0.8-0.352h9.12q0.48 0 0.8 0.352t0.352 0.8z"></path>
</svg>

            
          </a>
        </li>
      
    </ul>

    <div class="db dib-ns pl3"><form id="site-search-form" action="" role="search">
  <fieldset class="bn ma0 pa0">
    <label class="clip" for="email-address">Search</label>
    <input type="search" id="search-input" class="needs-js bg-left bg-transparent bn f5 input-reset lh-solid mt3 mt0-ns pl4 pv2 w5 white"
      placeholder="搜索文档" type="text"
      name="email-address" value="" style="background-image:url('/images/icon-search.png');background-size:16px 16px;">
  </fieldset>
</form>
</div>

    <div class="list ma0 pa0 dn dib-l"></div>

    <span class="absolute mt1 mt2-l pr3 right-0 top-0">

<a class="github-button needs-js link primary-color-dark" href="https://github.com/jenkins-zh/jenkins-zh/" data-size="large" data-show-count="false" aria-label="Star Jenkins WeChat GitHub">Star</a>
</span>

  </div>
</nav>

    
    <main role="main" class="content-with-sidebar min-vh-100 pb7 pb0-ns">
      
<main>
  <article class="w-100 ph4 pb5 pb6-ns pt1 pt5-ns">
    <div class="flex-l">
      

      <div class="order-2 w-100 w-20-l ph5-m ph0-l mb4 sticky">



  <aside class="mw5 br3 mv3 nested-links">
    
    
      
LinuxSuRen's avatar
LinuxSuRen 已提交
182 183 184 185 186 187 188 189 190 191
        <h3 class="f4 dib">
            翟志军
        </h3>

      
      
        <p class="lh-copy measure center mt0 f6 black-60">
          《Jenkins 2.x实践指南》作者,购买地址:https://item.jd.com/12512889.html?dist=jd

        </p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
192
      
LinuxSuRen's avatar
LinuxSuRen 已提交
193
      <a href="https://github.com/zacker330" target="_blank" class="link dim v-mid dib">
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
        <svg version="1.1" fill="gray" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="18" viewBox="0 0 27 32">
<path d="M9.28 21.44q0.064-0.128-0.064-0.256-0.16-0.128-0.256-0.032-0.064 0.128 0.064 0.224 0.16 0.128 0.256 0.064zM8.768 20.704q-0.096-0.128-0.224-0.096-0.096 0.096 0 0.224 0.128 0.16 0.224 0.096t0-0.224zM8.032 19.968q0.032-0.064-0.096-0.128-0.128-0.032-0.128 0.032-0.064 0.096 0.064 0.16 0.16 0.032 0.16-0.064zM8.416 20.384q0.032 0 0.032-0.064t-0.064-0.096q-0.128-0.128-0.192-0.064t0.032 0.192q0.096 0.096 0.192 0.032zM9.952 21.728q0.032-0.128-0.16-0.192-0.16-0.064-0.224 0.064t0.16 0.192q0.16 0.064 0.224-0.064zM10.688 21.792q0-0.16-0.192-0.16t-0.192 0.16 0.192 0.128 0.192-0.128zM11.392 21.664q-0.032-0.128-0.224-0.096t-0.16 0.16q0.032 0.16 0.192 0.096t0.192-0.16zM22.848 16q0-3.776-2.656-6.464t-6.464-2.688-6.464 2.688-2.688 6.464q0 2.976 1.76 5.376t4.48 3.296q0.32 0.064 0.48-0.096t0.16-0.352q0-0.928-0.032-1.696-0.096 0.032-0.256 0.064t-0.64 0.032-0.864-0.096-0.768-0.352-0.544-0.736q-0.416-1.056-1.024-1.312-0.032-0.032-0.064-0.064l-0.16-0.16t-0.096-0.16 0.064-0.128 0.352-0.064q0.096 0 0.256 0.032t0.544 0.288 0.576 0.64q0.288 0.48 0.672 0.736t0.768 0.256 0.704-0.064 0.512-0.16q0.128-0.864 0.608-1.248-0.896-0.096-1.536-0.32t-1.312-0.704-0.992-1.344-0.352-2.144q0-1.408 0.96-2.464-0.448-1.088 0.096-2.4 0.32-0.128 0.96 0.128t1.088 0.512l0.448 0.288q1.056-0.288 2.304-0.288t2.272 0.288q0.192-0.128 0.512-0.32t0.992-0.448 1.024-0.16q0.512 1.312 0.096 2.4 0.928 1.056 0.928 2.464 0 1.024-0.256 1.792t-0.64 1.248-0.928 0.8-1.12 0.448-1.216 0.224q0.608 0.544 0.608 1.696 0 0.704 0 1.6t-0.032 0.896q0 0.224 0.16 0.352t0.48 0.096q2.752-0.928 4.512-3.296t1.728-5.376zM27.424 7.424v17.152q0 2.112-1.504 3.616t-3.648 1.536h-17.12q-2.144 0-3.648-1.536t-1.504-3.616v-17.152q0-2.112 1.504-3.616t3.648-1.536h17.12q2.144 0 3.648 1.536t1.504 3.616z"></path>
</svg>

      </a>
  </aside>


<aside class="fixed-lTK mw5-l right-0 f6 bl-l b--moon-gray pv4 pv0-ns ph4-l nested-list-reset nested-links nested-copy-line-height">
	

	<div date-pref>
		<a href=".." class="dib f6 pl1 hover-bg-light-gray br-100">
			<svg class="fill-current" height="30px" viewBox="0 0 24 24" width="30px" xmlns="http://www.w3.org/2000/svg">
      <path transform="rotate(90 11.704999923706055,12.000000000000002) " d="m15.41,7.41l-1.41,-1.41l-6,6l6,6l1.41,-1.41l-4.58,-4.59l4.58,-4.59z" id="svg_1"/>
    <path d="M0 0h24v24H0z" fill="none"/>
</svg>

		</a>
		
		
LinuxSuRen's avatar
LinuxSuRen 已提交
215
			<a href="https://jenkins-zh.cn/wechat/articles/2019/04/2019-04-17-aiops/" class="dib f6 pl1 hover-bg-light-gray br-100" title="AIOps:DevOps 的未来 ">
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
216 217 218 219 220 221 222
				<svg class="fill-current" height="30px" viewBox="0 0 24 24" width="30px" xmlns="http://www.w3.org/2000/svg">
    <path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
    <path d="M0 0h24v24H0z" fill="none"/>
</svg>

			</a>
		
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
223 224

		
LinuxSuRen's avatar
LinuxSuRen 已提交
225
			<a href="https://jenkins-zh.cn/wechat/articles/2019/04/2019-04-12-brief-analysis-the-encryption-algorithm-of-the-built-in-jenkins-user-database/" class="dib f6 pr1 hover-bg-light-gray br-100" title="简析 Jenkins 专有用户数据库加密算法">
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270
			<svg class="fill-current" height="30px" viewBox="0 0 24 24" width="30px" xmlns="http://www.w3.org/2000/svg">
    <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
    <path d="M0 0h24v24H0z" fill="none"/>
</svg>

			</a>
		
	</div>

</aside>
</div>

      <div class="order-1 w-80-l mw8 ph0 ph5-ns mid-gray nested-copy-line-height no-underline nested-links nested-img nested-copy-seperator nested-blockquote mt0-ns" style="flex-grow:1;">
        <div class="documentation-copy center mw8">
          <div id="readout" class="fixed right-0 bottom-0">
          </div>
          <header class="flex-none w-100">
  
  <h1 class="lh-title mb3 mv0 pt3 primary-color-dark">使用 Zabbix 监控 Jenkins</h1>
</header>

<aside class="bt bw1 pt3 mt2 mid-gray b--mid-gray fn w-100">
  
    <div class="f4 fw4 lh-copy">
      介绍了如何使用 Zabbix 监控 Jenkins
    </div>
  

  
</aside>



<div class="prose" id="prose">



<blockquote>
<p>本文假设读者已经了解 Jenkins 基本概念及插件安装,Zabbix 基础概念。基于 Zabbix 3.4,Jenkins 2.8 做实验</p>
</blockquote>

<p>笔者最近的工作涉及到使用 Zabbix 监控 Jenkins。在谷歌上搜索到的文章非常少,能操作的就更少了。所以决定写一篇文章介绍如何使用 Zabbix 监控 Jenkins。</p>

<p>下图为整体架构图:</p>

LinuxSuRen's avatar
LinuxSuRen 已提交
271
<p><img src="292372-ecc7d290dd4d0f0f.png" alt="" /></p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286

<p>整体并不复杂,大体步骤如下:</p>

<ol>
<li>在 Jenkins 上安装 Metrics 插件,使 Jenkins 暴露 metrics api。</li>
<li>配置 Zabbix server 及 agent 以实现监控及告警</li>
</ol>

<p>为方便读者实验,笔者将自己做实验的代码上传到了 GitHub,链接在文章末尾。使用的是 Docker Compose 技术(方便一次性启动所有的系统)。</p>

<p>接下来,我们详细介绍 Metrics插件及如何实现 Zabbix 监控 Jenkins。</p>

<h2 id="1-使-jenkins-暴露-metrics-api">1. 使 Jenkins 暴露 metrics api</h2>

<p>安装 Metrics 插件,在系统配置中,会多出“Metrics”的配置,如下图:
LinuxSuRen's avatar
LinuxSuRen 已提交
287
<img src="292372-ba867bb2509c6fc4.png" alt="" /></p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
288 289 290 291 292

<p>配置项不复杂。我们需要点击“Generate&hellip;”生成一个 Access Key(生成后,记得要保存)。这个 Key 用于身份校验,后面我们会用到。</p>

<p>保存后,我们在浏览器中输入URL:<code>http://localhost:8080/metrics/&lt;刚生成的 Access Key&gt;</code> 验证 Jenkins 是否已经暴露 metrics。如果看到如下图,就说明可以进行下一步了。</p>

LinuxSuRen's avatar
LinuxSuRen 已提交
293
<p><img src="292372-011d7fc64d176d63.png" alt="" /></p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325

<h3 id="1-1-metrics-插件介绍">1.1 Metrics 插件介绍</h3>

<p>Metrics 插件是基于 dropwizard/metrics 实现。它通过4个接口暴露指标数据:/metrics,/ping,/threads,/healthcheck。</p>

<h3 id="1-2-metrics-插件-metrics-接口介绍">1.2 Metrics 插件:/metrics 接口介绍</h3>

<p>点击上图中的<code>metric</code>链接(<code>http://localhost:8080/metrics/&lt;Access Key&gt;/metrics</code>),它暴露了以下指标数据:</p>

<pre><code class="language-json">{
  version: &quot;3.0.0&quot;,
  gauges: {...},
  counters: {...},
  histograms: {...},
  meters: {...},
  timers: {...}
}
</code></pre>

<p>从数据结构中可以看出它将指标分成 5 种数据类型:
* Gauges:某项指标的瞬时值,例如:当前 Jenkins executor 的总个数(jenkins.executor.count.value)
* Counters:某项指标的总数值,例如:http 请求活动连接数(http.activeRequests)
* Meters:一段时间内,某事件的发生概率,例如:Jenkins成功执行的任务每分钟的执行次数(jenkins.runs.success.m1_rate)
* Histogram:统计指标的分布情况。例如:Jenkins executor 数量的分布(jenkins.executor.count.history)
* Timer:某项指标的持续时间。例如:Jenkins 任务等待时间(jenkins.job.waiting.duration)</p>

<p>由于指标非常之多,我们就不分别介绍了。具体有哪些指标,读者朋友可以从代码仓库中的 metrics.json 文件了解。</p>

<h3 id="1-2-metrics-插件其它接口介绍">1.2 Metrics 插件其它接口介绍</h3>

<ul>
<li>/ping:接口返回 <code>pong</code> 代表 Jenkins 存活,如下图:
LinuxSuRen's avatar
LinuxSuRen 已提交
326
<img src="292372-15e36249b868625a.png" alt="" /></li>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
<li>/threads:返回 Jenkins 的线程信息</li>
<li>/healthcheck:返回以下指标:</li>
</ul>

<pre><code class="language-json">  {
    disk-space: {
     healthy: true
    },
    plugins: {
      healthy: true,
      message: &quot;No failed plugins&quot;
    },
    temporary-space: {
      healthy: true
    },
    thread-deadlock: {
      healthy: true
    }
  }
</code></pre>

<h2 id="2-配置-zabbix-server-与-agent-实现监控及告警">2. 配置 Zabbix server 与 agent 实现监控及告警</h2>

<p>Zabbix server 通过与 Zabbix agent 进行通信实现数据的采集。而 Zabbix agent 又分为被动和主动两种模式。我们使用的是被动模式,也就是Zabbix server 向 agent 索要数据。</p>

<p>所以,我们需要在 Zabbix agent 所在机器放一个获取 Jenkins 指标数据的脚本。再配置 Zabbix server 定时从该 agent 获取数据,最后配置触发器(trigger)实现告警。</p>

<p>接下来的关于 Zabbix 的配置,基于我的 jenkins-zabbix 实验环境,读者朋友需要根据自己的实际情况变更。</p>

<h3 id="2-1-配置-zabbix-server-如何从-agent-获取指标数据">2.1 配置 Zabbix server 如何从 agent 获取指标数据</h3>

<p>首先,我们需要告诉 Zabbix server 要与哪些 Zabbix agent 通信。所以,第一步是创建主机,如下图:
LinuxSuRen's avatar
LinuxSuRen 已提交
359
  <img src="292372-82ae4d1864e7abc7.png" alt="" />
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
360
第二步,在主机列表中点击“Iterms”进行该主机的监控项设置:
LinuxSuRen's avatar
LinuxSuRen 已提交
361
  <img src="292372-6903c525459cb7a6.png" alt="" />
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
362
第三步,进入创建监控项页面:
LinuxSuRen's avatar
LinuxSuRen 已提交
363
  <img src="292372-a6ab0ea028cbadb0.png" alt="" />
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
364
第四步,创建监控项:
LinuxSuRen's avatar
LinuxSuRen 已提交
365
  <img src="292372-47570ec3796d857a.png" alt="" /></p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413

<p>这里需要解释其中几个选项为什么要那样填:
* <strong>Type</strong>:是 Zabbix server 采集指标的类型,我们选择的是 Zabbix agent,如上文所说。
* <strong>Key</strong>:由于我们要监控的指标并不是 Zabbix 预定义的。所以,需要使用用户自定义参数来实现监控 Jenkins 指标。Key 填的值为:jenkins.metrics[gauges.jenkins.node.count.value.value]。<code>jenkins.metrics</code>是需要执行的真正的 Key 名称。而 <code>[]</code> 内是传给该 Key 对应的命令的参数。对于初学者,Zabbix 这部分概念非常不好理解。也许这样会更好理解:在使用用户自定义参数来实现监控的情况下,Zabbix server 会将这个 Key 发送给 agent,然后 agent 根据这个 Key 执行指定的 <strong>逻辑</strong> 以获取指标数据。这个 <strong>逻辑</strong> 通常是一段脚本(shell命令或Python脚本等)。而脚本也是可以传参的,<code>[]</code>中的值就是传给脚本的参数。具体更多细节,下文会继续介绍。
* <strong>Type of information</strong>:监控数据的数据类型,由于我们监控的是 Jenkins node 节点的个数,所以,使用数字整型。
* <strong>Update interval</strong>:指 Zabbix server 多长时间向 agent 获取一次数据,为方便实验,我们设置为 2s。</p>

<p>到此,Zabbix server 端已经配置完成。</p>

<h3 id="2-2-配置-zabbix-agent-使其有能力从-jenkins-获取指标数据">2.2 配置 Zabbix agent 使其有能力从 Jenkins 获取指标数据</h3>

<p>当 Zabbix agent 接收到 server 端的请求,如 <code>jenkins.metrics[gauges.jenkins.node.count.value.value]</code>。Zabbix agent 会读取自己的配置(agent 启动时会配置),配置内容如下:</p>

<pre><code>## Zabbix Agent Configuration File for Jenkins Master
UserParameter=jenkins.metrics[*], python /usr/lib/zabbix/externalscripts/jenkins.metrics.py $1
</code></pre>

<p>根据 Key 名称(jenkins.metrics)找到相应的命令,即:<code>python /usr/lib/zabbix/externalscripts/jenkins.metrics.py $1</code>。并执行它,同时将参数 <code>gauges.jenkins.node.count.value.value</code> 传入到脚本 jenkins.metrics.py 中。jenkins.metrics.py 需要我们在 Jenkins agent 启动前放到 /usr/lib/zabbix/externalscripts/ 目录下。</p>

<p>jenkins.metrics.py 的源码在 jenkins-zabbix 实验环境中可以找到,篇幅有限,这里就简单介绍一下其中的逻辑。</p>

<p>jenkins.metrics.py 所做的事情,无非就是从 Jenkins master 的 metrics api 获取指标数据。但是由于 api 返回的是 JSON 结构,并不是 Zabbix server 所需要的格式。所以,jenkins.metrics.py 还做了一件事情,就是将 JSON 数据进行扁平化,比如原来的数据为:<code>{&quot;gauges&quot;:{&quot;jenkins.node.count.value&quot;: { &quot;value&quot;: 1 }}}</code> 扁平化后变成: <code>gauges.jenkins.node.count.value.value=1</code></p>

<p>如果 jenkins.metrics.py 脚本没有接收参数的执行,它将一次性返回所有的指标如:</p>

<pre><code>......
histograms.vm.memory.pools.Metaspace.used.window.15m.stddev=0.0
histograms.vm.file.descriptor.ratio.x100.window.5m.p75=0.0
histograms.vm.memory.pools.PS-Old-Gen.used.window.5m.count=4165
gauges.vm.runnable.count.value=10
timers.jenkins.task.waiting.duration.mean=0.0
histograms.vm.memory.non-heap.committed.history.p99=123797504.0
gauges.vm.memory.pools.PS-Eden-Space.used.value=19010928
gauges.jenkins.node.count.value.value=1
histograms.vm.memory.pools.Code-Cache.used.window.15m.mean=44375961.6
......
</code></pre>

<p>但是,如果接收到具体参数,如 <code>gauges.jenkins.node.count.value.value</code> ,脚本只返回该参数的值。本例中,它将只返回 <code>1</code></p>

<p>jenkins.metrics.py 脚本之所以对 JSON 数据进行扁平化,是因为 Zabbix server 一次只拿一个指标的值(这点需要向熟悉 Zabbix 的人求证,笔者从文档中没有找到明确的说明)。</p>

<p>注意:在 2.1 节中,如果 Key 值设置为:jenkins.metrics,Zabbix server 不会拿 jenkins.metrics.py 返回的所有的指标值自动创建对应的监控项。所以,Key 值必须设置为类似于 jenkins.metrics[gauges.jenkins.node.count.value.value] 这样的值。</p>

<h2 id="3-配置-zabbix-server-监控指标-并告警">3. 配置 Zabbix server 监控指标,并告警</h2>

<p>在经过 2.2 节的配置后,如果 Zabbix server 采集到数据,可通过_Monitoring -&gt; Latest data -&gt; Graph_菜单(如下图),看到图形化的报表:</p>

LinuxSuRen's avatar
LinuxSuRen 已提交
414
<p><img src="292372-e46c6e7f12c1716a.png" alt="" /></p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
415 416

<p>图形化的报表:
LinuxSuRen's avatar
LinuxSuRen 已提交
417
<img src="292372-7ad0297b73be9bbb.png" alt="" /></p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
418 419 420

<p>有了指标数据就可以根据它进行告警了。告警在 Zabbix 中称为触发器(trigger)。如下图,我们创建了一个当 Jenkins node 小于 2 时,就触发告警的触发器:</p>

LinuxSuRen's avatar
LinuxSuRen 已提交
421
<p><img src="292372-dcb88e44931b70fa.png" alt="" /></p>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472

<p>至于最终触发器的后续行为是发邮件,还是发短信,属于细节部分,读者朋友可根据自己的情况进行设置。</p>

<h2 id="小结">小结</h2>

<p>在理解了 Zabbix server 与 agent 之间的通信原理的前提下,使用 Zabbix 监控 Jenkins 是不难的。笔者认为难点在于自动化整个过程。上文中,我们创建主机和添加监控项的过程,是手工操作的。虽然 Zabbix 能通过自动发现主机,自动关联模板来自动化上述过程,但是创建”自动化发现主机“和”自动关联动作“依然是手工操作。这不符合”自动化一切“的”追求“。</p>

<p>最后,如果读者朋友不是历史包袱原因而选择 Zabbix,笔者在这里推荐 Prometheus,一款《Google 运维解密》推荐的开源监控系统。</p>

<h2 id="附录">附录</h2>

<ul>
<li>Metrics 插件:<a href="https://wiki.jenkins.io/display/JENKINS/Metrics+Plugin">https://wiki.jenkins.io/display/JENKINS/Metrics+Plugin</a></li>
<li>dropwizard/metrics:<a href="https://metrics.dropwizard.io/4.0.0/">https://metrics.dropwizard.io/4.0.0/</a></li>
<li>Zabbix 监控项类型:<a href="https://www.zabbix.com/documentation/3.4/zh/manual/config/items/itemtypes">https://www.zabbix.com/documentation/3.4/zh/manual/config/items/itemtypes</a></li>
<li>metrics.json: <a href="https://github.com/zacker330/jenkins-zabbix/blob/master/metrics.json">https://github.com/zacker330/jenkins-zabbix/blob/master/metrics.json</a></li>
<li>jenkins-zabbix 实验环境:<a href="https://github.com/zacker330/jenkins-zabbix">https://github.com/zacker330/jenkins-zabbix</a></li>
<li>Prometheus:<a href="https://prometheus.io/">https://prometheus.io/</a></li>
</ul>

</div>


<aside class="bt bw1 pt3 mt2 mid-gray b--mid-gray fn w-100">

</aside>




<script src="https://utteranc.es/client.js"
        repo="jenkins-zh/jenkins-zh.github.io"
        issue-term="pathname"
        theme="github-light"
        crossorigin="linuxsuren"
        async>
</script>


          

        </div>
      </div>
      

    </div>
  </article>

  <div class="w-100 bg-light-gray">
    <div class="mw7 pa4 center nested-lh-copy lh-copy">
      <h6 class="f4 dark-gray mb2">
LinuxSuRen's avatar
LinuxSuRen 已提交
473
  <a href="https://jenkins-zh.cn/wechat/articles/2019/04/2019-04-15-zabbix-monitor-jenkins/" class="hide-child link primary-color">
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
474 475 476
  <span class="nl3 child"><svg class="grow" fill="" height="14px" viewBox="0 0 24 24" width="14px" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h24v24H0z" fill="none"/><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>
</span>
    “使用 Zabbix 监控 Jenkins”
LinuxSuRen's avatar
LinuxSuRen 已提交
477 478 479 480
  </a> 更新于:April 15, 2019
  <div>
    原文作者:<a href="" target="_blank">zacker330</a>
  </div>
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515
</h6>

      <a href="https://github.com/jenkins-zh/jenkins-zh/edit/master/content/wechat/articles/2019/04/2019-04-15-zabbix-monitor-jenkins.md" class="
f6 ph3 pv1 br2 dib  tc ttu mv3 bg-primary-color white hover-bg-green link
" target="_blank">改善此页</a>

      

  
  
  

  <div class="nested-lh-copy">
    <ul class="list dib nested-links ml0 pl0">
      
        <li class="db mb2 b">
          Tags:
        </li>
        
          <li class="db dib-l mr3">
            <a class="tag" href="/tags/jenkins">
              jenkins
            </a>
          </li>
        
          <li class="db dib-l mr3">
            <a class="tag" href="/tags/zabbix">
              zabbix
            </a>
          </li>
        
              
      
        
        
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
516
          <li class="db dib-l mb2 mr3">
LinuxSuRen's avatar
LinuxSuRen 已提交
517 518
            <a href="/wechat/articles/2019/05/2019-05-29-jenkins-release/" class="link">
              Jenkins 2.176~2.178版本更新
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
519 520 521
            </a>
          </li>
        
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
522 523 524 525 526 527 528
      
        
          <li class="db b mt4 mb2 mr2">
            Related entries:
          </li>
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
529 530 531 532 533 534 535 536 537
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-28-jenkins-pipeline-shared-lib-unit-test/" class="link">
              如何对 Jenkins 共享库进行单元测试
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
538 539 540 541 542 543 544 545 546
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-22-jacoco-coverage-for-functional-test/" class="link">
              基于 Jenkins &#43; JaCoCo 实现功能测试代码覆盖率统计
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
547 548 549 550 551 552 553 554 555
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-20-jenkins-ansible-springboot/" class="link">
              使用 Jenkins &#43; Ansible 实现 Spring Boot 自动化部署101
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
556 557 558 559 560 561 562 563 564
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-17-from-jenkins-to-jenkins-x/" class="link">
              从 Jenkins 到 Jenkins X
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
565 566 567 568 569 570 571 572 573
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-15-gsoc-annoncement/" class="link">
              19年 GSoC 中 Jenkins 的七个项目
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
574 575 576 577 578 579 580 581 582
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-14-devops-jenkins-credential-manage/" class="link">
              基于 Jenkins 的 DevOps 平台应该如何设计凭证管理
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
583 584 585 586 587 588 589 590 591
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-13-jenkins-book-gift/" class="link">
              Jenkins 公众号送书福利
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
592 593 594 595 596 597 598 599 600
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-09-jenkins-release/" class="link">
              Jenkins 版本发布
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
601 602 603 604 605 606 607 608 609
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-08-jenkins-plugin-develop-within-two-days-part02/" class="link">
              Jenkins 插件开发之旅:两天内从 idea 到发布(下篇)
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
610 611 612 613 614 615 616 617 618
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-07-jenkins-install-plugins-shell/" class="link">
              Jenkins 自动化安装插件
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
619 620 621 622 623 624 625 626 627
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/05/2019-05-06-jenkins-plugin-develop-within-two-days-part01/" class="link">
              Jenkins 插件开发之旅:两天内从 idea 到发布(上篇)
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
628 629 630 631 632 633 634 635 636
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-29-progressive-delivery-with-jenkins-x-automatic-cana/" class="link">
              使用 Jenkins X 渐进式交付:自动化金丝雀部署
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
637 638 639 640 641 642 643 644 645
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-26-progressive-delivery-with-jenkins-x/" class="link">
              使用 Jenkins X 渐进式交付
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
646 647 648 649 650 651 652 653 654
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-25-jenkins-ansible-nginx/" class="link">
              使用 Jenkins &#43; Ansible 实现自动化部署 Nginx
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
LinuxSuRen 已提交
655 656 657 658 659 660 661 662 663
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-23-jenkins-master-shared-home/" class="link">
              关于 Jenkins master 共享 JENKINS_HOME 目录的实验
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
664 665 666 667 668 669 670 671 672
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-19-the-business-value-of-cd/" class="link">
              持续交付的商业价值
            </a>
          </li>
        
      
        
        
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
673 674 675
      
        
        
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-12-brief-analysis-the-encryption-algorithm-of-the-built-in-jenkins-user-database/" class="link">
              简析 Jenkins 专有用户数据库加密算法
            </a>
          </li>
        
      
        
        
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-10-getting-started-with-docker-for-java-applications/" class="link">
              Java 应用使用 Docker 的入门指南:建立一个 CI/CD 流水线
            </a>
          </li>
        
      
        
        
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/04/2019-04-08-becoming-contributor-intro/" class="link">
              介绍:成为一名 Jenkins 贡献者的旅程
            </a>
          </li>
        
      
        
        
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/03/2019-03-13-electron-pipeline-demo/" class="link">
              Electron 应用的流水线设计
            </a>
          </li>
        
      
        
        
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/03/2019-03-13-ready-for-cdf/" class="link">
              为 Continuous Delivery Foundation 的成立感到兴奋
            </a>
          </li>
        
      
        
        
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/03/2019-01-08-mpl-modular-pipeline-library/" class="link">
              MPL - 模块化的流水线库
            </a>
          </li>
        
      
        
        
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/02/2019-02-27-jenkins-script-console-in-practice/" class="link">
              批量修改 Jenkins 任务的技巧
            </a>
          </li>
        
      
        
        
          <li class="db dib-l mb2 mr3">
            <a href="/wechat/articles/2019/01/2019-01-16-webhook-firewalls/" class="link">
              在安全防火墙内通过 WebHook 触发构建
            </a>
          </li>
        
      
    </ul>
  </div>


    </div>
  </div>
</main>

    </main>

    <footer class="bg-primary-color-dark ph4-ns pt4 relative w-100" role="contentinfo">
  <div class="center flex-ns flex-wrap justify-between mw9 w-90">
    <div class="pb3 pt4 w-100 w-50-ns">

      <div class="b f3  light-gray mb3 nested-links tc">
<a href="https://github.com/jenkins-zh/jenkins-zh/graphs/contributors" target="_blank" class="link">Jenkins 社区贡献者</a> 维护<br/>
      </div>

      <ul class="center f6 list ma0 mv3 pa0 tc" style="display:none"><li class="dib mr3"><a href="https://github.com/jenkins-zh/jenkins-zh/issues/new" class="dim link light-gray pv2">File an Issue</a></li></ul>

      <ul class="center f6 list ma0 mv4 pa0 tc">
        <li class="dib mr3">
          <a href="https://twitter.com/suren69811254" target="_blank" class="dim link light-gray pv2">@suren69811254</a>
        </li>
        <li class="dib mr3">
          <a href="https://www.youtube.com/channel/UC63xz3pq26BBgwB3cnwCoqQ" target="_blank" class="dim link light-gray pv2">YouTube</a>
        </li>
      </ul>

      
    </div>

    <div>
      <a href="https://mp.weixin.qq.com/s/vifdduC3kRGSIMpyL03yVA" target="_blank">
        <img src="https://jenkins.io/images/jenkins-wechat.png" with="100" height="100">
      </a>
    </div>

  </div>

  <div class="f7 gray mb5 mb0-ns ph3 w-100" style="display:none"> 
    <p class="dib mr4">Jenkins&reg; is a registered trademark of <a href="https://www.spi-inc.org/" class="link">Software in the Public Interest, Inc.</a></p>
    <p class="dib">Copyright 2018–2019 the original authors.</p>
  </div>


  <div class="bg-primary-color-dark bottom-0 left-0 right-0 dn-l fixed pb3 ph3 w-100"><div  class="globalmenu mobilemenu pb3 dn">
    

<ul class="list hidden dib ph0 ma0 scrolling-touch tc">
  
    <li  class="tl dib ma0 hover-bg-black w-100">
        <a href="/wechat/" class="ttu f6 link primary-color-light overflow hover-white db brand-font  ma0 w-100 pv3 ph4">
LinuxSuRen's avatar
LinuxSuRen 已提交
799
          博客
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845
        </a>
    </li>
  
    <li  class="tl dib ma0 hover-bg-black w-100">
        <a href="/event/" class="ttu f6 link primary-color-light overflow hover-white db brand-font  ma0 w-100 pv3 ph4">
          活动
        </a>
    </li>
  
    <li  class="tl dib ma0 hover-bg-black w-100">
        <a href="/about/" class="ttu f6 link primary-color-light overflow hover-white db brand-font  ma0 w-100 pv3 ph4">
          关于我们
        </a>
    </li>
  
    <li  class="tl dib ma0 hover-bg-black w-100">
        <a href="http://jenkins.io/zh" class="ttu f6 link primary-color-light overflow hover-white db brand-font  ma0 w-100 pv3 ph4">
          Jenkins 官网
        </a>
    </li>
  
</ul>

</div>
<div  class="docsmenu mobilemenu pb3 dn">
    

<ul class="list dib ph0 ma0 scrolling-touch tc">
  
</ul>

</div>

<div class="flex dn-l justify-between">
  <button class="js-toggle flex-auto dib dn-l f6 tc db mt4-ns ph3 pv2 link mr2 white bg-primary-color-dark hover-bg-primary-color ba b--white-40 w-auto" data-target=".globalmenu">Menu</button>

  <button class="js-toggle flex-auto dib dn-l f6 tc db mt4-ns ph3 pv2 link white bg-primary-color-dark hover-bg-primary-color ba b--white-40 w-auto" data-target=".docsmenu">Docs Menu</button>
</div>
</div>

</footer>

    
<link href="/dist/auto-complete.css" rel="stylesheet">
<script type="text/javascript">
    
LinuxSuRen's avatar
LinuxSuRen 已提交
846
        var baseurl = "https:\/\/jenkins-zh.cn\/";
LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
847 848 849 850 851 852 853 854
    
</script>
<script src="/dist/lunr.js"></script>
<script src="/dist/autocomplete.js"></script>
<script src="/dist/jquery-3.2.1.min.js"></script>
<script src="/dist/search.js"></script>

<script async defer src="https://buttons.github.io/buttons.js"></script>
LinuxSuRen's avatar
LinuxSuRen 已提交
855 856 857 858 859 860 861 862 863
<script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?6db234f713318730f0e5f6a95bdd8d47";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
</script>
LinuxSuRen's avatar
LinuxSuRen 已提交
864 865 866 867 868 869 870
<script>
(function(){
var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?6276dcef5c15f276644151772390c1f9":"https://jspassport.ssl.qhimg.com/11.0.1.js?6276dcef5c15f276644151772390c1f9";
document.write('<script src="' + src + '" id="sozz"><\/script>');
})();
</script>

LinuxSuRen's avatar
deploy  
LinuxSuRen 已提交
871 872 873

  </body>
</html>