Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
leaf-hlcm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hlcm
leaf-hlcm
Commits
d1e9b7b1
Commit
d1e9b7b1
authored
Dec 13, 2024
by
38823
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
建机:系统监控开发
parent
a5ada5d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
0 deletions
+78
-0
pom.xml
pom.xml
+8
-0
sys_function_query.lwm
src/main/webapp/WEB-INF/classes/tst/sys_function_query.lwm
+17
-0
sigar-1.6.4.jar
src/main/webapp/WEB-INF/lib/sigar-1.6.4.jar
+0
-0
check_sys_cpu.lsc
src/main/webapp/modules/tst/check_sys_cpu.lsc
+39
-0
check_sys_status.lsc
src/main/webapp/modules/tst/check_sys_status.lsc
+14
-0
No files found.
pom.xml
View file @
d1e9b7b1
...
...
@@ -173,6 +173,14 @@
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/gson-2.6.2.jar
</systemPath>
</dependency>
<dependency>
<groupId>
com.sigar
</groupId>
<artifactId>
sys-sigar
</artifactId>
<version>
1.6.4
</version>
<scope>
system
</scope>
<systemPath>
${project.basedir}/src/main/webapp/WEB-INF/lib/sigar-1.6.4.jar
</systemPath>
</dependency>
<!--end -->
...
...
src/main/webapp/WEB-INF/classes/tst/sys_function_query.lwm
0 → 100644
View file @
d1e9b7b1
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: Administrator
$Date: 2019-7-26 下午1:50:02
$Revision: 1.0
$Purpose:
-->
<bm:model
xmlns:bm=
"http://www.leaf-framework.org/schema/bm"
accessControlMode=
"false"
>
<bm:operations>
<bm:operation
name=
"query"
>
<bm:query-sql>
<![CDATA[select count(*) count from sys_function]]>
</bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field
name=
"count"
/>
</bm:fields>
</bm:model>
src/main/webapp/WEB-INF/lib/sigar-1.6.4.jar
0 → 100644
View file @
d1e9b7b1
File added
src/main/webapp/modules/tst/check_sys_cpu.lsc
0 → 100644
View file @
d1e9b7b1
<?xml version="1.0" encoding="UTF-8"?>
<a:service
xmlns:p=
"uncertain.proc"
xmlns:a=
"http://www.leaf-framework.org/application"
xmlns:s=
"leaf.plugin.script"
trace=
"true"
>
<a:init-procedure>
<s:server-script>
<![CDATA[
main();
function main() {
var cpu_rate = new String();
for (var j = 0;j < 10;j++) {
try {
java.lang.Thread.sleep(1000);
cpu_rate = cpu_rate + "," + cpu();
} catch (e) {
println(e);
}
}
$ctx.parameter.cpu_rate = cpu_rate.substring(1);
}
function cpu() {
var sigar = new org.hyperic.sigar.Sigar();
var infos = sigar.getCpuInfoList();
var cpuList = null;
cpuList = sigar.getCpuPercList();
var total = 0;
for (var i = 0;i < infos.length;i++) { // 不管是单块CPU还是多CPU都适用
var info = infos[i];
total = cpuList[i].getCombined() + total;
}
total = Math.round(1000 * total / infos.length) / 1000;
total = total*100;
total = total.toFixed(2);
return total+'%';
}
]]>
</s:server-script>
</a:init-procedure>
<a:service-output
output=
"/parameter"
/>
</a:service>
src/main/webapp/modules/tst/check_sys_status.lsc
0 → 100644
View file @
d1e9b7b1
<?xml version="1.0" encoding="UTF-8"?>
<a:service
xmlns:p=
"uncertain.proc"
xmlns:a=
"http://www.leaf-framework.org/application"
xmlns:s=
"leaf.plugin.script"
trace=
"true"
>
<a:init-procedure>
<s:server-script>
<![CDATA[
function main() {
var data = $bm('tst.sys_function_query').queryAsMap().getChildren();
$ctx.parameter.count = data[0].count;
}
main();
]]>
</s:server-script>
</a:init-procedure>
<a:service-output
output=
"/parameter"
/>
</a:service>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment