tomcat status html内容处理 awk
[root@localhosthandle_tomcat_status]#cathandle.sh#!/bin/shawk'/Freememory:/{print"Freememory:"$4}'a.txtawk'/Totalmemory:/{print"Totalmemory:"$8}'a.txtawk'/Maxmemory:/{print"Maxmemory:"$12}'a.txtfornin'EdenSpace''SurvivorSpace''TenuredGen''CodeCache''CompressedClassSpace''Metaspace'doawk-F"($n)+"'/EdenSpace/{print$2}'a.txt|awk-vname="$n"-F'[(<td>)]+''{printname":"$5""$7""$9""$11}'done
html内容:
curlhttp://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><bodybgcolor="#FFFFFF"><tablecellspacing="4"border="0"><tr><tdcolspan="2"><ahref="http://www.apache.org/"><imgborder="0"alt="TheApacheSoftwareFoundation"align="left"src="/manager/p_w_picpaths/asf-logo.gif"></a><ahref="http://tomcat.apache.org/"><imgborder="0"alt="TheTomcatServlet/JSPContainer"align="right"src="/manager/p_w_picpaths/tomcat.gif"></a></td></tr></table><hrsize="1"noshade="noshade"><tablecellspacing="4"border="0"><tr><tdclass="page-title"bordercolor="#000000"align="left"nowrap><fontsize="+2">ServerStatus</font></td></tr></table><br><tableborder="1"cellspacing="0"cellpadding="3"><tr><tdcolspan="4"class="title">Manager</td></tr><tr><tdclass="row-left"><ahref="/manager/html/list">ListApplications</a></td><tdclass="row-center"><ahref="/manager/../docs/html-manager-howto.html">HTMLManagerHelp</a></td><tdclass="row-center"><ahref="/manager/../docs/manager-howto.html">ManagerHelp</a></td><tdclass="row-right"><ahref="/manager/status/all">CompleteServerStatus</a></td></tr></table><br><tableborder="1"cellspacing="0"cellpadding="3"><tr><tdcolspan="8"class="title">ServerInformation</td></tr><tr><tdclass="header-center"><small>TomcatVersion</small></td><tdclass="header-center"><small>JVMVersion</small></td><tdclass="header-center"><small>JVMVendor</small></td><tdclass="header-center"><small>OSName</small></td><tdclass="header-center"><small>OSVersion</small></td><tdclass="header-center"><small>OSArchitecture</small></td><tdclass="header-center"><small>Hostname</small></td><tdclass="header-center"><small>IPAddress</small></td></tr><tr><tdclass="row-center"><small>ApacheTomcat/7.0.53</small></td><tdclass="row-center"><small>1.8.0_91-b14</small></td><tdclass="row-center"><small>OracleCorporation</small></td><tdclass="row-center"><small>Linux</small></td><tdclass="row-center"><small>2.6.32-431.el6.x86_64</small></td><tdclass="row-center"><small>amd64</small></td><tdclass="row-center"><small>localhost</small></td><tdclass="row-center"><small>127.0.0.1</small></td></tr></table><br><h2>JVM</h2><p>Freememory:27.21MBTotalmemory:58.00MBMaxmemory:928.00MB</p><tableborder="0"><thead><tr><th>MemoryPool</th><th>Type</th><th>Initial</th><th>Total</th><th>Maximum</th><th>Used</th></tr></thead><tbody><tr><td>EdenSpace</td><td>Heapmemory</td><td>16.00MB</td><td>16.00MB</td><td>256.00MB</td><td>10.50MB(4%)</td></tr><tr><td>SurvivorSpace</td><td>Heapmemory</td><td>2.00MB</td><td>2.00MB</td><td>32.00MB</td><td>0.82MB(2%)</td></tr><tr><td>TenuredGen</td><td>Heapmemory</td><td>40.00MB</td><td>40.00MB</td><td>640.00MB</td><td>19.45MB(3%)</td></tr><tr><td>CodeCache</td><td>Non-heapmemory</td><td>2.43MB</td><td>6.62MB</td><td>240.00MB</td><td>6.49MB(2%)</td></tr><tr><td>CompressedClassSpace</td><td>Non-heapmemory</td><td>0.00MB</td><td>2.12MB</td><td>1024.00MB</td><td>1.95MB(0%)</td></tr><tr><td>Metaspace</td><td>Non-heapmemory</td><td>0.00MB</td><td>18.37MB</td><td>-0.00MB</td><td>17.73MB</td></tr></tbody></table><h2>"ajp-bio-8009"</h2><p>Maxthreads:200Currentthreadcount:0Currentthreadbusy:0<br>Maxprocessingtime:0msProcessingtime:0.0sRequestcount:0Errorcount:0Bytesreceived:0.00MBBytessent:0.00MB</p><tableborder="0"><tr><th>Stage</th><th>Time</th><th>BSent</th><th>BRecv</th><th>Client(Forwarded)</th><th>Client(Actual)</th><th>VHost</th><th>Request</th></tr></table><p>P:ParseandpreparerequestS:ServiceF:FinishingR:ReadyK:Keepalive</p><h2>"http-bio-8080"</h2><p>Maxthreads:200Currentthreadcount:10Currentthreadbusy:1<br>Maxprocessingtime:166msProcessingtime:0.552sRequestcount:47Errorcount:6Bytesreceived:0.00MBBytessent:0.27MB</p><tableborder="0"><tr><th>Stage</th><th>Time</th><th>BSent</th><th>BRecv</th><th>Client(Forwarded)</th><th>Client(Actual)</th><th>VHost</th><th>Request</th></tr><tr><td><strong>S</strong></td><td>1ms</td><td>0KB</td><td>0KB</td><td>192.168.10.12</td><td>192.168.10.12</td><tdnowrap>192.168.10.12</td><tdnowrapclass="row-left">GET/manager/status?JSON=trueHTTP/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:ParseandpreparerequestS:ServiceF:FinishingR:ReadyK:Keepalive</p><hrsize="1"noshade="noshade"><center><fontsize="-1"color="#525D76"><em>Copyright©1999-2014,ApacheSoftwareFoundation</em></font></center></body></html>
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。