easy-monitor3.0 nodejs性能监控和分析工具
创始人
2024-01-25 05:41:39
0

#easy-monitor性能监控和分析工具 Easy-Monitor 3.0 https://blog.csdn.net/qq_36791889/article/details/115420116
#git地址:https://github.com/1981430140/easy-monitor-docker-compose.git

一、easy-monitor 服务器端安装(docker-compose)

yum install git wget -y
git clone https://github.com/1981430140/easy-monitor-docker-compose.git
cd easy-monitor-docker-compose
docker-compose up -d

http://192.168.11.100:8443
帐号:admin@admin.com 密码:admin

登录后创建新应用
在这里插入图片描述
在这里插入图片描述

二、安装nodejs

cd ..
wget https://nodejs.org/download/release/v8.11.4/node-v8.11.4-linux-x64.tar.gz
tar zxvf node-v8.11.4-linux-x64.tar.gz
mkdir /data
mv node-v8.11.4-linux-x64 /data/nodejs
ln -s /data/nodejs/bin/* /usr/bin/
echo "PATH=$PATH:/data/nodejs/bin"  >> /etc/profile
source /etc/profile
node -v

三、demo 接入
3.1 安装demo

git clone https://github.com/Azure-Samples/nodejs-docs-hello-world.git
cd nodejs-docs-hello-world

3.2、安装xprofiler客户端

cd nodejs-docs-hello-world
#npm i xprofiler@1.4.0 --unsafe-perm --save --xprofiler_binary_host_mirror=https://npm.taobao.org/mirrors/xprofiler
npm install -g npm@8.19.3
npm i xprofiler --unsafe-perm --save --xprofiler_binary_host_mirror=https://npm.taobao.org/mirrors/xprofiler

配置xprofiler

require('xprofiler').start();

在这里插入图片描述
3.3 安装xtransit
3.3.1)全局安装

npm install xtransit -g

3.3.2)本项目安装()

npm install xtransit --save

配置xtransit

const xtransit = require('xtransit');
const config = {server: `ws://127.0.0.1:9090`,                 // 填写前一节中部署的 xtransit-server 地址appId: 1,                                      // 创建应用得到的应用 IDappSecret: '7f2741850877c7edff7c9c9daabd000e', // 创建应用得到的应用 Secret
};
xtransit.start(config);

在这里插入图片描述

cat > start.sh << 'EOF'
kill `ps aux|grep "node index.js"|awk '{print $2}'`
nohup node index.js &
EOF
bash start.sh

四、验证
进行控制台
在这里插入图片描述
xprofiler@1.4.0有兼容问题
在这里插入图片描述

xprofiler@2.3.0正常
在这里插入图片描述

在这里插入图片描述

在这里插入图片描述

—分界线—
xprofiler的日志默认在/tmp目录下

easy-monitory 日志入库ES的grok配置规则
日志格式
#heap日志

[2022-11-07 15:42:23.396565] [info] [heap] [20836] rss: 43163648, heap_used: 10963528, heap_available: 2187569960, heap_total: 14667776, heap_limit: 2197815296, heap_executeable: 1048576, total_physical_size: 13818304, malloced_memory: 270408, amount_of_external_allocated_memory: 3316804, new_space_size: 1048576, new_space_used: 273368, new_space_available: 757704, new_space_committed: 262480, old_space_size: 10190848, old_space_used: 7656248, old_space_available: 2353184, old_space_committed: 10190632, code_space_size: 892928, code_space_used: 814624, code_space_available: 12768, code_space_committed: 840448, map_space_size: 794624, map_space_used: 509400, map_space_available: 267712, map_space_committed: 783944, lo_space_size: 1564672, lo_space_used: 1538944, lo_space_available: 0, lo_space_committed: 1564672, read_only_space_size: 176128, read_only_space_used: 170944, read_only_space_available: 0, read_only_space_committed: 176128, new_lo_space_size: 0, new_lo_space_used: 0, new_lo_space_available: 1031072, new_lo_space_committed: 0, code_lo_space_size: 0, code_lo_space_used: 0, code_lo_space_available: 0, code_lo_space_committed: 0, 
\[%{TIMESTAMP_ISO8601:timestamp}\] \[%{LOGLEVEL:logevel}\] \[%{DATA:logtype}\] \[%{POSINT:pid}\] rss: %{NUMBER:rss}, heap_used: %{NUMBER:heap_used}, heap_available: %{NUMBER:heap_available}, heap_total: %{NUMBER:heap_total}, heap_limit: %{NUMBER:heap_limit}, heap_executeable: %{NUMBER:heap_executeable}, total_physical_size: %{NUMBER:total_physical_size}, malloced_memory: %{NUMBER:malloced_memory}, amount_of_external_allocated_memory: %{NUMBER:amount_of_external_allocated_memory}, new_space_size: %{NUMBER:new_space_size}, new_space_used: %{NUMBER:new_space_used}, new_space_available: %{NUMBER:new_space_available}, new_space_committed: %{NUMBER:new_space_committed}, old_space_size: %{NUMBER:old_space_size}, old_space_used: %{NUMBER:old_space_used}, old_space_available: %{NUMBER:old_space_available}, old_space_committed: %{NUMBER:old_space_committed}, code_space_size: %{NUMBER:code_space_size}, code_space_used: %{NUMBER:code_space_used}, code_space_available: %{NUMBER:code_space_available}, code_space_committed: %{NUMBER:code_space_committed}, map_space_size: %{NUMBER:map_space_size}, map_space_used: %{NUMBER:map_space_used}, map_space_available: %{NUMBER:map_space_available}, map_space_committed: %{NUMBER:map_space_committed}, lo_space_size: %{NUMBER:lo_space_size}, lo_space_used: %{NUMBER:lo_space_used}, lo_space_available: %{NUMBER:lo_space_available}, lo_space_committed: %{NUMBER:lo_space_committed}, read_only_space_size: %{NUMBER:read_only_space_size}, read_only_space_used: %{NUMBER:read_only_space_used}, read_only_space_available: %{NUMBER:read_only_space_available}, read_only_space_committed: %{NUMBER:read_only_space_committed}, new_lo_space_size: %{NUMBER:new_lo_space_size}, new_lo_space_used: %{NUMBER:new_lo_space_used}, new_lo_space_available: %{NUMBER:new_lo_space_available}, new_lo_space_committed: %{NUMBER:new_lo_space_committed}, code_lo_space_size: %{NUMBER:code_lo_space_size}, code_lo_space_used: %{NUMBER:code_lo_space_used}, code_lo_space_available: %{NUMBER:code_lo_space_available}, code_lo_space_committed: %{NUMBER:code_lo_space_committed},

结果

{"amount_of_external_allocated_memory": "3316804","new_space_committed": "262480","code_lo_space_committed": "0","heap_limit": "2197815296","pid": "20836","read_only_space_used": "170944","logtype": "heap","code_space_committed": "840448","code_space_size": "892928","lo_space_available": "0","old_space_committed": "10190632","lo_space_committed": "1564672","new_space_size": "1048576","heap_available": "2187569960","map_space_available": "267712","heap_total": "14667776","new_lo_space_used": "0","old_space_used": "7656248","map_space_used": "509400","code_lo_space_available": "0","old_space_available": "2353184","code_lo_space_size": "0","read_only_space_committed": "176128","read_only_space_available": "0","code_space_available": "12768","logevel": "info","new_space_available": "757704","heap_used": "10963528","heap_executeable": "1048576","read_only_space_size": "176128","new_space_used": "273368","lo_space_used": "1538944","rss": "43163648","code_space_used": "814624","new_lo_space_available": "1031072","timestamp": "2022-11-07 15:42:23.396565","malloced_memory": "270408","new_lo_space_size": "0","map_space_size": "794624","new_lo_space_committed": "0","lo_space_size": "1564672","total_physical_size": "13818304","code_lo_space_used": "0","map_space_committed": "783944","old_space_size": "10190848"
}

#gc日志

[2022-11-09 14:50:02.959052] [info] [gc] [8236] gc_time_during_last_min: 0, total: 36, scavange_duration: 0, marksweep_duration: 0
\[%{TIMESTAMP_ISO8601:timestamp}\] \[%{LOGLEVEL:logevel}\] \[%{DATA:logtype}\] \[%{POSINT:pid}\] gc_time_during_last_min: %{INT:gc_time_during_last_min}, total: %{INT:total}, scavange_duration: %{INT:scavange_duration}, marksweep_duration: %{INT:marksweep_duration}

结果

{"logtype": "gc","total": "36","scavange_duration": "0","gc_time_during_last_min": "0","logevel": "info","pid": "8236","marksweep_duration": "0","timestamp": "2022-11-09 14:50:02.959052"
}

#http日志

[2022-11-09 14:50:02.959103] [info] [http] [8236] live_http_request: 0, http_request_handled: 0, http_response_sent: 0, http_rt: 0.000000
\[%{TIMESTAMP_ISO8601:timestamp}\] \[%{LOGLEVEL:logevel}\] \[%{DATA:logtype}\] \[%{POSINT:pid}\] live_http_request: %{INT:live_http_request}, http_request_handled: %{INT:http_request_handled}, http_response_sent: %{INT:http_response_sent}, http_rt: %{INT:http_rt}

结果

{"logtype": "http","http_request_handled": "0","live_http_request": "0","http_rt": "0","logevel": "info","pid": "8236","http_response_sent": "0","timestamp": "2022-11-09 14:50:02.959103"
}

#timer日志

[2022-11-09 14:50:02.959076] [info] [timer] [8236] total_timer: 1, active_handles: 3
\[%{TIMESTAMP_ISO8601:timestamp}\] \[%{LOGLEVEL:logevel}\] \[%{DATA:logtype}\] \[%{POSINT:pid}\] total_timer: %{INT:total_timer}, active_handles: %{INT:active_handles}

结果

{"logtype": "timer","total_timer": "1","active_handles": "3","logevel": "info","pid": "8236","timestamp": "2022-11-09 14:50:02.959076"
}

#cpu日志

[2022-11-07 14:49:31.280173] [info] [other] [20836] cpu_usage(%) now: 0.000000, cpu_15: 0.133333, cpu_30: 0.066667, cpu_60: 0.050000, cpu_180: 0.044444, cpu_300: 0.086667, cpu_600: 0.085809
\[%{TIMESTAMP_ISO8601:timestamp}\] \[%{LOGLEVEL:logevel}\] \[%{DATA:logtype}\] \[%{POSINT:pid}\] cpu_usage\(%\) now: %{NUMBER:now}, cpu_15: %{NUMBER:cpu_15}, cpu_30: %{NUMBER:cpu_30}, cpu_60: %{NUMBER:cpu_60}, cpu_180: %{NUMBER:cpu_180}, cpu_300: %{NUMBER:cpu_300}, cpu_600: %{NUMBER:cpu_60}

结果

{"cpu_60": "0.050000","cpu_30": "0.066667","pid": "20836","cpu_15": "0.133333","logtype": "other","cpu_180": "0.044444","now": "0.000000","cpu_300": "0.086667","logevel": "info","timestamp": "2022-11-07 14:49:31.280173"
}

相关内容

热门资讯

喜欢穿一身黑的男生性格(喜欢穿... 今天百科达人给各位分享喜欢穿一身黑的男生性格的知识,其中也会对喜欢穿一身黑衣服的男人人好相处吗进行解...
发春是什么意思(思春和发春是什... 本篇文章极速百科给大家谈谈发春是什么意思,以及思春和发春是什么意思对应的知识点,希望对各位有所帮助,...
网络用语zl是什么意思(zl是... 今天给各位分享网络用语zl是什么意思的知识,其中也会对zl是啥意思是什么网络用语进行解释,如果能碰巧...
为什么酷狗音乐自己唱的歌不能下... 本篇文章极速百科小编给大家谈谈为什么酷狗音乐自己唱的歌不能下载到本地?,以及为什么酷狗下载的歌曲不是...
华为下载未安装的文件去哪找(华... 今天百科达人给各位分享华为下载未安装的文件去哪找的知识,其中也会对华为下载未安装的文件去哪找到进行解...
怎么往应用助手里添加应用(应用... 今天百科达人给各位分享怎么往应用助手里添加应用的知识,其中也会对应用助手怎么添加微信进行解释,如果能...
家里可以做假山养金鱼吗(假山能... 今天百科达人给各位分享家里可以做假山养金鱼吗的知识,其中也会对假山能放鱼缸里吗进行解释,如果能碰巧解...
四分五裂是什么生肖什么动物(四... 本篇文章极速百科小编给大家谈谈四分五裂是什么生肖什么动物,以及四分五裂打一生肖是什么对应的知识点,希...
一帆风顺二龙腾飞三阳开泰祝福语... 本篇文章极速百科给大家谈谈一帆风顺二龙腾飞三阳开泰祝福语,以及一帆风顺二龙腾飞三阳开泰祝福语结婚对应...
美团联名卡审核成功待激活(美团... 今天百科达人给各位分享美团联名卡审核成功待激活的知识,其中也会对美团联名卡审核未通过进行解释,如果能...