Zabbix监控记录

一 Tomcat监控

1.1.1 Tomcat 端配置 JMX

编辑catalina.sh文件,配置如下:

CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote                      # 启用远程监控JMX
-Dcom.sun.management.jmxremote.port=12345           # 默认启动的JMX端口号,要和zabbix添加主机的端口一致
-Dcom.sun.management.jmxremote.authenticate=false   # 不使用用户名密码认证
-Dcom.sun.management.jmxremote.ssl=false            # 不适用ssl认证
-Djava.rmi.server.hostname=172.16.0.20"             # tomcat主机地址

重启Tomcat

/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh
~]# ss -lnt
State      Recv-Q Send-Q                                        Local Address:Port                                                       Peer Address:Port
LISTEN     0      50                                                       :::12345                                                                :::*
                         

1.1.2 编译zabbix server,加入对java支持

默认情况下,zabbix server 是没有加入java支持,所以要让zabbix监控tomcat,就需要开启zabbix监控java的专用服务zabbix-java-gateway.

yum install -y  java  java-devel  zabbix-java-gateway

  编辑zabbix-java-gateway配置文件

~]# grep ^[a-Z] /etc/zabbix/zabbix_java_gateway.conf
LISTEN_IP="0.0.0.0"                                          # 监听地址
LISTEN_PORT=10052                                         # 监听端口
PID_FILE="/var/run/zabbix/zabbix_java.pid"        # pid文件
START_POLLERS=20                                           # 启动多少线程轮训java,要和java应用保持一定短息
TIMEOUT=30                                                      # 超时时间

  配置zabbix server调用java gateway

~]# grep ^[a-Z] /etc/zabbix/zabbix_server.conf
JavaGateway=172.16.0.88                  # 指定java gateway的地址
JavaGatewayPort=10052                     # 指定java gateway的服务器监听端口,如果是默认端口可不写
StartJavaPollers=20                             # 轮训
Timeout=30              # 超时时间

1.1.3 图形化配置

导入模板

  1 <?xml version="1.0" encoding="UTF-8"?>
  2 <zabbix_export>
  3     <version>3.0</version>
  4     <date>2018-06-26T13:09:54Z</date>
  5     <groups>
  6         <group>
  7             <name>Templates</name>
  8         </group>
  9     </groups>
 10     <templates>
 11         <template>
 12             <template>Tomcat JMX</template>
 13             <name>Tomcat JMX</name>
 14             <description/>
 15             <groups>
 16                 <group>
 17                     <name>Templates</name>
 18                 </group>
 19             </groups>
 20             <applications>
 21                 <application>
 22                     <name>class</name>
 23                 </application>
 24                 <application>
 25                     <name>HeapStatistics</name>
 26                 </application>
 27                 <application>
 28                     <name>Sessions</name>
 29                 </application>
 30                 <application>
 31                     <name>ThreadStatistics</name>
 32                 </application>
 33                 <application>
 34                     <name>Tomcat</name>
 35                 </application>
 36             </applications>
 37             <items>
 38                 <item>
 39                     <name>Sessions-当前活动会话数</name>
 40                     <type>16</type>
 41                     <snmp_community/>
 42                     <multiplier>0</multiplier>
 43                     <snmp_oid/>
 44                     <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,activeSessions]</key>
 45                     <delay>30</delay>
 46                     <history>90</history>
 47                     <trends>365</trends>
 48                     <status>0</status>
 49                     <value_type>3</value_type>
 50                     <allowed_hosts/>
 51                     <units/>
 52                     <delta>0</delta>
 53                     <snmpv3_contextname/>
 54                     <snmpv3_securityname/>
 55                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
 56                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
 57                     <snmpv3_authpassphrase/>
 58                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
 59                     <snmpv3_privpassphrase/>
 60                     <formula>1</formula>
 61                     <delay_flex/>
 62                     <params/>
 63                     <ipmi_sensor/>
 64                     <data_type>0</data_type>
 65                     <authtype>0</authtype>
 66                     <username/>
 67                     <password/>
 68                     <publickey/>
 69                     <privatekey/>
 70                     <port/>
 71                     <description/>
 72                     <inventory_link>0</inventory_link>
 73                     <applications>
 74                         <application>
 75                             <name>Sessions</name>
 76                         </application>
 77                     </applications>
 78                     <valuemap/>
 79                     <logtimefmt/>
 80                 </item>
 81                 <item>
 82                     <name>Sessions-The maximum number of active Sessions allowed, or -1 for no limit</name>
 83                     <type>16</type>
 84                     <snmp_community/>
 85                     <multiplier>0</multiplier>
 86                     <snmp_oid/>
 87                     <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,maxActiveSessions]</key>
 88                     <delay>30</delay>
 89                     <history>90</history>
 90                     <trends>365</trends>
 91                     <status>0</status>
 92                     <value_type>0</value_type>
 93                     <allowed_hosts/>
 94                     <units/>
 95                     <delta>0</delta>
 96                     <snmpv3_contextname/>
 97                     <snmpv3_securityname/>
 98                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
 99                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
100                     <snmpv3_authpassphrase/>
101                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
102                     <snmpv3_privpassphrase/>
103                     <formula>1</formula>
104                     <delay_flex/>
105                     <params/>
106                     <ipmi_sensor/>
107                     <data_type>0</data_type>
108                     <authtype>0</authtype>
109                     <username/>
110                     <password/>
111                     <publickey/>
112                     <privatekey/>
113                     <port/>
114                     <description/>
115                     <inventory_link>0</inventory_link>
116                     <applications>
117                         <application>
118                             <name>Sessions</name>
119                         </application>
120                     </applications>
121                     <valuemap/>
122                     <logtimefmt/>
123                 </item>
124                 <item>
125                     <name>Sessions-最大活动会话数</name>
126                     <type>16</type>
127                     <snmp_community/>
128                     <multiplier>0</multiplier>
129                     <snmp_oid/>
130                     <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,maxActive]</key>
131                     <delay>30</delay>
132                     <history>90</history>
133                     <trends>365</trends>
134                     <status>0</status>
135                     <value_type>3</value_type>
136                     <allowed_hosts/>
137                     <units/>
138                     <delta>0</delta>
139                     <snmpv3_contextname/>
140                     <snmpv3_securityname/>
141                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
142                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
143                     <snmpv3_authpassphrase/>
144                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
145                     <snmpv3_privpassphrase/>
146                     <formula>1</formula>
147                     <delay_flex/>
148                     <params/>
149                     <ipmi_sensor/>
150                     <data_type>0</data_type>
151                     <authtype>0</authtype>
152                     <username/>
153                     <password/>
154                     <publickey/>
155                     <privatekey/>
156                     <port/>
157                     <description/>
158                     <inventory_link>0</inventory_link>
159                     <applications>
160                         <application>
161                             <name>Sessions</name>
162                         </application>
163                     </applications>
164                     <valuemap/>
165                     <logtimefmt/>
166                 </item>
167                 <item>
168                     <name>Sessions-Number of sessions we rejected due to maxActive beeing reached</name>
169                     <type>16</type>
170                     <snmp_community/>
171                     <multiplier>0</multiplier>
172                     <snmp_oid/>
173                     <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,rejectedSessions]</key>
174                     <delay>30</delay>
175                     <history>90</history>
176                     <trends>365</trends>
177                     <status>0</status>
178                     <value_type>3</value_type>
179                     <allowed_hosts/>
180                     <units/>
181                     <delta>0</delta>
182                     <snmpv3_contextname/>
183                     <snmpv3_securityname/>
184                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
185                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
186                     <snmpv3_authpassphrase/>
187                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
188                     <snmpv3_privpassphrase/>
189                     <formula>1</formula>
190                     <delay_flex/>
191                     <params/>
192                     <ipmi_sensor/>
193                     <data_type>0</data_type>
194                     <authtype>0</authtype>
195                     <username/>
196                     <password/>
197                     <publickey/>
198                     <privatekey/>
199                     <port/>
200                     <description/>
201                     <inventory_link>0</inventory_link>
202                     <applications>
203                         <application>
204                             <name>Sessions</name>
205                         </application>
206                     </applications>
207                     <valuemap/>
208                     <logtimefmt/>
209                 </item>
210                 <item>
211                     <name>Sessions-会话数</name>
212                     <type>16</type>
213                     <snmp_community/>
214                     <multiplier>0</multiplier>
215                     <snmp_oid/>
216                     <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,sessionCounter]</key>
217                     <delay>30</delay>
218                     <history>90</history>
219                     <trends>365</trends>
220                     <status>0</status>
221                     <value_type>3</value_type>
222                     <allowed_hosts/>
223                     <units/>
224                     <delta>0</delta>
225                     <snmpv3_contextname/>
226                     <snmpv3_securityname/>
227                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
228                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
229                     <snmpv3_authpassphrase/>
230                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
231                     <snmpv3_privpassphrase/>
232                     <formula>1</formula>
233                     <delay_flex/>
234                     <params/>
235                     <ipmi_sensor/>
236                     <data_type>0</data_type>
237                     <authtype>0</authtype>
238                     <username/>
239                     <password/>
240                     <publickey/>
241                     <privatekey/>
242                     <port/>
243                     <description/>
244                     <inventory_link>0</inventory_link>
245                     <applications>
246                         <application>
247                             <name>Sessions</name>
248                         </application>
249                     </applications>
250                     <valuemap/>
251                     <logtimefmt/>
252                 </item>
253                 <item>
254                     <name>http-8080 gzip compression</name>
255                     <type>16</type>
256                     <snmp_community/>
257                     <multiplier>0</multiplier>
258                     <snmp_oid/>
259                     <key>jmx[&quot;Catalina:type=ProtocolHandler,port=8080&quot;,compression]</key>
260                     <delay>30</delay>
261                     <history>90</history>
262                     <trends>0</trends>
263                     <status>0</status>
264                     <value_type>1</value_type>
265                     <allowed_hosts/>
266                     <units/>
267                     <delta>0</delta>
268                     <snmpv3_contextname/>
269                     <snmpv3_securityname/>
270                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
271                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
272                     <snmpv3_authpassphrase/>
273                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
274                     <snmpv3_privpassphrase/>
275                     <formula>1</formula>
276                     <delay_flex/>
277                     <params/>
278                     <ipmi_sensor/>
279                     <data_type>0</data_type>
280                     <authtype>0</authtype>
281                     <username/>
282                     <password/>
283                     <publickey/>
284                     <privatekey/>
285                     <port/>
286                     <description/>
287                     <inventory_link>0</inventory_link>
288                     <applications/>
289                     <valuemap/>
290                     <logtimefmt/>
291                 </item>
292                 <item>
293                     <name>Tomcat version</name>
294                     <type>16</type>
295                     <snmp_community/>
296                     <multiplier>0</multiplier>
297                     <snmp_oid/>
298                     <key>jmx[&quot;Catalina:type=Server&quot;,serverInfo]</key>
299                     <delay>30</delay>
300                     <history>90</history>
301                     <trends>0</trends>
302                     <status>0</status>
303                     <value_type>1</value_type>
304                     <allowed_hosts/>
305                     <units/>
306                     <delta>0</delta>
307                     <snmpv3_contextname/>
308                     <snmpv3_securityname/>
309                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
310                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
311                     <snmpv3_authpassphrase/>
312                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
313                     <snmpv3_privpassphrase/>
314                     <formula>1</formula>
315                     <delay_flex/>
316                     <params/>
317                     <ipmi_sensor/>
318                     <data_type>0</data_type>
319                     <authtype>0</authtype>
320                     <username/>
321                     <password/>
322                     <publickey/>
323                     <privatekey/>
324                     <port/>
325                     <description/>
326                     <inventory_link>0</inventory_link>
327                     <applications>
328                         <application>
329                             <name>Tomcat</name>
330                         </application>
331                     </applications>
332                     <valuemap/>
333                     <logtimefmt/>
334                 </item>
335                 <item>
336                     <name>类-已加载</name>
337                     <type>16</type>
338                     <snmp_community/>
339                     <multiplier>0</multiplier>
340                     <snmp_oid/>
341                     <key>jmx[&quot;java.lang:type=ClassLoading&quot;,&quot;LoadedClassCount&quot;]</key>
342                     <delay>30</delay>
343                     <history>90</history>
344                     <trends>365</trends>
345                     <status>0</status>
346                     <value_type>3</value_type>
347                     <allowed_hosts/>
348                     <units/>
349                     <delta>0</delta>
350                     <snmpv3_contextname/>
351                     <snmpv3_securityname/>
352                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
353                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
354                     <snmpv3_authpassphrase/>
355                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
356                     <snmpv3_privpassphrase/>
357                     <formula>1</formula>
358                     <delay_flex/>
359                     <params/>
360                     <ipmi_sensor/>
361                     <data_type>0</data_type>
362                     <authtype>0</authtype>
363                     <username/>
364                     <password/>
365                     <publickey/>
366                     <privatekey/>
367                     <port/>
368                     <description/>
369                     <inventory_link>0</inventory_link>
370                     <applications>
371                         <application>
372                             <name>class</name>
373                         </application>
374                     </applications>
375                     <valuemap/>
376                     <logtimefmt/>
377                 </item>
378                 <item>
379                     <name>类-总计</name>
380                     <type>16</type>
381                     <snmp_community/>
382                     <multiplier>0</multiplier>
383                     <snmp_oid/>
384                     <key>jmx[&quot;java.lang:type=ClassLoading&quot;,&quot;TotalLoadedClassCount&quot;]</key>
385                     <delay>30</delay>
386                     <history>90</history>
387                     <trends>365</trends>
388                     <status>0</status>
389                     <value_type>3</value_type>
390                     <allowed_hosts/>
391                     <units/>
392                     <delta>0</delta>
393                     <snmpv3_contextname/>
394                     <snmpv3_securityname/>
395                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
396                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
397                     <snmpv3_authpassphrase/>
398                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
399                     <snmpv3_privpassphrase/>
400                     <formula>1</formula>
401                     <delay_flex/>
402                     <params/>
403                     <ipmi_sensor/>
404                     <data_type>0</data_type>
405                     <authtype>0</authtype>
406                     <username/>
407                     <password/>
408                     <publickey/>
409                     <privatekey/>
410                     <port/>
411                     <description/>
412                     <inventory_link>0</inventory_link>
413                     <applications>
414                         <application>
415                             <name>class</name>
416                         </application>
417                     </applications>
418                     <valuemap/>
419                     <logtimefmt/>
420                 </item>
421                 <item>
422                     <name>类-已卸载</name>
423                     <type>16</type>
424                     <snmp_community/>
425                     <multiplier>0</multiplier>
426                     <snmp_oid/>
427                     <key>jmx[&quot;java.lang:type=ClassLoading&quot;,&quot;UnloadedClassCount&quot;]</key>
428                     <delay>30</delay>
429                     <history>90</history>
430                     <trends>365</trends>
431                     <status>0</status>
432                     <value_type>3</value_type>
433                     <allowed_hosts/>
434                     <units/>
435                     <delta>0</delta>
436                     <snmpv3_contextname/>
437                     <snmpv3_securityname/>
438                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
439                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
440                     <snmpv3_authpassphrase/>
441                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
442                     <snmpv3_privpassphrase/>
443                     <formula>1</formula>
444                     <delay_flex/>
445                     <params/>
446                     <ipmi_sensor/>
447                     <data_type>0</data_type>
448                     <authtype>0</authtype>
449                     <username/>
450                     <password/>
451                     <publickey/>
452                     <privatekey/>
453                     <port/>
454                     <description/>
455                     <inventory_link>0</inventory_link>
456                     <applications>
457                         <application>
458                             <name>class</name>
459                         </application>
460                     </applications>
461                     <valuemap/>
462                     <logtimefmt/>
463                 </item>
464                 <item>
465                     <name>堆内存已提交</name>
466                     <type>16</type>
467                     <snmp_community/>
468                     <multiplier>0</multiplier>
469                     <snmp_oid/>
470                     <key>jmx[&quot;java.lang:type=Memory&quot;,&quot;HeapMemoryUsage.committed&quot;]</key>
471                     <delay>30</delay>
472                     <history>90</history>
473                     <trends>365</trends>
474                     <status>0</status>
475                     <value_type>3</value_type>
476                     <allowed_hosts/>
477                     <units/>
478                     <delta>0</delta>
479                     <snmpv3_contextname/>
480                     <snmpv3_securityname/>
481                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
482                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
483                     <snmpv3_authpassphrase/>
484                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
485                     <snmpv3_privpassphrase/>
486                     <formula>1</formula>
487                     <delay_flex/>
488                     <params/>
489                     <ipmi_sensor/>
490                     <data_type>0</data_type>
491                     <authtype>0</authtype>
492                     <username/>
493                     <password/>
494                     <publickey/>
495                     <privatekey/>
496                     <port/>
497                     <description/>
498                     <inventory_link>0</inventory_link>
499                     <applications>
500                         <application>
501                             <name>HeapStatistics</name>
502                         </application>
503                     </applications>
504                     <valuemap/>
505                     <logtimefmt/>
506                 </item>
507                 <item>
508                     <name>堆内存最大</name>
509                     <type>16</type>
510                     <snmp_community/>
511                     <multiplier>0</multiplier>
512                     <snmp_oid/>
513                     <key>jmx[&quot;java.lang:type=Memory&quot;,&quot;HeapMemoryUsage.max&quot;]</key>
514                     <delay>30</delay>
515                     <history>90</history>
516                     <trends>365</trends>
517                     <status>0</status>
518                     <value_type>3</value_type>
519                     <allowed_hosts/>
520                     <units/>
521                     <delta>0</delta>
522                     <snmpv3_contextname/>
523                     <snmpv3_securityname/>
524                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
525                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
526                     <snmpv3_authpassphrase/>
527                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
528                     <snmpv3_privpassphrase/>
529                     <formula>1</formula>
530                     <delay_flex/>
531                     <params/>
532                     <ipmi_sensor/>
533                     <data_type>0</data_type>
534                     <authtype>0</authtype>
535                     <username/>
536                     <password/>
537                     <publickey/>
538                     <privatekey/>
539                     <port/>
540                     <description/>
541                     <inventory_link>0</inventory_link>
542                     <applications>
543                         <application>
544                             <name>HeapStatistics</name>
545                         </application>
546                     </applications>
547                     <valuemap/>
548                     <logtimefmt/>
549                 </item>
550                 <item>
551                     <name>堆内存已使用</name>
552                     <type>16</type>
553                     <snmp_community/>
554                     <multiplier>0</multiplier>
555                     <snmp_oid/>
556                     <key>jmx[&quot;java.lang:type=Memory&quot;,&quot;HeapMemoryUsage.used&quot;]</key>
557                     <delay>30</delay>
558                     <history>90</history>
559                     <trends>365</trends>
560                     <status>0</status>
561                     <value_type>3</value_type>
562                     <allowed_hosts/>
563                     <units/>
564                     <delta>0</delta>
565                     <snmpv3_contextname/>
566                     <snmpv3_securityname/>
567                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
568                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
569                     <snmpv3_authpassphrase/>
570                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
571                     <snmpv3_privpassphrase/>
572                     <formula>1</formula>
573                     <delay_flex/>
574                     <params/>
575                     <ipmi_sensor/>
576                     <data_type>0</data_type>
577                     <authtype>0</authtype>
578                     <username/>
579                     <password/>
580                     <publickey/>
581                     <privatekey/>
582                     <port/>
583                     <description/>
584                     <inventory_link>0</inventory_link>
585                     <applications>
586                         <application>
587                             <name>HeapStatistics</name>
588                         </application>
589                     </applications>
590                     <valuemap/>
591                     <logtimefmt/>
592                 </item>
593                 <item>
594                     <name>http-8080线程峰值</name>
595                     <type>16</type>
596                     <snmp_community/>
597                     <multiplier>0</multiplier>
598                     <snmp_oid/>
599                     <key>jmx[&quot;java.lang:type=Threading&quot;,&quot;PeakThreadCount&quot;]</key>
600                     <delay>30</delay>
601                     <history>90</history>
602                     <trends>365</trends>
603                     <status>0</status>
604                     <value_type>3</value_type>
605                     <allowed_hosts/>
606                     <units/>
607                     <delta>0</delta>
608                     <snmpv3_contextname/>
609                     <snmpv3_securityname/>
610                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
611                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
612                     <snmpv3_authpassphrase/>
613                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
614                     <snmpv3_privpassphrase/>
615                     <formula>1</formula>
616                     <delay_flex/>
617                     <params/>
618                     <ipmi_sensor/>
619                     <data_type>0</data_type>
620                     <authtype>0</authtype>
621                     <username/>
622                     <password/>
623                     <publickey/>
624                     <privatekey/>
625                     <port/>
626                     <description/>
627                     <inventory_link>0</inventory_link>
628                     <applications>
629                         <application>
630                             <name>ThreadStatistics</name>
631                         </application>
632                     </applications>
633                     <valuemap/>
634                     <logtimefmt/>
635                 </item>
636                 <item>
637                     <name>http-8080活动线程</name>
638                     <type>16</type>
639                     <snmp_community/>
640                     <multiplier>0</multiplier>
641                     <snmp_oid/>
642                     <key>jmx[&quot;java.lang:type=Threading&quot;,&quot;ThreadCount&quot;]</key>
643                     <delay>30</delay>
644                     <history>90</history>
645                     <trends>365</trends>
646                     <status>0</status>
647                     <value_type>3</value_type>
648                     <allowed_hosts/>
649                     <units/>
650                     <delta>0</delta>
651                     <snmpv3_contextname/>
652                     <snmpv3_securityname/>
653                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
654                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
655                     <snmpv3_authpassphrase/>
656                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
657                     <snmpv3_privpassphrase/>
658                     <formula>1</formula>
659                     <delay_flex/>
660                     <params/>
661                     <ipmi_sensor/>
662                     <data_type>0</data_type>
663                     <authtype>0</authtype>
664                     <username/>
665                     <password/>
666                     <publickey/>
667                     <privatekey/>
668                     <port/>
669                     <description/>
670                     <inventory_link>0</inventory_link>
671                     <applications>
672                         <application>
673                             <name>ThreadStatistics</name>
674                         </application>
675                     </applications>
676                     <valuemap/>
677                     <logtimefmt/>
678                 </item>
679                 <item>
680                     <name>http-8080线程总计</name>
681                     <type>16</type>
682                     <snmp_community/>
683                     <multiplier>0</multiplier>
684                     <snmp_oid/>
685                     <key>jmx[&quot;java.lang:type=Threading&quot;,&quot;TotalStartedThreadCount&quot;]</key>
686                     <delay>30</delay>
687                     <history>90</history>
688                     <trends>365</trends>
689                     <status>0</status>
690                     <value_type>3</value_type>
691                     <allowed_hosts/>
692                     <units/>
693                     <delta>0</delta>
694                     <snmpv3_contextname/>
695                     <snmpv3_securityname/>
696                     <snmpv3_securitylevel>0</snmpv3_securitylevel>
697                     <snmpv3_authprotocol>0</snmpv3_authprotocol>
698                     <snmpv3_authpassphrase/>
699                     <snmpv3_privprotocol>0</snmpv3_privprotocol>
700                     <snmpv3_privpassphrase/>
701                     <formula>1</formula>
702                     <delay_flex/>
703                     <params/>
704                     <ipmi_sensor/>
705                     <data_type>0</data_type>
706                     <authtype>0</authtype>
707                     <username/>
708                     <password/>
709                     <publickey/>
710                     <privatekey/>
711                     <port/>
712                     <description/>
713                     <inventory_link>0</inventory_link>
714                     <applications>
715                         <application>
716                             <name>ThreadStatistics</name>
717                         </application>
718                     </applications>
719                     <valuemap/>
720                     <logtimefmt/>
721                 </item>
722             </items>
723             <discovery_rules/>
724             <macros/>
725             <templates/>
726             <screens/>
727         </template>
728     </templates>
729     <graphs>
730         <graph>
731             <name>会话状态</name>
732             <width>900</width>
733             <height>200</height>
734             <yaxismin>0.0000</yaxismin>
735             <yaxismax>100.0000</yaxismax>
736             <show_work_period>1</show_work_period>
737             <show_triggers>1</show_triggers>
738             <type>0</type>
739             <show_legend>1</show_legend>
740             <show_3d>0</show_3d>
741             <percent_left>0.0000</percent_left>
742             <percent_right>0.0000</percent_right>
743             <ymin_type_1>0</ymin_type_1>
744             <ymax_type_1>0</ymax_type_1>
745             <ymin_item_1>0</ymin_item_1>
746             <ymax_item_1>0</ymax_item_1>
747             <graph_items>
748                 <graph_item>
749                     <sortorder>0</sortorder>
750                     <drawtype>0</drawtype>
751                     <color>C80000</color>
752                     <yaxisside>0</yaxisside>
753                     <calc_fnc>2</calc_fnc>
754                     <type>0</type>
755                     <item>
756                         <host>Tomcat JMX</host>
757                         <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,maxActive]</key>
758                     </item>
759                 </graph_item>
760                 <graph_item>
761                     <sortorder>1</sortorder>
762                     <drawtype>0</drawtype>
763                     <color>00C800</color>
764                     <yaxisside>0</yaxisside>
765                     <calc_fnc>2</calc_fnc>
766                     <type>0</type>
767                     <item>
768                         <host>Tomcat JMX</host>
769                         <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,activeSessions]</key>
770                     </item>
771                 </graph_item>
772                 <graph_item>
773                     <sortorder>2</sortorder>
774                     <drawtype>0</drawtype>
775                     <color>0000C8</color>
776                     <yaxisside>0</yaxisside>
777                     <calc_fnc>2</calc_fnc>
778                     <type>0</type>
779                     <item>
780                         <host>Tomcat JMX</host>
781                         <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,sessionCounter]</key>
782                     </item>
783                 </graph_item>
784                 <graph_item>
785                     <sortorder>3</sortorder>
786                     <drawtype>0</drawtype>
787                     <color>C800C8</color>
788                     <yaxisside>0</yaxisside>
789                     <calc_fnc>2</calc_fnc>
790                     <type>0</type>
791                     <item>
792                         <host>Tomcat JMX</host>
793                         <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,rejectedSessions]</key>
794                     </item>
795                 </graph_item>
796                 <graph_item>
797                     <sortorder>4</sortorder>
798                     <drawtype>0</drawtype>
799                     <color>00C8C8</color>
800                     <yaxisside>0</yaxisside>
801                     <calc_fnc>2</calc_fnc>
802                     <type>0</type>
803                     <item>
804                         <host>Tomcat JMX</host>
805                         <key>jmx[&quot;Catalina:type=Manager,context=/,host=localhost&quot;,maxActiveSessions]</key>
806                     </item>
807                 </graph_item>
808             </graph_items>
809         </graph>
810         <graph>
811             <name>堆内存状态</name>
812             <width>900</width>
813             <height>200</height>
814             <yaxismin>0.0000</yaxismin>
815             <yaxismax>100.0000</yaxismax>
816             <show_work_period>1</show_work_period>
817             <show_triggers>1</show_triggers>
818             <type>0</type>
819             <show_legend>1</show_legend>
820             <show_3d>0</show_3d>
821             <percent_left>0.0000</percent_left>
822             <percent_right>0.0000</percent_right>
823             <ymin_type_1>0</ymin_type_1>
824             <ymax_type_1>0</ymax_type_1>
825             <ymin_item_1>0</ymin_item_1>
826             <ymax_item_1>0</ymax_item_1>
827             <graph_items>
828                 <graph_item>
829                     <sortorder>0</sortorder>
830                     <drawtype>0</drawtype>
831                     <color>C80000</color>
832                     <yaxisside>0</yaxisside>
833                     <calc_fnc>2</calc_fnc>
834                     <type>0</type>
835                     <item>
836                         <host>Tomcat JMX</host>
837                         <key>jmx[&quot;java.lang:type=Memory&quot;,&quot;HeapMemoryUsage.used&quot;]</key>
838                     </item>
839                 </graph_item>
840                 <graph_item>
841                     <sortorder>1</sortorder>
842                     <drawtype>0</drawtype>
843                     <color>00C800</color>
844                     <yaxisside>0</yaxisside>
845                     <calc_fnc>2</calc_fnc>
846                     <type>0</type>
847                     <item>
848                         <host>Tomcat JMX</host>
849                         <key>jmx[&quot;java.lang:type=Memory&quot;,&quot;HeapMemoryUsage.committed&quot;]</key>
850                     </item>
851                 </graph_item>
852                 <graph_item>
853                     <sortorder>2</sortorder>
854                     <drawtype>0</drawtype>
855                     <color>0000C8</color>
856                     <yaxisside>0</yaxisside>
857                     <calc_fnc>2</calc_fnc>
858                     <type>0</type>
859                     <item>
860                         <host>Tomcat JMX</host>
861                         <key>jmx[&quot;java.lang:type=Memory&quot;,&quot;HeapMemoryUsage.max&quot;]</key>
862                     </item>
863                 </graph_item>
864             </graph_items>
865         </graph>
866         <graph>
867             <name>类状态</name>
868             <width>900</width>
869             <height>200</height>
870             <yaxismin>0.0000</yaxismin>
871             <yaxismax>100.0000</yaxismax>
872             <show_work_period>1</show_work_period>
873             <show_triggers>1</show_triggers>
874             <type>0</type>
875             <show_legend>1</show_legend>
876             <show_3d>0</show_3d>
877             <percent_left>0.0000</percent_left>
878             <percent_right>0.0000</percent_right>
879             <ymin_type_1>0</ymin_type_1>
880             <ymax_type_1>0</ymax_type_1>
881             <ymin_item_1>0</ymin_item_1>
882             <ymax_item_1>0</ymax_item_1>
883             <graph_items>
884                 <graph_item>
885                     <sortorder>0</sortorder>
886                     <drawtype>0</drawtype>
887                     <color>C80000</color>
888                     <yaxisside>0</yaxisside>
889                     <calc_fnc>2</calc_fnc>
890                     <type>0</type>
891                     <item>
892                         <host>Tomcat JMX</host>
893                         <key>jmx[&quot;java.lang:type=ClassLoading&quot;,&quot;LoadedClassCount&quot;]</key>
894                     </item>
895                 </graph_item>
896                 <graph_item>
897                     <sortorder>1</sortorder>
898                     <drawtype>0</drawtype>
899                     <color>00C800</color>
900                     <yaxisside>0</yaxisside>
901                     <calc_fnc>2</calc_fnc>
902                     <type>0</type>
903                     <item>
904                         <host>Tomcat JMX</host>
905                         <key>jmx[&quot;java.lang:type=ClassLoading&quot;,&quot;UnloadedClassCount&quot;]</key>
906                     </item>
907                 </graph_item>
908                 <graph_item>
909                     <sortorder>2</sortorder>
910                     <drawtype>0</drawtype>
911                     <color>0000C8</color>
912                     <yaxisside>0</yaxisside>
913                     <calc_fnc>2</calc_fnc>
914                     <type>0</type>
915                     <item>
916                         <host>Tomcat JMX</host>
917                         <key>jmx[&quot;java.lang:type=ClassLoading&quot;,&quot;TotalLoadedClassCount&quot;]</key>
918                     </item>
919                 </graph_item>
920             </graph_items>
921         </graph>
922         <graph>
923             <name>线程状态</name>
924             <width>900</width>
925             <height>200</height>
926             <yaxismin>0.0000</yaxismin>
927             <yaxismax>100.0000</yaxismax>
928             <show_work_period>1</show_work_period>
929             <show_triggers>1</show_triggers>
930             <type>0</type>
931             <show_legend>1</show_legend>
932             <show_3d>0</show_3d>
933             <percent_left>0.0000</percent_left>
934             <percent_right>0.0000</percent_right>
935             <ymin_type_1>0</ymin_type_1>
936             <ymax_type_1>0</ymax_type_1>
937             <ymin_item_1>0</ymin_item_1>
938             <ymax_item_1>0</ymax_item_1>
939             <graph_items>
940                 <graph_item>
941                     <sortorder>0</sortorder>
942                     <drawtype>0</drawtype>
943                     <color>C80000</color>
944                     <yaxisside>0</yaxisside>
945                     <calc_fnc>2</calc_fnc>
946                     <type>0</type>
947                     <item>
948                         <host>Tomcat JMX</host>
949                         <key>jmx[&quot;java.lang:type=Threading&quot;,&quot;ThreadCount&quot;]</key>
950                     </item>
951                 </graph_item>
952                 <graph_item>
953                     <sortorder>1</sortorder>
954                     <drawtype>0</drawtype>
955                     <color>00C800</color>
956                     <yaxisside>0</yaxisside>
957                     <calc_fnc>2</calc_fnc>
958                     <type>0</type>
959                     <item>
960                         <host>Tomcat JMX</host>
961                         <key>jmx[&quot;java.lang:type=Threading&quot;,&quot;PeakThreadCount&quot;]</key>
962                     </item>
963                 </graph_item>
964                 <graph_item>
965                     <sortorder>2</sortorder>
966                     <drawtype>0</drawtype>
967                     <color>0000C8</color>
968                     <yaxisside>0</yaxisside>
969                     <calc_fnc>2</calc_fnc>
970                     <type>0</type>
971                     <item>
972                         <host>Tomcat JMX</host>
973                         <key>jmx[&quot;java.lang:type=Threading&quot;,&quot;TotalStartedThreadCount&quot;]</key>
974                     </item>
975                 </graph_item>
976             </graph_items>
977         </graph>
978     </graphs>
979 </zabbix_export>

图形化添加:

1.1.4 效果展示

原文地址:https://www.cnblogs.com/yanshicheng/p/10360105.html

时间: 2024-10-20 15:37:46

Zabbix监控记录的相关文章

Zabbix监控记录linux服务器近期的登录情况

通过zabbix自定义Items来监控服务器半年内的登录次数信息.开始配置之前,需要编写脚本,用于获取服务器的登录情况,脚本如下: [[email protected] 09:14 AM ~ 1119]# cat logon_count.sh  #!/bin/bash # author: hm  email: [email protected] # system login count option=$1 count1=0 count3=0 count6=0 total0=$(last | gr

分布式监控系统Zabbix-3.0.3-完整安装记录(4)-解决zabbix监控图中出现中文乱码问题

之前部署了Zabbix-3.0.3监控系统,在安装数据库时已经将zabbix库设置了utf-8字符. 首先确定zabbix开启了中文支持功能:登录到zabbix服务器的数据目录下(前面部署的zabbix数据目录是/data/www/zabbix),打开 locales.inc.php文件[[email protected] include]# pwd/data/www/zabbix/include[[email protected] include]# vim locales.inc.php 然

Zabbix监控之一----zabbix基础和安装

一.Zabbix基本概念 1.zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.它能监视各种网络参数,保证服务器系统的安全运营:并提供柔软的通知机制以让系统管理员快速定位/解决存在的各种问题. zabbix由2部分构成,zabbixserver与zabbix agent. 1.Zabbix Server:部署在主控机,通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,负责接收Agent发送报告信息的核心组件

Windows zabbix监控远程进程实现机制

最近负责zabbix监控部署方面的工作,需要完成本地服务端监控远程虚拟机的运行状态(CPU.打开的进程等),与大家分享下我的实现方法. (1) 首先,需要实现记录zabbix客户端的进程的批处理:zabbix_task.bat; zabbix_task.bat内容如下: @echo off chcp 65001 tasklist /v |findstr "%username%" > c:/zabbix_temp.txt  #进程路径根据个人习惯设置 pause (2) 其次,实现

Nginx服务纳入到zabbix监控

工作中有用到Nginx做负载均衡,所以想尝试一下,把Nginx服务用zabbix监控起来 记录下操作步骤,以防下次忘记 涉及的实验环境: 服务器操作系统:CentOS 7.2 zabbix版本:zabbix-2.2.5 Nginx版本:nginx-1.10.1 要做监控步骤前,先查看下当前Nginx中是否加载了--with-http_stub_status_module的模块. # /data0/nginx/sbin/nginx -V nginx version: nginx/1.10.1 bu

使用Zabbix监控Oracle数据库

Orabbix介绍 监控Oracle数据库我们需要安装第三方提供的Zabbix插件,我们先测试比较有名的Orabbix,http://www.smartmarmot.com/product/orabbix/ 从部署架构图上可以看出,orabbix是通过JDBC去连接被监控数据库的,其实不是必须在数据库主机上安装Agent,而运行orabbix的主机,可以是Zabbix Server,也可以是数据库主机和zabbix server之外的任意一台主机,为了测试方便,我们将orabbix安装在Zabb

zabbix监控之同时向多人邮件报警

zabbix做为一款监控软件,报警是必不可少的,该文章主要介绍zabbix向多人邮件报警的配置过程. zabbix邮件报警配置步骤说明: 1.  准备一个发送邮件的脚本 2.  修改zabbix配置文件中指定的脚本路径 3.关联脚本名称 4.用户设置收件邮箱与报警时间 5.配置报警触发器 6.添加多个用户,同时给多个人发邮件 7.邮件接收测试 1.准备一个发送邮件的脚本 发送邮件有很多方法,自己写脚本的话,只要遵循zabbix传参的格式即可. zabbix发送邮件传参格式:./sendmail.

利用Shell生成Zabbix监控的数字报表

我们都知道Zabbix是一个非常强大的监控工具,我们公司呢也在用Zabbix监控所有网站的状态. 最近有一个需求,就是我们需要生成一份报告,报告里要包含前一天一整天的时间节点和对应的响应时间,这样的报告用来统计网站的可用性达到了什么水准. ? Zabbix本身自带报告功能,可是都是图像的,并没有数据格式的.虽然没有提供数据格式的报表,但是Zabbix提供了一套API,可以根据需求获取对应的数据(JSON格式),于是我就写了个脚本,用来把每个监控的网址的监控数据输出到一个CSV文件中.(后续可以用

zabbix 监控特定进程

由于一些服务器上跑着一些重要程序,需要对它们进行监控,公司用的是zabbix监控,之前都是在zabbix中添加自定义脚本对特定程序进行监控,最近看了zabbix的官方文档,发现原来强大的zabbix居然能监控程序是否运行,并能监控其使用的内存大小,以下是我的实践记录: 1. 在特定机器或模板上创建新的监控项,点击Key 后面的Select 按钮,选择如下两项,一项是用来监控特定进程的数量,另一项是用来监控进程使用内存的大小. 2.以下是对squid进程的监控配置,key中的参数说明,第一个参数是