您好,登錄后才能下訂單哦!
[root@localhost handle_tomcat_status]# cat handle.sh #!/bin/sh awk '/Free memory:/{print "Free memory: " $4}' a.txt awk '/Total memory:/{print "Total memory: " $8}' a.txt awk '/Max memory:/{print "Max memory: " $12}' a.txt for n in 'Eden Space' 'Survivor Space' 'Tenured Gen' 'Code Cache' 'Compressed Class Space' 'Metaspace' do awk -F"($n)+" '/Eden Space/{ print $2}' a.txt |awk -v name="$n" -F'[(<td>)]+' '{print name ": " $5 " "$7 " "$9 " "$11}' done
html內容:
curl http://tomcat:s3cret@192.168.10.12:8080/manager/status?JSON=true
<html> <head> <style> H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;} table { width: 100%; } td.page-title { text-align: center; vertical-align: top; font-family:sans-serif,Tahoma,Arial; font-weight: bold; background: white; color: black; } td.title { text-align: left; vertical-align: top; font-family:sans-serif,Tahoma,Arial; font-style:italic; font-weight: bold; background: #D2A41C; } td.header-left { text-align: left; vertical-align: top; font-family:sans-serif,Tahoma,Arial; font-weight: bold; background: #FFDC75; } td.header-center { text-align: center; vertical-align: top; font-family:sans-serif,Tahoma,Arial; font-weight: bold; background: #FFDC75; } td.row-left { text-align: left; vertical-align: middle; font-family:sans-serif,Tahoma,Arial; color: black; } td.row-center { text-align: center; vertical-align: middle; font-family:sans-serif,Tahoma,Arial; color: black; } td.row-right { text-align: right; vertical-align: middle; font-family:sans-serif,Tahoma,Arial; color: black; } TH { text-align: center; vertical-align: top; font-family:sans-serif,Tahoma,Arial; font-weight: bold; background: #FFDC75; } TD { text-align: center; vertical-align: middle; font-family:sans-serif,Tahoma,Arial; color: black; } form { margin: 1; } form.inline { display: inline; } </style> <title>/manager</title> </head> <body bgcolor="#FFFFFF"> <table cellspacing="4" border="0"> <tr> <td colspan="2"> <a > <img border="0" alt="The Apache Software Foundation" align="left" src="/manager/p_w_picpaths/asf-logo.gif"> </a> <a > <img border="0" alt="The Tomcat Servlet/JSP Container" align="right" src="/manager/p_w_picpaths/tomcat.gif"> </a> </td> </tr> </table> <hr size="1" noshade="noshade"> <table cellspacing="4" border="0"> <tr> <td class="page-title" bordercolor="#000000" align="left" nowrap> <font size="+2">Server Status</font> </td> </tr> </table> <br> <table border="1" cellspacing="0" cellpadding="3"> <tr> <td colspan="4" class="title">Manager</td> </tr> <tr> <td class="row-left"><a href="/manager/html/list">List Applications</a></td> <td class="row-center"><a href="/manager/../docs/html-manager-howto.html">HTML Manager Help</a></td> <td class="row-center"><a href="/manager/../docs/manager-howto.html">Manager Help</a></td> <td class="row-right"><a href="/manager/status/all">Complete Server Status</a></td> </tr> </table> <br> <table border="1" cellspacing="0" cellpadding="3"> <tr> <td colspan="8" class="title">Server Information</td> </tr> <tr> <td class="header-center"><small>Tomcat Version</small></td> <td class="header-center"><small>JVM Version</small></td> <td class="header-center"><small>JVM Vendor</small></td> <td class="header-center"><small>OS Name</small></td> <td class="header-center"><small>OS Version</small></td> <td class="header-center"><small>OS Architecture</small></td> <td class="header-center"><small>Hostname</small></td> <td class="header-center"><small>IP Address</small></td> </tr> <tr> <td class="row-center"><small>Apache Tomcat/7.0.53</small></td> <td class="row-center"><small>1.8.0_91-b14</small></td> <td class="row-center"><small>Oracle Corporation</small></td> <td class="row-center"><small>Linux</small></td> <td class="row-center"><small>2.6.32-431.el6.x86_64</small></td> <td class="row-center"><small>amd64</small></td> <td class="row-center"><small>localhost</small></td> <td class="row-center"><small>127.0.0.1</small></td> </tr> </table> <br> <h2>JVM</h2><p> Free memory: 27.21 MB Total memory: 58.00 MB Max memory: 928.00 MB</p><table border="0"><thead><tr><th>Memory Pool</th><th>Type</th><th>Initial</th><th>Total</th><th>Maximum</th><th>Used</th></tr></thead><tbody><tr><td>Eden Space</td><td>Heap memory</td><td>16.00 MB</td><td>16.00 MB</td><td>256.00 MB</td><td>10.50 MB (4%)</td></tr><tr><td>Survivor Space</td><td>Heap memory</td><td>2.00 MB</td><td>2.00 MB</td><td>32.00 MB</td><td>0.82 MB (2%)</td></tr><tr><td>Tenured Gen</td><td>Heap memory</td><td>40.00 MB</td><td>40.00 MB</td><td>640.00 MB</td><td>19.45 MB (3%)</td></tr><tr><td>Code Cache</td><td>Non-heap memory</td><td>2.43 MB</td><td>6.62 MB</td><td>240.00 MB</td><td>6.49 MB (2%)</td></tr><tr><td>Compressed Class Space</td><td>Non-heap memory</td><td>0.00 MB</td><td>2.12 MB</td><td>1024.00 MB</td><td>1.95 MB (0%)</td></tr><tr><td>Metaspace</td><td>Non-heap memory</td><td>0.00 MB</td><td>18.37 MB</td><td>-0.00 MB</td><td>17.73 MB</td></tr></tbody></table><h2>"ajp-bio-8009"</h2><p> Max threads: 200 Current thread count: 0 Current thread busy: 0<br> Max processing time: 0 ms Processing time: 0.0 s Request count: 0 Error count: 0 Bytes received: 0.00 MB Bytes sent: 0.00 MB</p><table border="0"><tr><th>Stage</th><th>Time</th><th>B Sent</th><th>B Recv</th><th>Client (Forwarded)</th><th>Client (Actual)</th><th>VHost</th><th>Request</th></tr></table><p>P: Parse and prepare request S: Service F: Finishing R: Ready K: Keepalive</p><h2>"http-bio-8080"</h2><p> Max threads: 200 Current thread count: 10 Current thread busy: 1<br> Max processing time: 166 ms Processing time: 0.552 s Request count: 47 Error count: 6 Bytes received: 0.00 MB Bytes sent: 0.27 MB</p><table border="0"><tr><th>Stage</th><th>Time</th><th>B Sent</th><th>B Recv</th><th>Client (Forwarded)</th><th>Client (Actual)</th><th>VHost</th><th>Request</th></tr><tr><td><strong>S</strong></td><td>1 ms</td><td>0 KB</td><td>0 KB</td><td>192.168.10.12</td><td>192.168.10.12</td><td nowrap>192.168.10.12</td><td nowrap class="row-left">GET /manager/status?JSON=true HTTP/1.1</td></tr><tr><td><strong>R</strong></td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td></tr><tr><td><strong>R</strong></td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td></tr><tr><td><strong>R</strong></td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td></tr></table><p>P: Parse and prepare request S: Service F: Finishing R: Ready K: Keepalive</p><hr size="1" noshade="noshade"> <center><font size="-1" color="#525D76"> <em>Copyright © 1999-2014, Apache Software Foundation</em></font></center> </body> </html>
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。