Skip to content

Commit de936e1

Browse files
authored
Merge pull request #6 from toddlerya/2.0.1
update 2.0.1
2 parents c848f4a + caefc00 commit de936e1

19 files changed

+824
-372
lines changed

assets/css/bootstrap.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/css/ns_tb.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
table.imagetable {
22
font-family: verdana,arial,sans-serif;
33
font-size:11px;
4-
color:#333333;
4+
color:#ffffff;
55
border-width: 1px;
66
border-color: #999999;
77
border-collapse: collapse;
88
}
99
table.imagetable th {
10-
background:#b5cfd2 ;
10+
background:#468847 ;
1111
border-width: 1px;
1212
padding: 8px;
1313
border-style: solid;
@@ -20,3 +20,7 @@ table.imagetable td {
2020
border-style: solid;
2121
border-color: #999999;
2222
}
23+
24+
<!-- footer -->
25+
footer{position:relative;width:100%;}
26+
footer .signature{position:absolute;right:20px;bottom:5px;color:#999;}

assets/js/bootstrap.min.js

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/dark.js

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
(function (root, factory) {
2+
if (typeof define === 'function' && define.amd) {
3+
// AMD. Register as an anonymous module.
4+
define(['exports', 'echarts'], factory);
5+
} else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
6+
// CommonJS
7+
factory(exports, require('echarts'));
8+
} else {
9+
// Browser globals
10+
factory({}, root.echarts);
11+
}
12+
}(this, function (exports, echarts) {
13+
var log = function (msg) {
14+
if (typeof console !== 'undefined') {
15+
console && console.error && console.error(msg);
16+
}
17+
};
18+
if (!echarts) {
19+
log('ECharts is not Loaded');
20+
return;
21+
}
22+
var contrastColor = '#eee';
23+
var axisCommon = function () {
24+
return {
25+
axisLine: {
26+
lineStyle: {
27+
color: contrastColor
28+
}
29+
},
30+
axisTick: {
31+
lineStyle: {
32+
color: contrastColor
33+
}
34+
},
35+
axisLabel: {
36+
textStyle: {
37+
color: contrastColor
38+
}
39+
},
40+
splitLine: {
41+
lineStyle: {
42+
type: 'dashed',
43+
color: '#aaa'
44+
}
45+
},
46+
splitArea: {
47+
areaStyle: {
48+
color: contrastColor
49+
}
50+
}
51+
};
52+
};
53+
54+
var colorPalette = ['#dd6b66','#759aa0','#e69d87','#8dc1a9','#ea7e53','#eedd78','#73a373','#73b9bc','#7289ab', '#91ca8c','#f49f42'];
55+
var theme = {
56+
color: colorPalette,
57+
backgroundColor: '#333',
58+
tooltip: {
59+
axisPointer: {
60+
lineStyle: {
61+
color: contrastColor
62+
},
63+
crossStyle: {
64+
color: contrastColor
65+
}
66+
}
67+
},
68+
legend: {
69+
textStyle: {
70+
color: contrastColor
71+
}
72+
},
73+
textStyle: {
74+
color: contrastColor
75+
},
76+
title: {
77+
textStyle: {
78+
color: contrastColor
79+
}
80+
},
81+
toolbox: {
82+
iconStyle: {
83+
normal: {
84+
borderColor: contrastColor
85+
}
86+
}
87+
},
88+
dataZoom: {
89+
textStyle: {
90+
color: contrastColor
91+
}
92+
},
93+
timeline: {
94+
lineStyle: {
95+
color: contrastColor
96+
},
97+
itemStyle: {
98+
normal: {
99+
color: colorPalette[1]
100+
}
101+
},
102+
label: {
103+
normal: {
104+
textStyle: {
105+
color: contrastColor
106+
}
107+
}
108+
},
109+
controlStyle: {
110+
normal: {
111+
color: contrastColor,
112+
borderColor: contrastColor
113+
}
114+
}
115+
},
116+
timeAxis: axisCommon(),
117+
logAxis: axisCommon(),
118+
valueAxis: axisCommon(),
119+
categoryAxis: axisCommon(),
120+
121+
line: {
122+
symbol: 'circle'
123+
},
124+
graph: {
125+
color: colorPalette
126+
},
127+
gauge: {
128+
title: {
129+
textStyle: {
130+
color: contrastColor
131+
}
132+
}
133+
},
134+
candlestick: {
135+
itemStyle: {
136+
normal: {
137+
color: '#FD1050',
138+
color0: '#0CF49B',
139+
borderColor: '#FD1050',
140+
borderColor0: '#0CF49B'
141+
}
142+
}
143+
}
144+
};
145+
theme.categoryAxis.splitLine.show = false;
146+
echarts.registerTheme('dark', theme);
147+
}));

assets/picture/NebulaSolarDash.gif

-738 KB
Loading
5.48 MB
Loading

conf/ns.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
[server]
22
; 服务端IP
3-
ip = 192.168.233.128
3+
ip = 172.16.111.171
44
; 服务端端口号
55
port = 8081
66
debug = True
77
;报警信息阈值,百分比
88
;举例:
99
;cpu_yellow = 80,代表cpu使用率达到80%即提示使用黄色标示
10-
;cpu_red = 95,代表cpu使用率达到95%即提示使用红色标示
10+
;cpu_red = 95,代表cpu使用率达到95%即提示使用黄色标示
1111
mem_yellow = 80
1212
mem_red = 95
1313
cpu_yellow = 80
1414
cpu_red = 95
1515

1616
[agent]
1717
; 客户端采集数据间隔时间, 单位是s
18-
interval = 2
18+
interval = 60
1919
install_path = /home/RunTimeNSDash
2020
;所有需要监控的节点的ip,以英文逗号分隔
2121
[all_agent_ip]
22-
ips = 192.168.233.128
22+
ips = 172.16.111.164,172.16.111.166,172.16.111.167,172.16.111.168,172.16.111.171
23+

init_db.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def init_ns_base_tb(self):
2222
' CAPTURETIME INTEGER NOT NULL,\n'
2323
' CPU TEXT NOT NULL,\n'
2424
' MEM TEXT NOT NULL,\n'
25+
' SWAP TEXT NOT NULL,\n'
2526
' OSNAME TEXT NOT NULL,\n'
2627
' KERNEL TEXT NOT NULL,\n'
2728
' UPTIME TEXT NOT NULL\n'
@@ -42,7 +43,12 @@ def init_ns_cpu_tb(self):
4243
' HOSTNAME TEXT NOT NULL,\n'
4344
' IP TEXT NOT NULL,\n'
4445
' CAPTURETIME INTEGER NOT NULL,\n'
45-
' CPU_USAGE INTEGER NOT NULL,\n'
46+
' USER_CPU INTEGER NOT NULL,\n'
47+
' NICE_CPU INTEGER NOT NULL,\n'
48+
' SYSTEM_CPU INTEGER NOT NULL,\n'
49+
' IOWAIT_CPU INTEGER NOT NULL,\n'
50+
' IDLE_CPU INTEGER NOT NULL,\n'
51+
' USAGE_CPU INTEGER NOT NULL,\n'
4652
' LOAD_AVG INTEGER NOT NULL\n'
4753
' )\n'
4854
' ')
@@ -56,11 +62,12 @@ def init_ns_mem_tb(self):
5662
' HOSTNAME TEXT NOT NULL,\n'
5763
' IP TEXT NOT NULL,\n'
5864
' CAPTURETIME INTEGER NOT NULL,\n'
59-
' MEM_ALL INTEGER NOT NULL,\n'
65+
' MEM_TOTAL INTEGER NOT NULL,\n'
6066
' MEM_USAGE INTEGER NOT NULL,\n'
6167
' MEM_FREE INTEGER NOT NULL,\n'
62-
' MEM_CACHED INTEGER NOT NULL,\n'
63-
' MEM_BUFFERS INTEGER NOT NULL,\n'
68+
' SWAP_TOTAL INTEGER NOT NULL,\n'
69+
' SWAP_USED INTEGER NOT NULL,\n'
70+
' SWAP_FREE INTEGER NOT NULL,\n'
6471
' MEM_PERCENT INTEGER NOT NULL\n'
6572
' )\n'
6673
' ')
@@ -75,9 +82,7 @@ def init_ns_disk_tb(self):
7582
' IP TEXT NOT NULL,\n'
7683
' CAPTURETIME INTEGER NOT NULL,\n'
7784
' DISK TEXT NOT NULL,\n'
78-
' DISK_IO TEXT NOT NULL,\n'
79-
' DISK_READ INTEGER NOT NULL,\n'
80-
' DISK_WRITE INTEGER NOT NULL\n'
85+
' DISK_IO TEXT NOT NULL\n'
8186
' )\n'
8287
' ')
8388
self.cur.execute(init_sql)

lib/common_lib.py

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import sys
1717
import time
1818
import datetime
19-
import urllib2
2019

2120

2221
class ColorPrint:
@@ -60,38 +59,13 @@ def __init__(self):
6059
def read_conf(self, ini_file):
6160
self.cfg.read(ini_file)
6261

63-
def get_all_sections(self):
64-
try:
65-
sec_res = self.cfg.sections()
66-
return sec_res
67-
except BaseException, e:
68-
raise e
69-
7062
def get_conf_item(self, cm='conf_module', ci='conf_item'):
7163
try:
7264
return self.cfg.get(cm, ci)
7365
except BaseException, e:
7466
raise e
7567

7668

77-
def get_conf_pat(ini_file, module, ci='conf_item'):
78-
try:
79-
lc = LoadConf()
80-
lc.read_conf(ini_file)
81-
return lc.get_conf_item(module, ci)
82-
except Exception, e:
83-
raise e
84-
85-
86-
def get_all_section(ini_file):
87-
try:
88-
lc = LoadConf()
89-
lc.read_conf(ini_file)
90-
return lc.get_all_sections()
91-
except Exception, e:
92-
raise e
93-
94-
9569
class WriteLog():
9670
def __init__(self, log_filename):
9771
# 记录程序运行日志到日志文件
@@ -174,6 +148,15 @@ def get_files_path(path, suffix):
174148
raise e
175149

176150

151+
def get_conf_pat(ini_file, module, ci='conf_item'):
152+
try:
153+
lc = LoadConf()
154+
lc.read_conf(ini_file)
155+
return lc.get_conf_item(module, ci)
156+
except Exception, e:
157+
raise e
158+
159+
177160
Token = namedtuple('Token', ['type', 'value'])
178161

179162

0 commit comments

Comments
 (0)