文章目录

hmmzhtx

记录精彩的程序人生

X

阿里巴巴 监控信息展示 简单使用配置

本文地址:http://www.myylm.com/druidview

效果图

配置web.xml

<!-- druid 数据源,用于采集 web-jdbc 关联监控的数据 -->
    <filter>
        <filter-name>DruidWebStatFilter</filter-name>
        <filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
        <init-param>
            <param-name>exclusions</param-name>
            <param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*</param-value>
        </init-param>
        <init-param>
            <param-name>profileEnable</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>DruidWebStatFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
<!--展示Druid的统计信息-->
    <servlet>
        <servlet-name>DruidStatView</servlet-name>
        <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
        
        <init-param>
            <!-- 允许清空统计数据 -->
            <param-name>resetEnable</param-name>
            <param-value>false</param-value>
        </init-param>

        <init-param>
            <!-- 用户名 -->
            <param-name>loginUsername</param-name>
            <param-value>druid</param-value>
        </init-param>
        
        <init-param>
            <!-- 密码 -->
            <param-name>loginPassword</param-name>
            <param-value>druid</param-value>
        </init-param>

        <!--允许访问的IP-->
        <init-param>
            <param-name>allow</param-name>
            <param-value>128.242.127.1/24,128.242.128.1</param-value>
        </init-param>
        <!--禁止访问的IP,优先级:deny 》allow-->
        <init-param>
            <param-name>deny</param-name>
            <param-value>128.242.127.4</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>DruidStatView</servlet-name>
        <!--访问路径eg:http://localhost:8080/ssj/druid/index.html -->
        <url-pattern>/druid/*</url-pattern>
    </servlet-mapping>