├── db-service-monitoring
├── static
│ ├── .gitkeep
│ └── favicon.ico
├── 说明
├── test
│ ├── unit
│ │ ├── setup.js
│ │ ├── .eslintrc
│ │ ├── specs
│ │ │ └── HelloWorld.spec.js
│ │ └── jest.conf.js
│ └── e2e
│ │ ├── specs
│ │ └── test.js
│ │ ├── custom-assertions
│ │ └── elementCount.js
│ │ ├── nightwatch.conf.js
│ │ └── runner.js
├── config
│ ├── prod.env.js
│ ├── test.env.js
│ ├── dev.env.js
│ └── index.js
├── build
│ ├── logo.png
│ ├── vue-loader.conf.js
│ ├── build.js
│ ├── check-versions.js
│ ├── webpack.base.conf.js
│ ├── utils.js
│ ├── webpack.dev.conf.js
│ └── webpack.prod.conf.js
├── src
│ ├── assets
│ │ ├── logo.png
│ │ ├── img
│ │ │ ├── logo.jpg
│ │ │ └── user.png
│ │ ├── js
│ │ │ └── overall_js.js
│ │ └── data.json
│ ├── App.vue
│ ├── main.js
│ ├── axios
│ │ ├── axiosUrl.js
│ │ └── axios.js
│ ├── router
│ │ └── index.js
│ └── components
│ │ ├── Login.vue
│ │ └── serverRelease
│ │ └── ServerDetails.vue
├── .editorconfig
├── .gitignore
├── .postcssrc.js
├── index.html
├── .babelrc
├── README.md
├── .eslintrc.js
└── package.json
├── linux-install-shell
├── OneClick_StartAndStop
│ ├── task.sh
│ ├── xx.txt
│ ├── test.sh
│ ├── acme_startAll.sh
│ ├── faBanShellByACME.sh
│ ├── acme_killAll.sh
│ └── getServerData.sh
└── OneClick_StartAndStop.zip
├── image
├── faban.png
├── longin.png
├── jincheng.png
├── serverinfo.png
└── yinyongfuwuqi.png
├── .idea
├── vcs.xml
├── encodings.xml
├── kotlinc.xml
├── artifacts
│ ├── demo_war.xml
│ └── demo_war_exploded.xml
├── modules.xml
├── libraries
│ ├── Maven__junit_junit_4_12.xml
│ ├── Maven__org_ow2_asm_asm_5_0_4.xml
│ ├── Maven__org_mongodb_bson_3_6_3.xml
│ ├── Maven__org_yaml_snakeyaml_1_19.xml
│ ├── Maven__net_minidev_json_smart_2_3.xml
│ ├── Maven__org_objenesis_objenesis_2_6.xml
│ ├── Maven__net_sf_ezmorph_ezmorph_1_0_6.xml
│ ├── Maven__org_slf4j_slf4j_api_1_7_25.xml
│ ├── Maven__com_fasterxml_classmate_1_3_4.xml
│ ├── Maven__commons_lang_commons_lang_2_5.xml
│ ├── Maven__net_sf_json_lib_json_lib_jdk15_2_4.xml
│ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml
│ ├── Maven__net_bytebuddy_byte_buddy_1_7_11.xml
│ ├── Maven__org_assertj_assertj_core_3_9_1.xml
│ ├── Maven__org_slf4j_jul_to_slf4j_1_7_25.xml
│ ├── Maven__org_xmlunit_xmlunit_core_2_5_1.xml
│ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml
│ ├── Maven__net_minidev_accessors_smart_1_2.xml
│ ├── Maven__org_mockito_mockito_core_2_15_0.xml
│ ├── Maven__ch_qos_logback_logback_core_1_2_3.xml
│ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml
│ ├── Maven__org_mongodb_mongodb_driver_3_6_3.xml
│ ├── Maven__org_hamcrest_hamcrest_library_1_3.xml
│ ├── Maven__ch_qos_logback_logback_classic_1_2_3.xml
│ ├── Maven__commons_logging_commons_logging_1_1_1.xml
│ ├── Maven__net_bytebuddy_byte_buddy_agent_1_7_11.xml
│ ├── Maven__org_apache_logging_log4j_log4j_api_2_10_0.xml
│ ├── Maven__org_thymeleaf_thymeleaf_3_0_9_RELEASE.xml
│ ├── Maven__org_unbescape_unbescape_1_1_5_RELEASE.xml
│ ├── Maven__org_mongodb_mongodb_driver_core_3_6_3.xml
│ ├── Maven__org_attoparser_attoparser_2_0_4_RELEASE.xml
│ ├── Maven__commons_beanutils_commons_beanutils_1_8_0.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_9_5.xml
│ ├── Maven__org_springframework_spring_tx_5_0_6_RELEASE.xml
│ ├── Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml
│ ├── Maven__javax_annotation_javax_annotation_api_1_3_2.xml
│ ├── Maven__javax_validation_validation_api_2_0_1_Final.xml
│ ├── Maven__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_31.xml
│ ├── Maven__org_springframework_spring_aop_5_0_6_RELEASE.xml
│ ├── Maven__org_springframework_spring_jcl_5_0_6_RELEASE.xml
│ ├── Maven__org_springframework_spring_web_5_0_6_RELEASE.xml
│ ├── Maven__commons_collections_commons_collections_3_2_1.xml
│ ├── Maven__org_springframework_spring_core_5_0_6_RELEASE.xml
│ ├── Maven__org_springframework_spring_test_5_0_6_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_9_5.xml
│ ├── Maven__org_springframework_spring_beans_5_0_6_RELEASE.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_31.xml
│ ├── Maven__org_springframework_spring_webmvc_5_0_6_RELEASE.xml
│ ├── Maven__org_thymeleaf_thymeleaf_spring5_3_0_9_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_2_0_2_RELEASE.xml
│ ├── Maven__org_springframework_spring_context_5_0_6_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml
│ ├── Maven__org_springframework_spring_expression_5_0_6_RELEASE.xml
│ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_31.xml
│ ├── Maven__org_springframework_boot_spring_boot_test_2_0_2_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_5.xml
│ ├── Maven__org_hibernate_validator_hibernate_validator_6_0_9_Final.xml
│ ├── Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_5.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_2_0_2_RELEASE.xml
│ ├── Maven__org_springframework_data_spring_data_commons_2_0_7_RELEASE.xml
│ ├── Maven__org_springframework_data_spring_data_mongodb_2_0_7_RELEASE.xml
│ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_web_2_0_2_RELEASE.xml
│ ├── Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_1_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_json_2_0_2_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_test_2_0_2_RELEASE.xml
│ ├── Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_5.xml
│ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_3_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_2_0_2_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_logging_2_0_2_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_0_2_RELEASE.xml
│ ├── Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_2_RELEASE.xml
│ └── Maven__org_springframework_boot_spring_boot_starter_data_mongodb_2_0_2_RELEASE.xml
├── compiler.xml
└── misc.xml
├── service-monitoring
├── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ ├── demo
│ │ │ │ ├── EntityList
│ │ │ │ │ ├── LinuxJava.java
│ │ │ │ │ ├── LinuxMysql.java
│ │ │ │ │ ├── LinuxVertx.java
│ │ │ │ │ ├── LinuxMongod.java
│ │ │ │ │ ├── LinuxRedis.java
│ │ │ │ │ ├── ServiceCourse.java
│ │ │ │ │ └── LinuxParent.java
│ │ │ │ └── Entity
│ │ │ │ │ ├── ServerArray.java
│ │ │ │ │ ├── UnilizationRatio.java
│ │ │ │ │ ├── UserEntity.java
│ │ │ │ │ ├── ParameterList.java
│ │ │ │ │ ├── Fanban.java
│ │ │ │ │ ├── ServiceProcess.java
│ │ │ │ │ ├── ServerDetails.java
│ │ │ │ │ └── LinuxServer.java
│ │ │ │ ├── DemoApplication.java
│ │ │ │ ├── ServletInitializer.java
│ │ │ │ ├── dao
│ │ │ │ ├── ServiceProcessDao.java
│ │ │ │ ├── LinuxServerDao.java
│ │ │ │ ├── UserDao.java
│ │ │ │ └── impl
│ │ │ │ │ ├── UserDaoImpl.java
│ │ │ │ │ ├── ServiceProcessDaoImpl.java
│ │ │ │ │ └── LinuxServerDaoImpl.java
│ │ │ │ └── util
│ │ │ │ └── Util.java
│ │ └── resources
│ │ │ ├── application.properties
│ │ │ └── banner.txt
│ └── test
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── demo
│ │ └── DemoApplicationTests.java
└── pom.xml
└── readme.md
/db-service-monitoring/static/.gitkeep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/db-service-monitoring/说明:
--------------------------------------------------------------------------------
1 | //第一次从svn下载该项目完成后需要安装vue脚手架依赖,命令如下
2 | npm install
3 |
--------------------------------------------------------------------------------
/linux-install-shell/OneClick_StartAndStop/task.sh:
--------------------------------------------------------------------------------
1 | echo "xxxxxxxxxxxxxxxxxxxxx"
2 |
--------------------------------------------------------------------------------
/linux-install-shell/OneClick_StartAndStop/xx.txt:
--------------------------------------------------------------------------------
1 |
2 | OK
3 | OK
4 | OK
5 | OK
6 | OK
7 |
--------------------------------------------------------------------------------
/image/faban.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/image/faban.png
--------------------------------------------------------------------------------
/image/longin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/image/longin.png
--------------------------------------------------------------------------------
/image/jincheng.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/image/jincheng.png
--------------------------------------------------------------------------------
/image/serverinfo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/image/serverinfo.png
--------------------------------------------------------------------------------
/db-service-monitoring/test/unit/setup.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 |
3 | Vue.config.productionTip = false
4 |
--------------------------------------------------------------------------------
/image/yinyongfuwuqi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/image/yinyongfuwuqi.png
--------------------------------------------------------------------------------
/db-service-monitoring/config/prod.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | module.exports = {
3 | NODE_ENV: '"production"'
4 | }
5 |
--------------------------------------------------------------------------------
/linux-install-shell/OneClick_StartAndStop/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #*/1 * * * *
3 |
4 | echo "------------------"
5 |
--------------------------------------------------------------------------------
/db-service-monitoring/test/unit/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "env": {
3 | "jest": true
4 | },
5 | "globals": {
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/db-service-monitoring/build/logo.png
--------------------------------------------------------------------------------
/db-service-monitoring/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/db-service-monitoring/static/favicon.ico
--------------------------------------------------------------------------------
/db-service-monitoring/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/db-service-monitoring/src/assets/logo.png
--------------------------------------------------------------------------------
/db-service-monitoring/src/assets/img/logo.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/db-service-monitoring/src/assets/img/logo.jpg
--------------------------------------------------------------------------------
/db-service-monitoring/src/assets/img/user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/db-service-monitoring/src/assets/img/user.png
--------------------------------------------------------------------------------
/linux-install-shell/OneClick_StartAndStop.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/QIWEB/linuxServerMonitoring/HEAD/linux-install-shell/OneClick_StartAndStop.zip
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/EntityList/LinuxJava.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.EntityList;
2 |
3 | /**
4 | * java进程信息
5 | */
6 | public class LinuxJava extends LinuxParent{
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/EntityList/LinuxMysql.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.EntityList;
2 |
3 | /**
4 | * mysql进程信息
5 | */
6 | public class LinuxMysql extends LinuxParent {
7 | }
8 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/EntityList/LinuxVertx.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.EntityList;
2 |
3 | /**
4 | * vertx进程信息
5 | */
6 | public class LinuxVertx extends LinuxParent {
7 | }
8 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | #spring.data.mongodb.uri=mongodb://11.24.201.223:27017/hwl_test
2 | spring.data.mongodb.uri=mongodb://192.168.0.73:27017/hwl_test
3 | server.port=9999
--------------------------------------------------------------------------------
/db-service-monitoring/config/test.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const devEnv = require('./dev.env')
4 |
5 | module.exports = merge(devEnv, {
6 | NODE_ENV: '"testing"'
7 | })
8 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/EntityList/LinuxMongod.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.EntityList;
2 |
3 | /**
4 | * Mongodb进程信息
5 | */
6 | public class LinuxMongod extends LinuxParent{
7 | }
8 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/EntityList/LinuxRedis.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.EntityList;
2 |
3 |
4 | /**
5 | * redis进程信息
6 | */
7 | public class LinuxRedis extends LinuxParent {
8 | }
9 |
--------------------------------------------------------------------------------
/db-service-monitoring/config/dev.env.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const merge = require('webpack-merge')
3 | const prodEnv = require('./prod.env')
4 |
5 | module.exports = merge(prodEnv, {
6 | NODE_ENV: '"development"'
7 | })
8 |
--------------------------------------------------------------------------------
/db-service-monitoring/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/db-service-monitoring/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | /dist/
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | /test/unit/coverage/
8 | /test/e2e/reports/
9 | selenium-debug.log
10 |
11 | # Editor directories and files
12 | .idea
13 | .vscode
14 | *.suo
15 | *.ntvs*
16 | *.njsproj
17 | *.sln
18 |
--------------------------------------------------------------------------------
/db-service-monitoring/.postcssrc.js:
--------------------------------------------------------------------------------
1 | // https://github.com/michael-ciniawsky/postcss-load-config
2 |
3 | module.exports = {
4 | "plugins": {
5 | "postcss-import": {},
6 | "postcss-url": {},
7 | // to edit target browsers: use "browserslist" field in package.json
8 | "autoprefixer": {}
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/.idea/artifacts/demo_war.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | $PROJECT_DIR$/service-monitoring/target
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 | _______ _ _ _ _____ ____ _____
2 | |___ / | | | /\ | \ | |/ ____|/ __ \|_ _|
3 | / /| |__| | / \ | \| | | __| | | | | |
4 | / / | __ | / /\ \ | . ` | | |_ | | | | | |
5 | / /__| | | |/ ____ \| |\ | |__| | |__| |_| |_
6 | /_____|_| |_/_/ \_\_| \_|\_____|\___\_\_____|
7 |
8 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/assets/js/overall_js.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 定义各种变量以及全局引用配置
3 | */
4 | export default {
5 | time_count: function () { // 定时器时间间隔数
6 | return 60
7 | },
8 | serve_value_id: function () { // 服务器选择下拉框 默认值 id型
9 | return 'd907aadc08ba41199eb4bc6e7b257cf2'
10 | },
11 | serve_value_ip: function () { // 服务器选择下拉框 默认值 ip型
12 | return '11.24.201.223'
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/db-service-monitoring/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 服务器监测系统
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/db-service-monitoring/test/unit/specs/HelloWorld.spec.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import HelloWorld from '@/components/HelloWorld'
3 |
4 | describe('HelloWorld.vue', () => {
5 | it('should render correct contents', () => {
6 | const Constructor = Vue.extend(HelloWorld)
7 | const vm = new Constructor().$mount()
8 | expect(vm.$el.querySelector('.hello h1').textContent)
9 | .toEqual('Welcome to Your Vue.js App')
10 | })
11 | })
12 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/db-service-monitoring/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", {
4 | "modules": false,
5 | "targets": {
6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
7 | }
8 | }],
9 | "stage-2"
10 | ],
11 | "plugins": ["transform-vue-jsx", "transform-runtime"],
12 | "env": {
13 | "test": {
14 | "presets": ["env", "stage-2"],
15 | "plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/DemoApplication.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | //@SpringBootApplication(exclude = {MongoAutoConfiguration.class,MongoDataAutoConfiguration.class})
7 | @SpringBootApplication
8 | public class DemoApplication {
9 |
10 | public static void main(String[] args) {
11 | SpringApplication.run(DemoApplication.class, args);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__junit_junit_4_12.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mongodb_bson_3_6_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/ServletInitializer.java:
--------------------------------------------------------------------------------
1 | package com.example;
2 |
3 | import org.springframework.boot.builder.SpringApplicationBuilder;
4 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
5 |
6 | /**
7 | * Created by Sean on 2017/9/5.
8 | */
9 | public class ServletInitializer extends SpringBootServletInitializer {
10 | @Override
11 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
12 | return application.sources(DemoApplication.class);
13 | }
14 | }
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_yaml_snakeyaml_1_19.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_minidev_json_smart_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_objenesis_objenesis_2_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_sf_ezmorph_ezmorph_1_0_6.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_classmate_1_3_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_lang_commons_lang_2_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_sf_json_lib_json_lib_jdk15_2_4.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_7_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_assertj_assertj_core_3_9_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_5_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mockito_mockito_core_2_15_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mongodb_mongodb_driver_3_6_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/Entity/ServerArray.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.Entity;
2 |
3 | /**
4 | * 封装服务器基本信息返回到vue前端
5 | */
6 | public class ServerArray {
7 |
8 | //服务器唯一id值
9 | private String value;
10 | //服务器归属名
11 | private String label;
12 |
13 | public String getValue() {
14 | return value;
15 | }
16 |
17 | public void setValue(String value) {
18 | this.value = value;
19 | }
20 |
21 | public String getLabel() {
22 | return label;
23 | }
24 |
25 | public void setLabel(String label) {
26 | this.label = label;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_logging_commons_logging_1_1_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_7_11.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_10_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_thymeleaf_thymeleaf_3_0_9_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_unbescape_unbescape_1_1_5_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_mongodb_mongodb_driver_core_3_6_3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/db-service-monitoring/test/e2e/specs/test.js:
--------------------------------------------------------------------------------
1 | // For authoring Nightwatch tests, see
2 | // http://nightwatchjs.org/guide#usage
3 |
4 | module.exports = {
5 | 'default e2e tests': function (browser) {
6 | // automatically uses dev Server port from /config.index.js
7 | // default: http://localhost:8080
8 | // see nightwatch.conf.js
9 | const devServer = browser.globals.devServerURL
10 |
11 | browser
12 | .url(devServer)
13 | .waitForElementVisible('#app', 5000)
14 | .assert.elementPresent('.hello')
15 | .assert.containsText('h1', 'Welcome to Your Vue.js App')
16 | .assert.elementCount('img', 1)
17 | .end()
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_attoparser_attoparser_2_0_4_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_8_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/vue-loader.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const config = require('../config')
4 | const isProduction = process.env.NODE_ENV === 'production'
5 | const sourceMapEnabled = isProduction
6 | ? config.build.productionSourceMap
7 | : config.dev.cssSourceMap
8 |
9 | module.exports = {
10 | loaders: utils.cssLoaders({
11 | sourceMap: sourceMapEnabled,
12 | extract: isProduction
13 | }),
14 | cssSourceMap: sourceMapEnabled,
15 | cacheBusting: config.dev.cacheBusting,
16 | transformToRequire: {
17 | video: ['src', 'poster'],
18 | source: 'src',
19 | img: 'src',
20 | image: 'xlink:href'
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_9_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_tx_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_2_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/db-service-monitoring/README.md:
--------------------------------------------------------------------------------
1 | # vue-demo
2 |
3 | > vue-demo
4 |
5 | ## Build Setup
6 |
7 | ``` bash
8 | # install dependencies
9 | npm install
10 |
11 | # serve with hot reload at localhost:8080
12 | npm run dev
13 |
14 | # build for production with minification
15 | npm run build
16 |
17 | # build for production and view the bundle analyzer report
18 | npm run build --report
19 |
20 | # run unit tests
21 | npm run unit
22 |
23 | # run e2e tests
24 | npm run e2e
25 |
26 | # run all tests
27 | npm test
28 | ```
29 |
30 | For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
31 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__javax_annotation_javax_annotation_api_1_3_2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__javax_validation_validation_api_2_0_1_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_10_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_31.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_aop_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_jcl_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_web_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__commons_collections_commons_collections_3_2_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_core_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_test_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_9_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_beans_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_31.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_webmvc_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_thymeleaf_thymeleaf_spring5_3_0_9_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_context_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/dao/ServiceProcessDao.java:
--------------------------------------------------------------------------------
1 | package com.example.dao;
2 |
3 | import com.example.demo.Entity.ServiceProcess;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * 服务进程操作接口
9 | */
10 | public interface ServiceProcessDao {
11 | //新增服务进程
12 | public int saveServiceProcess(ServiceProcess serviceProcess);
13 | //获取服务进程
14 | public List getServiceProcessList(ServiceProcess serviceProcess);
15 | //更新服务进程
16 | public Long updateServiceProcess(ServiceProcess serviceProcess);
17 | //删除服务进程
18 | public Long deleteServiceProcess(ServiceProcess serviceProcess);
19 | //根据进程名获取对象
20 | public List getServiceProcessName(ServiceProcess serviceProcess);
21 | }
22 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_spring_expression_5_0_6_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_31.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_9_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_hibernate_validator_hibernate_validator_6_0_9_Final.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_9_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_data_spring_data_commons_2_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_data_spring_data_mongodb_2_0_7_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_1_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/dao/LinuxServerDao.java:
--------------------------------------------------------------------------------
1 | package com.example.dao;
2 |
3 | import com.example.demo.EntityList.ServiceCourse;
4 | import com.example.demo.Entity.LinuxServer;
5 | import com.example.demo.Entity.ServerDetails;
6 | import com.example.demo.Entity.UnilizationRatio;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Linux服务器信息操作接口
12 | */
13 | public interface LinuxServerDao {
14 | //保存服务器配置详情信息
15 | public int saveLinuxServer(LinuxServer linuxServer);
16 | //获取服务器占用率数据
17 | public UnilizationRatio getLinuxServerList(String token,String dateTime,String startTime,String finishTime);
18 | //获取服务器配置信息(处理计算后)
19 | public ServerDetails getServerDetails(String token);
20 | //获取服务器各服务进程信息
21 | public List getServiceProcess(String token,int count);
22 | }
23 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_json_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_9_5.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_0_3_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/db-service-monitoring/test/unit/jest.conf.js:
--------------------------------------------------------------------------------
1 | const path = require('path')
2 |
3 | module.exports = {
4 | rootDir: path.resolve(__dirname, '../../'),
5 | moduleFileExtensions: [
6 | 'js',
7 | 'json',
8 | 'vue'
9 | ],
10 | moduleNameMapper: {
11 | '^@/(.*)$': '/src/$1'
12 | },
13 | transform: {
14 | '^.+\\.js$': '/node_modules/babel-jest',
15 | '.*\\.(vue)$': '/node_modules/vue-jest'
16 | },
17 | testPathIgnorePatterns: [
18 | '/test/e2e'
19 | ],
20 | snapshotSerializers: ['/node_modules/jest-serializer-vue'],
21 | setupFiles: ['/test/unit/setup'],
22 | mapCoverage: true,
23 | coverageDirectory: '/test/unit/coverage',
24 | collectCoverageFrom: [
25 | 'src/**/*.{js,vue}',
26 | '!src/main.js',
27 | '!src/router/index.js',
28 | '!**/node_modules/**'
29 | ]
30 | }
31 |
--------------------------------------------------------------------------------
/.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_mongodb_2_0_2_RELEASE.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/dao/UserDao.java:
--------------------------------------------------------------------------------
1 | package com.example.dao;
2 | import com.example.demo.Entity.Fanban;
3 | import com.example.demo.Entity.UserEntity;
4 |
5 | import java.util.List;
6 |
7 | public interface UserDao {
8 |
9 | public void saveUser(UserEntity user);
10 |
11 | public UserEntity findUserByUserName(String userName);
12 |
13 | public int updateUser(UserEntity user);
14 |
15 | public void deleteUserById(Long id);
16 | //根据名字和密码查询user
17 | public UserEntity findUser(UserEntity user);
18 |
19 |
20 | public void saveFaban(Fanban fanban);
21 |
22 | public Fanban findUserByIsOK(String isOK, String ip);
23 |
24 | public int updateFaban(Fanban fanban);
25 |
26 | public void deleteFabanById(String id);
27 |
28 | public List findAll(Fanban fanban);
29 |
30 | public Fanban findFaban(String ip);
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/db-service-monitoring/test/e2e/custom-assertions/elementCount.js:
--------------------------------------------------------------------------------
1 | // A custom Nightwatch assertion.
2 | // The assertion name is the filename.
3 | // Example usage:
4 | //
5 | // browser.assert.elementCount(selector, count)
6 | //
7 | // For more information on custom assertions see:
8 | // http://nightwatchjs.org/guide#writing-custom-assertions
9 |
10 | exports.assertion = function (selector, count) {
11 | this.message = 'Testing if element <' + selector + '> has count: ' + count
12 | this.expected = count
13 | this.pass = function (val) {
14 | return val === this.expected
15 | }
16 | this.value = function (res) {
17 | return res.value
18 | }
19 | this.command = function (cb) {
20 | var self = this
21 | return this.api.execute(function (selector) {
22 | return document.querySelectorAll(selector).length
23 | }, [selector], function (res) {
24 | cb.call(self, res)
25 | })
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/db-service-monitoring/.eslintrc.js:
--------------------------------------------------------------------------------
1 | // https://eslint.org/docs/user-guide/configuring
2 |
3 | module.exports = {
4 | root: true,
5 | parserOptions: {
6 | parser: 'babel-eslint'
7 | },
8 | env: {
9 | browser: true,
10 | },
11 | extends: [
12 | // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
13 | // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
14 | 'plugin:vue/essential',
15 | // https://github.com/standard/standard/blob/master/docs/RULES-en.md
16 | 'standard'
17 | ],
18 | // required to lint *.vue files
19 | plugins: [
20 | 'vue'
21 | ],
22 | // add your custom rules here
23 | rules: {
24 | // allow async-await
25 | 'generator-star-spacing': 'off',
26 | // allow debugger during development
27 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/main.js:
--------------------------------------------------------------------------------
1 | // The Vue build version to load with the `import` command
2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
3 | import Vue from 'vue'
4 | import ElementUI from 'element-ui'
5 | import 'element-ui/lib/theme-chalk/index.css'
6 | import App from './App'
7 | import router from './router'
8 | import echarts from 'echarts'
9 | import {post, get} from './axios/axios'
10 | import axiosURL from './axios/axiosUrl' // 引用全局url地址对象
11 | import overall from './assets/js/overall_js' // 引用全局函数
12 | // 定义全局请求方式变量
13 | Vue.prototype.$post = post
14 | Vue.prototype.$get = get
15 | Vue.use(ElementUI)
16 | Vue.config.productionTip = false
17 | Vue.prototype.$echarts = echarts
18 | Vue.prototype.$axiosURL = axiosURL
19 | Vue.prototype.$overall = overall
20 | /* eslint-disable no-new */
21 | new Vue({
22 | el: '#app',
23 | router,
24 | components: { App },
25 | template: ''
26 | })
27 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/Entity/UnilizationRatio.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.Entity;
2 |
3 | /**
4 | * 存储服务器 硬盘,内存,cpu 使用情况
5 | */
6 | public class UnilizationRatio {
7 |
8 | //硬盘使用率
9 | private Double disk[];
10 | //内存使用率
11 | private Double ram[];
12 | //cpu使用率
13 | private Double cpu[];
14 | //time时间
15 | private String dataArr[];
16 |
17 | public String[] getDataArr() {
18 | return dataArr;
19 | }
20 |
21 | public void setDataArr(String[] dataArr) {
22 | this.dataArr = dataArr;
23 | }
24 |
25 | public Double[] getDisk() {
26 | return disk;
27 | }
28 |
29 | public void setDisk(Double[] disk) {
30 | this.disk = disk;
31 | }
32 |
33 | public Double[] getRam() {
34 | return ram;
35 | }
36 |
37 | public void setRam(Double[] ram) {
38 | this.ram = ram;
39 | }
40 |
41 | public Double[] getCpu() {
42 | return cpu;
43 | }
44 |
45 | public void setCpu(Double[] cpu) {
46 | this.cpu = cpu;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/Entity/UserEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.Entity;
2 |
3 | import java.io.Serializable;
4 |
5 | public class UserEntity implements Serializable {
6 | private static final long serialVersionUID = -3258839839160856613L;
7 | private Long id;
8 | private String userName;
9 | private String passWord;
10 |
11 | public Long getId() {
12 | return id;
13 | }
14 |
15 | public void setId(Long id) {
16 | this.id = id;
17 | }
18 |
19 | public String getUserName() {
20 | return userName;
21 | }
22 |
23 | public void setUserName(String userName) {
24 | this.userName = userName;
25 | }
26 |
27 | public String getPassWord() {
28 | return passWord;
29 | }
30 |
31 | public void setPassWord(String passWord) {
32 | this.passWord = passWord;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return "UserEntity{" +
38 | "id=" + id +
39 | ", userName='" + userName + '\'' +
40 | ", passWord='" + passWord + '\'' +
41 | '}';
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/EntityList/ServiceCourse.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.EntityList;
2 |
3 | public class ServiceCourse {
4 | private String name;//进程名
5 | private String cpu;//进程占用cpu
6 | private String mMemory;//进程占用内存
7 | private String user;//进程关联账户
8 | private int count;//进程个数
9 |
10 | public String getName() {
11 | return name;
12 | }
13 |
14 | public void setName(String name) {
15 | this.name = name;
16 | }
17 |
18 | public String getCpu() {
19 | return cpu;
20 | }
21 |
22 | public void setCpu(String cpu) {
23 | this.cpu = cpu;
24 | }
25 |
26 | public String getmMemory() {
27 | return mMemory;
28 | }
29 |
30 | public void setmMemory(String mMemory) {
31 | this.mMemory = mMemory;
32 | }
33 |
34 | public String getUser() {
35 | return user;
36 | }
37 |
38 | public void setUser(String user) {
39 | this.user = user;
40 | }
41 |
42 | public int getCount() {
43 | return count;
44 | }
45 |
46 | public void setCount(int count) {
47 | this.count = count;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/assets/data.json:
--------------------------------------------------------------------------------
1 | {
2 | "data": [
3 | {
4 | "serve": "康师傅(康饮)",
5 | "ip": "11.24.200.79",
6 | "status": "是",
7 | "remarks": "备注"
8 | },
9 | {
10 | "serve": "康师傅(康饮)",
11 | "ip": "11.24.200.27",
12 | "status": "是",
13 | "remarks": "备注"
14 | },
15 | {
16 | "serve": "康师傅(康饮)",
17 | "ip": "11.24.201.172",
18 | "status": "是",
19 | "remarks": "备注"
20 | },
21 | {
22 | "serve": "康师傅(康饮)",
23 | "ip": "11.24.200.224",
24 | "status": "是",
25 | "remarks": "备注"
26 | },
27 | {
28 | "serve": "康师傅(百饮)",
29 | "ip": "11.24.201.6",
30 | "status": "是",
31 | "remarks": "备注"
32 | },
33 | {
34 | "serve": "康师傅(百饮)",
35 | "ip": "11.24.200.230",
36 | "status": "是",
37 | "remarks": "备注"
38 | }
39 | ,
40 | {
41 | "serve": "康师傅(百饮)",
42 | "ip": "11.24.200.233",
43 | "status": "是",
44 | "remarks": "备注"
45 | }
46 | ,
47 | {
48 | "serve": "康师傅(百饮)",
49 | "ip": "11.24.200.231",
50 | "status": "是",
51 | "remarks": "备注"
52 | }
53 | ]
54 | }
55 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/EntityList/LinuxParent.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.EntityList;
2 |
3 | /**
4 | * Linux服务器统计进程信息 父类
5 | */
6 | public class LinuxParent {
7 | private String name;//进程名
8 | private String cpu;//进程占用cpu
9 | private String mMemory;//进程占用内存
10 | private String user;//进程关联账户
11 | private int count;//进程个数
12 |
13 | public int getCount() {
14 | return count;
15 | }
16 |
17 | public void setCount(int count) {
18 | this.count = count;
19 | }
20 |
21 | public String getName() {
22 | return name;
23 | }
24 |
25 | public void setName(String name) {
26 | this.name = name;
27 | }
28 |
29 |
30 | public String getCpu() {
31 | return cpu;
32 | }
33 |
34 | public void setCpu(String cpu) {
35 | this.cpu = cpu;
36 | }
37 |
38 | public String getmMemory() {
39 | return mMemory;
40 | }
41 |
42 | public void setmMemory(String mMemory) {
43 | this.mMemory = mMemory;
44 | }
45 |
46 | public String getUser() {
47 | return user;
48 | }
49 |
50 | public void setUser(String user) {
51 | this.user = user;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/db-service-monitoring/test/e2e/nightwatch.conf.js:
--------------------------------------------------------------------------------
1 | require('babel-register')
2 | var config = require('../../config')
3 |
4 | // http://nightwatchjs.org/gettingstarted#settings-file
5 | module.exports = {
6 | src_folders: ['test/e2e/specs'],
7 | output_folder: 'test/e2e/reports',
8 | custom_assertions_path: ['test/e2e/custom-assertions'],
9 |
10 | selenium: {
11 | start_process: true,
12 | server_path: require('selenium-server').path,
13 | host: '127.0.0.1',
14 | port: 4444,
15 | cli_args: {
16 | 'webdriver.chrome.driver': require('chromedriver').path
17 | }
18 | },
19 |
20 | test_settings: {
21 | default: {
22 | selenium_port: 4444,
23 | selenium_host: 'localhost',
24 | silent: true,
25 | globals: {
26 | devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port)
27 | }
28 | },
29 |
30 | chrome: {
31 | desiredCapabilities: {
32 | browserName: 'chrome',
33 | javascriptEnabled: true,
34 | acceptSslCerts: true
35 | }
36 | },
37 |
38 | firefox: {
39 | desiredCapabilities: {
40 | browserName: 'firefox',
41 | javascriptEnabled: true,
42 | acceptSslCerts: true
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/Entity/ParameterList.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.Entity;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 封装参数使用
7 | */
8 | public class ParameterList {
9 | //服务器开关状态
10 | private String isOK;
11 | //批量要更新的服务器对象集合
12 | private List fabanList;
13 | //服务进程状态
14 | private String processState;
15 | //批量更新服务进程对象集合
16 | private List serviceProcessList;
17 |
18 | public String getProcessState() {
19 | return processState;
20 | }
21 |
22 | public void setProcessState(String processState) {
23 | this.processState = processState;
24 | }
25 |
26 | public List getServiceProcessList() {
27 | return serviceProcessList;
28 | }
29 |
30 | public void setServiceProcessList(List serviceProcessList) {
31 | this.serviceProcessList = serviceProcessList;
32 | }
33 |
34 | public String getIsOK() {
35 | return isOK;
36 | }
37 |
38 | public void setIsOK(String isOK) {
39 | this.isOK = isOK;
40 | }
41 |
42 | public List getFabanList() {
43 | return fabanList;
44 | }
45 |
46 | public void setFabanList(List fabanList) {
47 | this.fabanList = fabanList;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/build.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | require('./check-versions')()
3 |
4 | process.env.NODE_ENV = 'production'
5 |
6 | const ora = require('ora')
7 | const rm = require('rimraf')
8 | const path = require('path')
9 | const chalk = require('chalk')
10 | const webpack = require('webpack')
11 | const config = require('../config')
12 | const webpackConfig = require('./webpack.prod.conf')
13 |
14 | const spinner = ora('building for production...')
15 | spinner.start()
16 |
17 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
18 | if (err) throw err
19 | webpack(webpackConfig, (err, stats) => {
20 | spinner.stop()
21 | if (err) throw err
22 | process.stdout.write(stats.toString({
23 | colors: true,
24 | modules: false,
25 | children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
26 | chunks: false,
27 | chunkModules: false
28 | }) + '\n\n')
29 |
30 | if (stats.hasErrors()) {
31 | console.log(chalk.red(' Build failed with errors.\n'))
32 | process.exit(1)
33 | }
34 |
35 | console.log(chalk.cyan(' Build complete.\n'))
36 | console.log(chalk.yellow(
37 | ' Tip: built files are meant to be served over an HTTP server.\n' +
38 | ' Opening index.html over file:// won\'t work.\n'
39 | ))
40 | })
41 | })
42 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/check-versions.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const chalk = require('chalk')
3 | const semver = require('semver')
4 | const packageConfig = require('../package.json')
5 | const shell = require('shelljs')
6 |
7 | function exec (cmd) {
8 | return require('child_process').execSync(cmd).toString().trim()
9 | }
10 |
11 | const versionRequirements = [
12 | {
13 | name: 'node',
14 | currentVersion: semver.clean(process.version),
15 | versionRequirement: packageConfig.engines.node
16 | }
17 | ]
18 |
19 | if (shell.which('npm')) {
20 | versionRequirements.push({
21 | name: 'npm',
22 | currentVersion: exec('npm --version'),
23 | versionRequirement: packageConfig.engines.npm
24 | })
25 | }
26 |
27 | module.exports = function () {
28 | const warnings = []
29 |
30 | for (let i = 0; i < versionRequirements.length; i++) {
31 | const mod = versionRequirements[i]
32 |
33 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
34 | warnings.push(mod.name + ': ' +
35 | chalk.red(mod.currentVersion) + ' should be ' +
36 | chalk.green(mod.versionRequirement)
37 | )
38 | }
39 | }
40 |
41 | if (warnings.length) {
42 | console.log('')
43 | console.log(chalk.yellow('To use this template, you must update following to modules:'))
44 | console.log()
45 |
46 | for (let i = 0; i < warnings.length; i++) {
47 | const warning = warnings[i]
48 | console.log(' ' + warning)
49 | }
50 |
51 | console.log()
52 | process.exit(1)
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/db-service-monitoring/test/e2e/runner.js:
--------------------------------------------------------------------------------
1 | // 1. start the dev server using production config
2 | process.env.NODE_ENV = 'testing'
3 |
4 | const webpack = require('webpack')
5 | const DevServer = require('webpack-dev-server')
6 |
7 | const webpackConfig = require('../../build/webpack.prod.conf')
8 | const devConfigPromise = require('../../build/webpack.dev.conf')
9 |
10 | let server
11 |
12 | devConfigPromise.then(devConfig => {
13 | const devServerOptions = devConfig.devServer
14 | const compiler = webpack(webpackConfig)
15 | server = new DevServer(compiler, devServerOptions)
16 | const port = devServerOptions.port
17 | const host = devServerOptions.host
18 | return server.listen(port, host)
19 | })
20 | .then(() => {
21 | // 2. run the nightwatch test suite against it
22 | // to run in additional browsers:
23 | // 1. add an entry in test/e2e/nightwatch.conf.js under "test_settings"
24 | // 2. add it to the --env flag below
25 | // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox`
26 | // For more information on Nightwatch's config file, see
27 | // http://nightwatchjs.org/guide#settings-file
28 | let opts = process.argv.slice(2)
29 | if (opts.indexOf('--config') === -1) {
30 | opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js'])
31 | }
32 | if (opts.indexOf('--env') === -1) {
33 | opts = opts.concat(['--env', 'chrome'])
34 | }
35 |
36 | const spawn = require('cross-spawn')
37 | const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' })
38 |
39 | runner.on('exit', function (code) {
40 | server.close()
41 | process.exit(code)
42 | })
43 |
44 | runner.on('error', function (err) {
45 | server.close()
46 | throw err
47 | })
48 | })
49 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/axios/axiosUrl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * 配置全局使用的请求地址url
3 | * 11.24.201.68
4 | * 192.168.0.5
5 | */
6 | export default {
7 | rootDirectory: function () { // 请求接口的根路径
8 | return 'http://192.168.0.26:9999'
9 | },
10 | loginURL: function () {
11 | return this.rootDirectory() + '/xx/login'
12 | },
13 | serverURL: function () { // 获取服务器所有数据
14 | return this.rootDirectory() + '/xx/getAll'
15 | },
16 | updateAllURL: function () { // 批量更新服务器数据
17 | return this.rootDirectory() + '/xx/updateFabanAll'
18 | },
19 | saveFabanURL: function () {
20 | return this.rootDirectory() + '/xx/saveFaban'
21 | },
22 | updateFabanURL: function () {
23 | return this.rootDirectory() + '/xx/updateFaban'
24 | },
25 | deleteFaban: function () {
26 | return this.rootDirectory() + '/xx/deleteFaban'
27 | },
28 | getUnilizationRatio: function () {
29 | return this.rootDirectory() + '/xx/getUnilizationRatio'
30 | },
31 | getServerOwnership: function () {
32 | return this.rootDirectory() + '/xx/getServerOwnership'
33 | },
34 | getServerDetails: function () {
35 | return this.rootDirectory() + '/xx/getServerDetails'
36 | },
37 | getServiceProcess: function () {
38 | return this.rootDirectory() + '/xx/getServiceProcess'
39 | },
40 | saveServiceProcess: function () {
41 | return this.rootDirectory() + '/process/saveServiceProcess'
42 | },
43 | getServiceProcessList: function () {
44 | return this.rootDirectory() + '/process/getServiceProcessList'
45 | },
46 | updateServiceProcess: function () {
47 | return this.rootDirectory() + '/process/updateServiceProcess'
48 | },
49 | deleteServiceProcess: function () {
50 | return this.rootDirectory() + '/process/deleteServiceProcess'
51 | },
52 | getServerIp: function () {
53 | return this.rootDirectory() + '/process/getServerIp'
54 | },
55 | batchUpdate: function () {
56 | return this.rootDirectory() + '/process/batchUpdate'
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/Entity/Fanban.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.Entity;
2 |
3 |
4 | import org.springframework.data.mongodb.core.mapping.Document;
5 |
6 | import java.io.Serializable;
7 | @Document
8 | public class Fanban implements Serializable {
9 |
10 | private static final long serialVersionUID = -3258839839160856613L;
11 | //服务器id
12 | private String id;
13 | //服务器发版状态
14 | private String isOK;
15 | //服务器ip
16 | private String ip;
17 | //服务器归属
18 | private String serverOwnership;
19 | //备注
20 | private String remarks;
21 | private String updateTime;//修改时间
22 | private String creationDate;//创建时间
23 |
24 | public String getUpdateTime() {
25 | return updateTime;
26 | }
27 |
28 | public void setUpdateTime(String updateTime) {
29 | this.updateTime = updateTime;
30 | }
31 |
32 | public String getCreationDate() {
33 | return creationDate;
34 | }
35 |
36 | public void setCreationDate(String creationDate) {
37 | this.creationDate = creationDate;
38 | }
39 |
40 | public String getServerOwnership() {
41 | return serverOwnership;
42 | }
43 |
44 | public void setServerOwnership(String serverOwnership) {
45 | this.serverOwnership = serverOwnership;
46 | }
47 |
48 | public String getRemarks() {
49 | return remarks;
50 | }
51 |
52 | public void setRemarks(String remarks) {
53 | this.remarks = remarks;
54 | }
55 |
56 | public String getId() {
57 | return id;
58 | }
59 |
60 | public void setId(String id) {
61 | this.id = id;
62 | }
63 |
64 | public String getIsOK() {
65 | return isOK;
66 | }
67 |
68 | public void setIsOK(String isOK) {
69 | this.isOK = isOK;
70 | }
71 |
72 | public String getIp() {
73 | return ip;
74 | }
75 |
76 | public void setIp(String ip) {
77 | this.ip = ip;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/linux-install-shell/OneClick_StartAndStop/acme_startAll.sh:
--------------------------------------------------------------------------------
1 | # 依次开启各个服务 Author by huangweilin -- 2018-04-17
2 |
3 | # # ######################################### # #
4 |
5 | # 重新开启服务器 针对ip: 192.168.0.73 #
6 |
7 | # # ######################################## # #
8 |
9 | #-------------------------- 1.启动redis服务
10 |
11 | # 进入redis服务目录
12 | cd /tools/redis/redis-4.0.8/src/
13 |
14 | # 启动服务
15 | ./redis-server /tools/config_redis/redis.conf &
16 |
17 |
18 |
19 |
20 | # --------------------------2.启动zookeeper服务
21 |
22 | # 进入zookeeper服务目录
23 | cd /tools/zookeeper/zookeeper-3.4.10/bin/
24 |
25 | # 启动服务
26 | ./zkServer.sh start ../conf/zoo.cfg &
27 |
28 |
29 |
30 |
31 | # --------------------------3.启动mongodb服务
32 |
33 | # 进入mongodb服务目录
34 | cd /tools/mongodb/mongodb-linux-x86_64-rhel70-3.6.3/bin/
35 |
36 | # 启动服务
37 | ./mongod --config /tools/config_mongodb/mongodb.conf &
38 |
39 |
40 |
41 |
42 |
43 | # -------------------------- 4.启动vicarServer服务
44 |
45 | # 进入vacar服务目录
46 | cd /tools/vacar/
47 |
48 | # 启动服务
49 | ./start.sh &
50 |
51 |
52 | #------------------------------- 5. 启动nginx服务
53 |
54 | # 进入nginx 服务目录
55 | #cd /tools/ngnix/nginxStart/sbin/
56 |
57 | # 启动服务
58 | #./nginx
59 |
60 | #------------------------------- 6.启动tomcat服务
61 |
62 | # 进入tomcat 服务目录
63 | cd /tools/tomcat/apache-tomcat-8.5.29/bin/
64 |
65 | # 启动服务
66 | ./startup.sh &
67 |
68 | #------------------------------- 7.启动tomcat服务
69 |
70 | # 进入图片tomcat 服务目录
71 | cd /tools/tomcat/pic-server/bin/
72 |
73 | # 启动服务
74 | ./startup.sh &
75 |
76 | # ------------------------------ 8.启动vertx服务
77 |
78 | # 进入vretx服务目录
79 | cd /tools/vertx/vertx-server-win-test/bin/
80 |
81 | # 启动服务
82 | ./vertx_local.sh &
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/Entity/ServiceProcess.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.Entity;
2 |
3 | /**
4 | * 服务进程实体
5 | */
6 | public class ServiceProcess {
7 | private String token;//数据唯一标识32字符串
8 | private String ip;//进程所属服务器ip
9 | private String name;//进程名字
10 | /**进程状态:0:无操作,1:启动进程服务,
11 | * 2:终止进程服务,3:正在启动进程服务,
12 | * 4:正在终止进程服务,5:异常,6:进程服务运行中,7:进程服务已停止
13 | **/
14 | private String status;
15 | private String remarks;//备注
16 | private String updateTime;//修改时间
17 | private String creationDate;//创建时间
18 | private String marked;//标记是页面请求/linux服务器sh脚本请求
19 |
20 | public String getMarked() {
21 | return marked;
22 | }
23 |
24 | public void setMarked(String marked) {
25 | this.marked = marked;
26 | }
27 |
28 | public String getCreationDate() {
29 | return creationDate;
30 | }
31 |
32 | public void setCreationDate(String creationDate) {
33 | this.creationDate = creationDate;
34 | }
35 |
36 | public String getUpdateTime() {
37 | return updateTime;
38 | }
39 |
40 | public void setUpdateTime(String updateTime) {
41 | this.updateTime = updateTime;
42 | }
43 |
44 | public String getToken() {
45 | return token;
46 | }
47 |
48 | public void setToken(String token) {
49 | this.token = token;
50 | }
51 |
52 | public String getIp() {
53 | return ip;
54 | }
55 |
56 | public void setIp(String ip) {
57 | this.ip = ip;
58 | }
59 |
60 | public String getName() {
61 | return name;
62 | }
63 |
64 | public void setName(String name) {
65 | this.name = name;
66 | }
67 |
68 | public String getStatus() {
69 | return status;
70 | }
71 |
72 | public void setStatus(String status) {
73 | this.status = status;
74 | }
75 |
76 | public String getRemarks() {
77 | return remarks;
78 | }
79 |
80 | public void setRemarks(String remarks) {
81 | this.remarks = remarks;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/router/index.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import Router from 'vue-router'
3 | import Login from '../components/Login.vue'
4 | import Index from '../components/Index.vue'
5 | import Serverdetails from '../components/serverRelease/ServerDetails.vue'
6 | import ServerStatus from '../components/serverRelease/ServerStatus.vue'
7 | import ProcessList from '../components/processList/ProcessList.vue'
8 | Vue.use(Router)
9 |
10 | const router = new Router({
11 | routes: [
12 | {
13 | path: '/',
14 | name: 'Login',
15 | component: Login
16 | },
17 | {
18 | path: '/Index',
19 | name: 'Index',
20 | component: Index,
21 | meta: {
22 | login: true /* 需要登录可查看的页面 */
23 | },
24 | children: [/* 子路由 */
25 | {
26 | path: '/Serverdetails',
27 | component: Serverdetails,
28 | meta: {
29 | login: true /* 需要登录可查看的页面 */
30 | }
31 | },
32 | {
33 | path: '/ServerStatus',
34 | component: ServerStatus,
35 | meta: {
36 | login: true /* 需要登录可查看的页面 */
37 | }
38 | },
39 | {
40 | path: '/ProcessList',
41 | component: ProcessList,
42 | meta: {
43 | login: true /* 需要登录可查看的页面 */
44 | }
45 | }
46 | ]
47 | }
48 | ]
49 | })
50 |
51 | /**
52 | * 全局拦截路由 访问要求验证登录的页面 未登录 直接跳转到登录页面
53 | * to:表示目标路由
54 | * from:表示来源路由
55 | * next:表示执行下一步操作
56 | */
57 | router.beforeEach((to, from, next) => {
58 | // console.info(22, window.location.href)
59 | // console.info(to,from,next)
60 | // 对路由变化作出响应...
61 | // console.log(router,to)
62 | // console.log(router,to.query, from)
63 | // console.log(to,$.param( to.query ),window.location.href)
64 | // console.log('login:' + JSON.stringify(to))
65 | // 全局拦截器的
66 | if (to.meta.login) { /* 判断该路由是否需要登录权限 */
67 | // console.log('accessToken1:' + localStorage.getItem('accessToken'))
68 | if (localStorage.getItem('accessToken') !== null) { /* 通过store获取当前的token是否存在 */
69 | // console.log('accessToken2:' + localStorage.getItem('accessToken'))
70 | next()
71 | } else {
72 | next({path: '/'}) // 跳转至登录页面
73 | }
74 | } else {
75 | next()
76 | }
77 | })
78 | export default router
79 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # linux服务器监控平台
2 | 技术:nodejs vue java mongodb springboot linux shell
3 | linux服务器监控项目,前后端分离vue+springboot+mongodb
4 |
5 | ## :
6 |
7 |
8 | ## 1、启动前台:
9 | 使用命令:
10 | ### A 先安装nodejs
11 | 并配置好环境变量
12 | ### B 先控制台cmd命令切换到项目目录:
13 | CD db-service-monitoring
14 | ### C 第一次运行要安装依赖库:
15 | npm install
16 | ### D 后执行:
17 | npm run dev
18 | ### E 前台配置后台请求地址
19 | 在文件:db-service-monitoring\src\axios\axiosUrl.js
20 | /**
21 | * 配置全局使用的请求地址url
22 | * 11.24.201.68
23 | * 192.168.0.5
24 | */
25 | export default {
26 | rootDirectory: function () { // 请求接口的根路径
27 | return 'http://192.168.0.26:9999'
28 | },
29 |
30 | 修改访问地址和端口号:
31 | 打开文件db-service-monitoring\config\index.js
32 |
33 | host: '192.168.0.26', // can be overwritten by process.env.HOST
34 | port: 8082, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
35 | autoOpenBrowser: false,
36 | ### F 启动后显示如下信息
37 | DONE Compiled successfully in 16239ms 16:44:38
38 |
39 | I Your application is running here: http://localhost:8083
40 |
41 |
42 |
43 | ## 2、后台启动类
44 | A 配置文件中修改mongodb数据库连接
45 | B 运行单元测试 初始化数据
46 | service-monitoring\src\test\java\com\example\demo\DemoApplicationTests.java
47 | 手动打开mongodb新建一个集合
48 | Collection('userEntity')
49 | 并新增一条用户:
50 | {
51 | "_id" : NumberLong(4),
52 | "userName" : "qiweb",
53 | "passWord" : "qiweb",
54 | "_class" : "com.example.demo.UserEntity"
55 | }
56 | C 运行启动类
57 |
58 |
59 | com.example.DemoApplication
60 |
61 | ## 3、linux客户端脚本
62 | 存放在linux-install-shell
63 |
64 | ## 4、运行效果图
65 | 
66 | 
67 | 
68 | 
69 | 
70 |
71 | ## 5、发布项目到linux服务器
72 | ### 前台编译
73 | cmd到db-service-monitoring执行
74 | npm run build
75 | 得到dist就是编译后的前台系统文件
76 | ### 后台编译
77 | mvn clean package
78 | 获得一个war包
79 | ## 技术讨论QQ微信 908701702
80 |
--------------------------------------------------------------------------------
/db-service-monitoring/config/index.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | // Template version: 1.3.1
3 | // see http://vuejs-templates.github.io/webpack for documentation.
4 |
5 | const path = require('path')
6 |
7 | module.exports = {
8 | dev: {
9 |
10 | // Paths
11 | assetsSubDirectory: 'static',
12 | assetsPublicPath: '/',
13 | proxyTable: {},
14 |
15 | // Various Dev Server settings
16 | host: 'localhost', // can be overwritten by process.env.HOST
17 | port: 8082, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
18 | autoOpenBrowser: false,
19 | errorOverlay: true,
20 | notifyOnErrors: true,
21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
22 |
23 | // Use Eslint Loader?
24 | // If true, your code will be linted during bundling and
25 | // linting errors and warnings will be shown in the console.
26 | useEslint: true,
27 | // If true, eslint errors and warnings will also be shown in the error overlay
28 | // in the browser.
29 | showEslintErrorsInOverlay: false,
30 |
31 | /**
32 | * Source Maps
33 | */
34 |
35 | // https://webpack.js.org/configuration/devtool/#development
36 | devtool: 'cheap-module-eval-source-map',
37 |
38 | // If you have problems debugging vue-files in devtools,
39 | // set this to false - it *may* help
40 | // https://vue-loader.vuejs.org/en/options.html#cachebusting
41 | cacheBusting: true,
42 |
43 | cssSourceMap: true
44 | },
45 |
46 | build: {
47 | // Template for index.html
48 | index: path.resolve(__dirname, '../dist/index.html'),
49 |
50 | // Paths
51 | assetsRoot: path.resolve(__dirname, '../dist'),
52 | assetsSubDirectory: 'static',
53 | assetsPublicPath: './',
54 |
55 | /**
56 | * Source Maps
57 | */
58 |
59 | productionSourceMap: false,
60 | // https://webpack.js.org/configuration/devtool/#production
61 | devtool: '#source-map',
62 |
63 | // Gzip off by default as many popular static hosts such as
64 | // Surge or Netlify already gzip all static assets for you.
65 | // Before setting to `true`, make sure to:
66 | // npm install --save-dev compression-webpack-plugin
67 | productionGzip: false,
68 | productionGzipExtensions: ['js', 'css'],
69 |
70 | // Run the build command with an extra argument to
71 | // View the bundle analyzer report after build finishes:
72 | // `npm run build --report`
73 | // Set to `true` or `false` to always turn it on or off
74 | bundleAnalyzerReport: process.env.npm_config_report
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/axios/axios.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 |
3 | axios.defaults.timeout = 5000 // 发送请求后,5s还没有收到请求答复,就超时报错
4 | axios.defaults.baseURL = ''
5 |
6 | // http request 拦截器
7 | axios.interceptors.request.use(
8 | /* config => {
9 | // const token = getCookie('名称');注意使用的时候需要引入cookie方法,推荐js-cookie
10 | config.data = JSON.stringify(config.data)
11 | config.headers = {
12 | 'Content-Type': 'application/x-www-form-urlencoded'
13 | }
14 | // if(token){
15 | // config.params = {'token':token}
16 | // }
17 | return config
18 | },
19 | error => {
20 | return Promise.reject(err)
21 | } */
22 | )
23 |
24 | // http response 拦截器
25 | axios.interceptors.response.use(
26 | /* response => {
27 | if (response.data.errCode == 2) {
28 | router.push({
29 | path: '/login',
30 | querry: {redirect: router.currentRoute.fullPath}// 从哪个页面跳转
31 | })
32 | }
33 | return response
34 | },
35 | error => {
36 | return Promise.reject(error)
37 | } */
38 | )
39 |
40 | /**
41 | * 封装get方法
42 | * @param url
43 | * @param data
44 | * @returns {Promise}
45 | */
46 |
47 | export function get (url, params = {}) {
48 | return new Promise((resolve, reject) => {
49 | axios.get(url, {
50 | params: params
51 | })
52 | .then(response => {
53 | resolve(response.data)
54 | })
55 | .catch(err => {
56 | reject(err)
57 | })
58 | })
59 | }
60 |
61 | /**
62 | * 封装post请求
63 | * @param url
64 | * @param data
65 | * @returns {Promise}
66 | */
67 |
68 | export function post (url, data = {}) {
69 | return new Promise((resolve, reject) => {
70 | axios.post(url, data)
71 | .then(response => {
72 | resolve(response.data)
73 | }, err => {
74 | reject(err)
75 | })
76 | })
77 | }
78 |
79 | /**
80 | * 封装patch请求
81 | * @param url
82 | * @param data
83 | * @returns {Promise}
84 | */
85 |
86 | export function patch (url, data = {}) {
87 | return new Promise((resolve, reject) => {
88 | axios.patch(url, data)
89 | .then(response => {
90 | resolve(response.data)
91 | }, err => {
92 | reject(err)
93 | })
94 | })
95 | }
96 |
97 | /**
98 | * 封装put请求
99 | * @param url
100 | * @param data
101 | * @returns {Promise}
102 | */
103 |
104 | export function put (url, data = {}) {
105 | return new Promise((resolve, reject) => {
106 | axios.put(url, data)
107 | .then(response => {
108 | resolve(response.data)
109 | }, err => {
110 | reject(err)
111 | })
112 | })
113 | }
114 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/webpack.base.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const config = require('../config')
5 | const vueLoaderConfig = require('./vue-loader.conf')
6 |
7 | function resolve (dir) {
8 | return path.join(__dirname, '..', dir)
9 | }
10 |
11 | const createLintingRule = () => ({
12 | /*test: /\.(js|vue)$/,
13 | loader: 'eslint-loader',
14 | enforce: 'pre',
15 | include: [resolve('src'), resolve('test')],
16 | options: {
17 | formatter: require('eslint-friendly-formatter'),
18 | emitWarning: !config.dev.showEslintErrorsInOverlay
19 | }*/
20 | })
21 |
22 | module.exports = {
23 | context: path.resolve(__dirname, '../'),
24 | entry: {
25 | app: './src/main.js'
26 | },
27 | output: {
28 | path: config.build.assetsRoot,
29 | filename: '[name].js',
30 | publicPath: process.env.NODE_ENV === 'production'
31 | ? config.build.assetsPublicPath
32 | : config.dev.assetsPublicPath
33 | },
34 | resolve: {
35 | extensions: ['.js', '.vue', '.json'],
36 | alias: {
37 | 'vue$': 'vue/dist/vue.esm.js',
38 | '@': resolve('src'),
39 | }
40 | },
41 | module: {
42 | rules: [
43 | ...(config.dev.useEslint ? [createLintingRule()] : []),
44 | {
45 | test: /\.vue$/,
46 | loader: 'vue-loader',
47 | options: vueLoaderConfig
48 | },
49 | {
50 | test: /\.js$/,
51 | loader: 'babel-loader',
52 | include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
53 | },
54 | {
55 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
56 | loader: 'url-loader',
57 | options: {
58 | limit: 10000,
59 | name: utils.assetsPath('img/[name].[hash:7].[ext]')
60 | }
61 | },
62 | {
63 | test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
64 | loader: 'url-loader',
65 | options: {
66 | limit: 10000,
67 | name: utils.assetsPath('media/[name].[hash:7].[ext]')
68 | }
69 | },
70 | {
71 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
72 | loader: 'url-loader',
73 | options: {
74 | limit: 10000,
75 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
76 | }
77 | }
78 | ]
79 | },
80 | node: {
81 | // prevent webpack from injecting useless setImmediate polyfill because Vue
82 | // source contains it (although only uses it if it's native).
83 | setImmediate: false,
84 | // prevent webpack from injecting mocks to Node native modules
85 | // that does not make sense for the client
86 | dgram: 'empty',
87 | fs: 'empty',
88 | net: 'empty',
89 | tls: 'empty',
90 | child_process: 'empty'
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/demo/Entity/ServerDetails.java:
--------------------------------------------------------------------------------
1 | package com.example.demo.Entity;
2 |
3 | /**
4 | * 服务器配置详情
5 | */
6 | public class ServerDetails {
7 | private String uptime;//系统运行时间(天)
8 | private String cpuName;//cpu模型(型号)
9 | private String osName;//操作系统
10 | private String ip;//ip地址
11 | private String cpuFreq;//cpu速度
12 | private String osKernel;//核心
13 | private String tx;//发送流量(KB)
14 | private String rx;//接收流量(KB)
15 | private String connections;//连接数
16 | private String nic;//网络接口
17 | private String sessions;//登录会话计数
18 | private String processes;//进程计数
19 |
20 | public String getUptime() {
21 | return uptime;
22 | }
23 |
24 | public void setUptime(String uptime) {
25 | this.uptime = uptime;
26 | }
27 |
28 | public String getCpuName() {
29 | return cpuName;
30 | }
31 |
32 | public void setCpuName(String cpuName) {
33 | this.cpuName = cpuName;
34 | }
35 |
36 | public String getOsName() {
37 | return osName;
38 | }
39 |
40 | public void setOsName(String osName) {
41 | this.osName = osName;
42 | }
43 |
44 | public String getIp() {
45 | return ip;
46 | }
47 |
48 | public void setIp(String ip) {
49 | this.ip = ip;
50 | }
51 |
52 | public String getCpuFreq() {
53 | return cpuFreq;
54 | }
55 |
56 | public void setCpuFreq(String cpuFreq) {
57 | this.cpuFreq = cpuFreq;
58 | }
59 |
60 | public String getOsKernel() {
61 | return osKernel;
62 | }
63 |
64 | public void setOsKernel(String osKernel) {
65 | this.osKernel = osKernel;
66 | }
67 |
68 | public String getTx() {
69 | return tx;
70 | }
71 |
72 | public void setTx(String tx) {
73 | this.tx = tx;
74 | }
75 |
76 | public String getRx() {
77 | return rx;
78 | }
79 |
80 | public void setRx(String rx) {
81 | this.rx = rx;
82 | }
83 |
84 | public String getConnections() {
85 | return connections;
86 | }
87 |
88 | public void setConnections(String connections) {
89 | this.connections = connections;
90 | }
91 |
92 | public String getNic() {
93 | return nic;
94 | }
95 |
96 | public void setNic(String nic) {
97 | this.nic = nic;
98 | }
99 |
100 | public String getSessions() {
101 | return sessions;
102 | }
103 |
104 | public void setSessions(String sessions) {
105 | this.sessions = sessions;
106 | }
107 |
108 | public String getProcesses() {
109 | return processes;
110 | }
111 |
112 | public void setProcesses(String processes) {
113 | this.processes = processes;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/service-monitoring/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.example
7 | demo
8 | 0.0.1-SNAPSHOT
9 | war
10 |
11 | demo
12 | Demo project for Spring Boot
13 |
14 |
15 | org.springframework.boot
16 | spring-boot-starter-parent
17 | 2.0.2.RELEASE
18 |
19 |
20 |
21 |
22 | UTF-8
23 | UTF-8
24 | 1.8
25 |
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-data-mongodb
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-thymeleaf
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-web
39 |
40 |
41 |
42 | org.springframework.boot
43 | spring-boot-starter-test
44 | test
45 |
46 |
51 |
52 |
57 |
58 |
59 |
60 | net.sf.json-lib
61 | json-lib
62 | 2.4
63 | jdk15
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | org.springframework.boot
72 | spring-boot-autoconfigure
73 | RELEASE
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 | org.springframework.boot
83 | spring-boot-maven-plugin
84 |
85 |
86 | monitoring
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/db-service-monitoring/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "db-service-monitoring",
3 | "version": "1.0.0",
4 | "description": "服务器监测系统",
5 | "author": "",
6 | "private": true,
7 | "scripts": {
8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
9 | "start": "npm run dev",
10 | "unit": "jest --config test/unit/jest.conf.js --coverage",
11 | "e2e": "node test/e2e/runner.js",
12 | "test": "npm run unit && npm run e2e",
13 | "lint": "eslint --ext .js,.vue src test/unit test/e2e/specs",
14 | "build": "node build/build.js"
15 | },
16 | "dependencies": {
17 | "axios": "^0.18.0",
18 | "echarts": "^4.1.0",
19 | "element-ui": "^2.4.1",
20 | "vue": "^2.5.2",
21 | "vue-router": "^3.0.1"
22 | },
23 | "devDependencies": {
24 | "autoprefixer": "^7.1.2",
25 | "babel-core": "^6.22.1",
26 | "babel-eslint": "^8.2.1",
27 | "babel-helper-vue-jsx-merge-props": "^2.0.3",
28 | "babel-jest": "^21.0.2",
29 | "babel-loader": "^7.1.1",
30 | "babel-plugin-dynamic-import-node": "^1.2.0",
31 | "babel-plugin-syntax-jsx": "^6.18.0",
32 | "babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
33 | "babel-plugin-transform-runtime": "^6.22.0",
34 | "babel-plugin-transform-vue-jsx": "^3.5.0",
35 | "babel-preset-env": "^1.3.2",
36 | "babel-preset-stage-2": "^6.22.0",
37 | "babel-register": "^6.22.0",
38 | "chalk": "^2.0.1",
39 | "chromedriver": "^2.27.2",
40 | "copy-webpack-plugin": "^4.0.1",
41 | "cross-spawn": "^5.0.1",
42 | "css-loader": "^0.28.0",
43 | "eslint": "^4.15.0",
44 | "eslint-config-standard": "^10.2.1",
45 | "eslint-friendly-formatter": "^3.0.0",
46 | "eslint-loader": "^1.7.1",
47 | "eslint-plugin-import": "^2.7.0",
48 | "eslint-plugin-node": "^5.2.0",
49 | "eslint-plugin-promise": "^3.4.0",
50 | "eslint-plugin-standard": "^3.0.1",
51 | "eslint-plugin-vue": "^4.0.0",
52 | "extract-text-webpack-plugin": "^3.0.0",
53 | "file-loader": "^1.1.4",
54 | "friendly-errors-webpack-plugin": "^1.6.1",
55 | "html-webpack-plugin": "^2.30.1",
56 | "jest": "^22.0.4",
57 | "jest-serializer-vue": "^0.3.0",
58 | "nightwatch": "^0.9.12",
59 | "node-notifier": "^5.1.2",
60 | "optimize-css-assets-webpack-plugin": "^3.2.0",
61 | "ora": "^1.2.0",
62 | "portfinder": "^1.0.13",
63 | "postcss-import": "^11.0.0",
64 | "postcss-loader": "^2.0.8",
65 | "postcss-url": "^7.2.1",
66 | "rimraf": "^2.6.0",
67 | "selenium-server": "^3.0.1",
68 | "semver": "^5.3.0",
69 | "shelljs": "^0.7.6",
70 | "uglifyjs-webpack-plugin": "^1.1.1",
71 | "url-loader": "^0.5.8",
72 | "vue-jest": "^1.0.2",
73 | "vue-loader": "^13.3.0",
74 | "vue-style-loader": "^3.0.1",
75 | "vue-template-compiler": "^2.5.2",
76 | "webpack": "^3.6.0",
77 | "webpack-bundle-analyzer": "^2.9.0",
78 | "webpack-dev-server": "^2.9.1",
79 | "webpack-merge": "^4.1.0"
80 | },
81 | "engines": {
82 | "node": ">= 6.0.0",
83 | "npm": ">= 3.0.0"
84 | },
85 | "browserslist": [
86 | "> 1%",
87 | "last 2 versions",
88 | "not ie <= 8"
89 | ]
90 | }
91 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/utils.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const config = require('../config')
4 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
5 | const packageConfig = require('../package.json')
6 |
7 | exports.assetsPath = function (_path) {
8 | const assetsSubDirectory = process.env.NODE_ENV === 'production'
9 | ? config.build.assetsSubDirectory
10 | : config.dev.assetsSubDirectory
11 |
12 | return path.posix.join(assetsSubDirectory, _path)
13 | }
14 |
15 | exports.cssLoaders = function (options) {
16 | options = options || {}
17 |
18 | const cssLoader = {
19 | loader: 'css-loader',
20 | options: {
21 | sourceMap: options.sourceMap
22 | }
23 | }
24 |
25 | const postcssLoader = {
26 | loader: 'postcss-loader',
27 | options: {
28 | sourceMap: options.sourceMap
29 | }
30 | }
31 |
32 | // generate loader string to be used with extract text plugin
33 | function generateLoaders (loader, loaderOptions) {
34 | const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35 |
36 | if (loader) {
37 | loaders.push({
38 | loader: loader + '-loader',
39 | options: Object.assign({}, loaderOptions, {
40 | sourceMap: options.sourceMap
41 | })
42 | })
43 | }
44 |
45 | // Extract CSS when that option is specified
46 | // (which is the case during production build)
47 | if (options.extract) {
48 | return ExtractTextPlugin.extract({
49 | use: loaders,
50 | publicPath: '../../',
51 | fallback: 'vue-style-loader'
52 | })
53 | } else {
54 | return ['vue-style-loader'].concat(loaders)
55 | }
56 | }
57 |
58 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html
59 | return {
60 | css: generateLoaders(),
61 | postcss: generateLoaders(),
62 | less: generateLoaders('less'),
63 | sass: generateLoaders('sass', { indentedSyntax: true }),
64 | scss: generateLoaders('sass'),
65 | stylus: generateLoaders('stylus'),
66 | styl: generateLoaders('stylus')
67 | }
68 | }
69 |
70 | // Generate loaders for standalone style files (outside of .vue)
71 | exports.styleLoaders = function (options) {
72 | const output = []
73 | const loaders = exports.cssLoaders(options)
74 |
75 | for (const extension in loaders) {
76 | const loader = loaders[extension]
77 | output.push({
78 | test: new RegExp('\\.' + extension + '$'),
79 | use: loader
80 | })
81 | }
82 |
83 | return output
84 | }
85 |
86 | exports.createNotifierCallback = () => {
87 | const notifier = require('node-notifier')
88 |
89 | return (severity, errors) => {
90 | if (severity !== 'error') return
91 |
92 | const error = errors[0]
93 | const filename = error.file && error.file.split('!').pop()
94 |
95 | notifier.notify({
96 | title: packageConfig.name,
97 | message: severity + ': ' + error.name,
98 | subtitle: filename || '',
99 | icon: path.join(__dirname, 'logo.png')
100 | })
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/webpack.dev.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const utils = require('./utils')
3 | const webpack = require('webpack')
4 | const config = require('../config')
5 | const merge = require('webpack-merge')
6 | const path = require('path')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 | const CopyWebpackPlugin = require('copy-webpack-plugin')
9 | const HtmlWebpackPlugin = require('html-webpack-plugin')
10 | const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
11 | const portfinder = require('portfinder')
12 |
13 | const HOST = process.env.HOST
14 | const PORT = process.env.PORT && Number(process.env.PORT)
15 |
16 | const devWebpackConfig = merge(baseWebpackConfig, {
17 | module: {
18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
19 | },
20 | // cheap-module-eval-source-map is faster for development
21 | devtool: config.dev.devtool,
22 |
23 | // these devServer options should be customized in /config/index.js
24 | devServer: {
25 | clientLogLevel: 'warning',
26 | historyApiFallback: {
27 | rewrites: [
28 | { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
29 | ],
30 | },
31 | hot: true,
32 | contentBase: false, // since we use CopyWebpackPlugin.
33 | compress: true,
34 | host: HOST || config.dev.host,
35 | port: PORT || config.dev.port,
36 | open: config.dev.autoOpenBrowser,
37 | overlay: config.dev.errorOverlay
38 | ? { warnings: false, errors: true }
39 | : false,
40 | publicPath: config.dev.assetsPublicPath,
41 | proxy: config.dev.proxyTable,
42 | quiet: true, // necessary for FriendlyErrorsPlugin
43 | watchOptions: {
44 | poll: config.dev.poll,
45 | }
46 | },
47 | plugins: [
48 | new webpack.DefinePlugin({
49 | 'process.env': require('../config/dev.env')
50 | }),
51 | new webpack.HotModuleReplacementPlugin(),
52 | new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
53 | new webpack.NoEmitOnErrorsPlugin(),
54 | // https://github.com/ampedandwired/html-webpack-plugin
55 | new HtmlWebpackPlugin({
56 | filename: 'index.html',
57 | template: 'index.html',
58 | inject: true
59 | }),
60 | // copy custom static assets
61 | new CopyWebpackPlugin([
62 | {
63 | from: path.resolve(__dirname, '../static'),
64 | to: config.dev.assetsSubDirectory,
65 | ignore: ['.*']
66 | }
67 | ])
68 | ]
69 | })
70 |
71 | module.exports = new Promise((resolve, reject) => {
72 | portfinder.basePort = process.env.PORT || config.dev.port
73 | portfinder.getPort((err, port) => {
74 | if (err) {
75 | reject(err)
76 | } else {
77 | // publish the new Port, necessary for e2e tests
78 | process.env.PORT = port
79 | // add port to devServer config
80 | devWebpackConfig.devServer.port = port
81 |
82 | // Add FriendlyErrorsPlugin
83 | devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
84 | compilationSuccessInfo: {
85 | messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
86 | },
87 | onErrors: config.dev.notifyOnErrors
88 | ? utils.createNotifierCallback()
89 | : undefined
90 | }))
91 |
92 | resolve(devWebpackConfig)
93 | }
94 | })
95 | })
96 |
--------------------------------------------------------------------------------
/linux-install-shell/OneClick_StartAndStop/faBanShellByACME.sh:
--------------------------------------------------------------------------------
1 | # 定时任务发版脚本
2 | # 逻辑:定时像中央服务器发送请求,并对返回结果进行判断
3 |
4 | FABANMA="发版吗?"
5 | url="192.168.0.41:9999/xx/50";
6 | #downloadUrl="http://11.24.201.36:9090/ky_test/acme.war"
7 | echo $FABANMA
8 | echo "地址--------------->"$url
9 | #curl -i -X POST -H "'Content-type':'application/json'" -d '{"ATime":"'$atime'","BTime":"'$btime'"}' $url
10 | result=$(curl -d "FABANMA='$FABANMA'" $url)
11 | #将结果写道一个文件中去
12 | echo $result|awk 'NF{a=$0}END{print a}' >> xx.txt
13 | #获取结果最后一行 一般结果是中央服务器返回的数据结果 OK/notOK
14 | OK_notOK=$(awk 'NF{a=$0}END{print a}' xx.txt|cut -d " " -f5)
15 | echo "OK_notOK的结果是----------------->"$OK_notOK
16 | # 逻辑判断是否要发版
17 | if [ "OK" == $OK_notOK ]
18 | then
19 | echo "要发版,请注意发版!!!"
20 | # 发版脚本 目前只停止tomcat进程
21 | # 1.停止tomcat
22 | echo "停止tomcat服务开始。。。。。"
23 | num_tomcat=0
24 |
25 | pid_tomcats=$(ps -ef|grep tomcat|grep -v grep|awk '{print$2}')
26 |
27 | echo "tomcat进程id "$pid_tomcats
28 |
29 | # 当进程id有多个时候的需要循环遍历 遍历kill 进程
30 | for pid_tomcat in $pid_tomcats
31 | do
32 | if test $[pid_tomcat] -gt $[num_tomcat]
33 | then
34 | kill -9 $pid_tomcat echo "tomcat服务停止"
35 | else echo "tomcat服务未启动。。。"
36 | fi
37 | done
38 | # 切换目录到webapps
39 | # 2.备份linux服务器acme.war包 并删除原来的acme*
40 | cd /tools/acme_backup
41 | zip -r acme_$(date +"%Y-%m-%d-%H-%M").zip /tools/tomcat/apache-tomcat-8.5.29/webapps/acme/
42 |
43 | cd /tools/tomcat/apache-tomcat-8.5.29/webapps
44 |
45 | echo "压缩文件等待2秒钟.................."
46 |
47 | sleep 2s
48 |
49 | rm -rf acme*
50 |
51 |
52 | # 3.下载acme.war包 ky地址是 http://11.24.201.36:9090/ky/acme.war
53 |
54 | mkdir acme
55 | cd /tools/tomcat/apache-tomcat-8.5.29/webapps/acme
56 | #wget http://11.24.201.36:8080/ky/acme.war
57 |
58 | echo "-------------downloading start---------------"
59 |
60 | wget http://192.168.0.41:8080/bs/acme.war
61 |
62 | echo "------------downloading end-----------------"
63 | #cp acme.war /tools/tomcat/apache-tomcat-8.5.29/webapps
64 | mv acme.war acme.zip
65 | unzip acme.zip
66 |
67 | echo "解压文件等待2秒钟.................."
68 |
69 | sleep 2s
70 |
71 | rm -rf acme.zip
72 |
73 | # 4.启动tomcat解压acme.war包 并等待5秒 并停止tomcat进程
74 | cd /tools/tomcat/apache-tomcat-8.5.29/bin
75 | ./startup.sh
76 |
77 | # 5. 停止tomcat
78 | echo "tomcat服务启动等待10秒钟.................."
79 |
80 | sleep 10s
81 |
82 |
83 | # 停止tomcat
84 | echo "停止tomcat服务开始。。。。。"
85 | num_tomcatt=0
86 |
87 | pid_tomcatts=$(ps -ef|grep tomcat|grep -v grep|awk '{print$2}')
88 |
89 | echo "tomcatt进程id "$pid_tomcatts
90 |
91 | # 当进程id有多个时候的需要循环遍历 遍历kill 进程
92 | for pid_tomcatt in $pid_tomcatts
93 | do
94 | if test $[pid_tomcatt] -gt $[num_tomcatt]
95 | then
96 | kill -9 $pid_tomcatt echo "tomcat服务停止"
97 | else echo "tomcat服务未启动。。。"
98 | fi
99 | done
100 |
101 | echo "停止tomcat服务等待5s----------------------------------"
102 |
103 | sleep 5s
104 |
105 |
106 | # 6. 删掉之前的配置文件
107 | cd /tools/tomcat/apache-tomcat-8.5.29/webapps/acme/WEB_INF/classes/
108 | rm -rf application-test.properties*
109 |
110 |
111 | # 7. 替换原来的war中的配置文件 (2个文件)
112 |
113 | cd /tools/tomcat/apache-tomcat-8.5.29/webapps/serverSetting
114 |
115 | cp application-test.properties* /tools/tomcat/apache-tomcat-8.5.29/webapps/acme/WEB-INF/classes/
116 |
117 |
118 | # 8. 启动tomcat
119 | cd /tools/tomcat/apache-tomcat-8.5.29/bin
120 | nohup ./startup.sh &
121 |
122 |
123 | # 9. 查看启动日志
124 | tail -f /tools/tomcat/apache-tomcat-8.5.29/logs/catalina.out
125 |
126 | elif [ "notOK" == $OK_notOK ]
127 | then
128 | echo "不要发版,请注意不要发版!!!"
129 | exit;
130 | else
131 | echo "没有符合的条件"
132 | # 退出当前shell脚本
133 | exit;
134 | fi
135 |
136 |
137 |
--------------------------------------------------------------------------------
/linux-install-shell/OneClick_StartAndStop/acme_killAll.sh:
--------------------------------------------------------------------------------
1 | # 依次停止各个服务 Author by huangweilin -- 2018-04-17
2 |
3 | # # ######################################### # #
4 |
5 | # 强制终止服务器 #
6 |
7 | # # ######################################## # #
8 |
9 |
10 |
11 |
12 | #------------------------------------ 1.停止tomcat服务器
13 |
14 | echo "停止tomcat服务开始。。。。。"
15 |
16 | pid_tomcats=$(ps -ef|grep tomcat|grep -v grep|awk '{print$2}')
17 |
18 | echo "tomcat的进程id是 "$pid_tomcats
19 |
20 | # 判断一下服务是否还存在 如果存在才去杀进程
21 |
22 | num_tomcat=0
23 | for pid_tomcat in $pid_tomcats
24 | do
25 | if test $[pid_tomcat] -gt $[num_tomcat]
26 | then
27 | kill -9 $pid_tomcat echo "tomcat服务停止"
28 | else echo "tomcat服务未启动。。。。"
29 | fi
30 | done
31 | #--------------------------------------- 2.停止zookeeper服务
32 |
33 | echo "停止zookeeper服务开始。。。。"
34 |
35 | pid_zookeepers=$(ps -ef|grep zookeeper|grep -v grep|awk '{print$2}')
36 |
37 | echo "zookeeper的进程id是 "$pid_zookeepers
38 |
39 | # 判断一下服务是否还存在 如果存在才去杀进程
40 |
41 | num_zookeeper=0
42 | for pid_zookeeper in $pid_zookeepers
43 | do
44 | if test $[pid_zookeeper] -gt $[num_zookeeper]
45 | then
46 | kill -9 $pid_zookeeper echo "zookeeper服务停止"
47 | else echo "zookeeper服务未启动。。。。"
48 | fi
49 | done
50 | #---------------------------------------3.停止redis服务
51 |
52 | echo "停止redis服务开始。。。。"
53 |
54 | num_redis=0
55 |
56 | pid_rediss=$(ps -ef|grep redis|grep -v grep |awk '{print$2}')
57 |
58 | echo "redis的进程id是 "$pid_rediss
59 |
60 | # 判断一下服务是否还存在 如果存在才去杀进程
61 |
62 | for pid_redis in $pid_rediss
63 | do
64 | if test $[pid_redis] -gt $[num_redis]
65 | then
66 | kill -9 $pid_redis echo "redis服务停止"
67 | else echo "redis服务未启动。。。。"
68 | fi
69 | done
70 | #---------------------------------------4.停止mongodb服务
71 | echo "停止mongodb服务"
72 |
73 | num_mongodb=0
74 |
75 | pid_mongodbs=$(ps -ef|grep mongodb|grep -v grep|awk '{print$2}')
76 |
77 | echo "mongodb的进程id是 "$pid_mongodbs
78 | for pid_mongodb in $pid_mongodbs
79 | do
80 | if test $[pid_mongodb] -gt $[num_mongodb]
81 | then
82 | kill -9 $pid_mongodb echo "mongodb服务停止"
83 | else echo "mongodb服务未启动。。。"
84 | fi
85 | done
86 | #---------------------------------------5.停止vacar服务
87 | echo "停止vacar服务"
88 |
89 | num_vacar=0
90 |
91 | pid_vacars=$(ps -ef|grep VicaServer|grep -v grep|awk '{print$2}')
92 |
93 | echo "vacar进程id "$pid_vacars
94 |
95 | # 当进程id有多个时候的需要循环遍历 遍历kill 进程
96 |
97 | for pid_vacar in $pid_vacars
98 | do
99 | if test $[pid_vacar] -gt $[num_vacar]
100 | then
101 | kill -9 $pid_vacar echo "vertx服务停止"
102 | else echo "vertx服务未启动。。。"
103 | fi
104 | done
105 |
106 | #--------------------------------------6.停止vertx服务
107 | echo "停止vertx服务"
108 |
109 | num_vertx=0
110 |
111 | pid_vertxs=$(ps -ef|grep vertx|grep -v grep|awk '{print$2}')
112 |
113 | echo "vertx进程id "$pid_vertxs
114 |
115 | # 当进程id有多个时候的需要循环遍历 遍历kill 进程
116 |
117 | for pid_vertx in $pid_vertxs
118 | do
119 | if test $[pid_vertx] -gt $[num_vertx]
120 | then
121 | kill -9 $pid_vertx echo "vertx服务停止"
122 | else echo "vertx服务未启动。。。"
123 | fi
124 | done
125 |
126 | #-------------------------------------7.停止nginx服务
127 |
128 | echo "停止nginx服务"
129 |
130 | num_nginx=0
131 |
132 | pid_nginxs=$(ps -ef|grep nginx|grep -v grep|awk '{print$2}')
133 |
134 | echo "nginx进程id "$pid_nginxs
135 |
136 | # 当进程id有多个时候的需要循环遍历 遍历kill 进程
137 |
138 | for pid_nginx in $pid_nginxs
139 | do
140 | if test $[pid_nginx] -gt $[num_nginx]
141 | then
142 | kill -9 $pid_nginx echo "nginx服务停止"
143 | else echo "nginx服务未启动。。。"
144 | fi
145 | done
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/util/Util.java:
--------------------------------------------------------------------------------
1 | package com.example.util;
2 |
3 | import java.beans.BeanInfo;
4 | import java.beans.IntrospectionException;
5 | import java.beans.Introspector;
6 | import java.beans.PropertyDescriptor;
7 | import java.lang.reflect.InvocationTargetException;
8 | import java.text.DecimalFormat;
9 | import java.text.SimpleDateFormat;
10 | import java.util.Date;
11 | import java.util.Map;
12 |
13 | /**
14 | * 工具类
15 | */
16 | public class Util {
17 |
18 |
19 | /**
20 | * 将一个 Map 对象转化为一个 JavaBean
21 | * @param type 要转化的类型
22 | * @param map 包含属性值的 map
23 | * @return 转化出来的 JavaBean 对象
24 | * @throws IntrospectionException 如果分析类属性失败
25 | * @throws IllegalAccessException 如果实例化 JavaBean 失败
26 | * @throws InstantiationException 如果实例化 JavaBean 失败
27 | * @throws InvocationTargetException 如果调用属性的 setter 方法失败
28 | */
29 | @SuppressWarnings("rawtypes")
30 | public static Object convertMap(Class type, Map map)
31 | throws IntrospectionException, IllegalAccessException,
32 | InstantiationException, InvocationTargetException {
33 | BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性
34 | Object obj = type.newInstance(); // 创建 JavaBean 对象
35 |
36 | // 给 JavaBean 对象的属性赋值
37 | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
38 | for (int i = 0; i< propertyDescriptors.length; i++) {
39 | PropertyDescriptor descriptor = propertyDescriptors[i];
40 | String propertyName = descriptor.getName();
41 |
42 | if (map.containsKey(propertyName)) {
43 | // 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
44 | Object value = map.get(propertyName);
45 |
46 | Object[] args = new Object[1];
47 | args[0] = value;
48 |
49 | descriptor.getWriteMethod().invoke(obj, args);
50 | }
51 | }
52 | return obj;
53 | }
54 |
55 | /**
56 | * 根据参数日期格式 获取当前时间格式化为字符串
57 | * @param str 日期格式
58 | * @return
59 | */
60 | public static String dateFormat(String str){
61 | //我要获取当前的日期
62 | Date date = new Date();
63 | //设置要获取到什么样的时间
64 | SimpleDateFormat sdf = new SimpleDateFormat(str);
65 | //获取String类型的时间
66 | String createdate = sdf.format(date);
67 | return createdate;
68 | }
69 |
70 | /**
71 | * java 把byte转化为KB、MB、GB的方法
72 | * @param size
73 | * @return
74 | */
75 | public static String getNetFileSizeDescription(long size) {
76 | StringBuffer bytes = new StringBuffer();
77 | DecimalFormat format = new DecimalFormat("###.0");
78 | if (size >= 1024 * 1024 * 1024) {
79 | double i = (size / (1024.0 * 1024.0 * 1024.0));
80 | bytes.append(format.format(i)).append("GB");
81 | }
82 | else if (size >= 1024 * 1024) {
83 | double i = (size / (1024.0 * 1024.0));
84 | bytes.append(format.format(i)).append("MB");
85 | }
86 | else if (size >= 1024) {
87 | double i = (size / (1024.0));
88 | bytes.append(format.format(i)).append("KB");
89 | }
90 | else if (size < 1024) {
91 | if (size <= 0) {
92 | bytes.append("0B");
93 | }
94 | else {
95 | bytes.append((int) size).append("B");
96 | }
97 | }
98 | return bytes.toString();
99 | }
100 |
101 | /**
102 | * 根据参数保留小数位数
103 | * @param number 要处理的数据
104 | * @param str 保留位数 字符 如:'0.00'
105 | * @return
106 | */
107 | public static Double decimalNumber(Double number,String str){
108 | DecimalFormat df = new DecimalFormat("######"+str);
109 | if(number>0){
110 | return Double.valueOf(df.format(number));
111 | }else {
112 | return 0.0d;
113 | }
114 |
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 系统登录
5 |
6 |
7 |
8 |
9 |
10 |
11 | 记住账户
12 |
13 | 登录
14 |
15 |
16 |
17 |
18 |
19 |
89 |
90 |
114 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/dao/impl/UserDaoImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.dao.impl;
2 |
3 |
4 | import com.example.dao.UserDao;
5 | import com.example.demo.Entity.Fanban;
6 | import com.example.demo.Entity.UserEntity;
7 | import org.springframework.beans.factory.annotation.Autowired;
8 | import org.springframework.data.domain.Sort;
9 | import org.springframework.data.mongodb.core.MongoTemplate;
10 | import org.springframework.data.mongodb.core.query.Criteria;
11 | import org.springframework.data.mongodb.core.query.Query;
12 | import org.springframework.data.mongodb.core.query.Update;
13 | import org.springframework.stereotype.Component;
14 |
15 | import java.util.List;
16 |
17 | @Component
18 | public class UserDaoImpl implements UserDao {
19 |
20 | @Autowired
21 | private MongoTemplate mongoTemplate;
22 |
23 | /**
24 | * 创建对象
25 | * @param user
26 | */
27 | @Override
28 | public void saveUser(UserEntity user) {
29 | mongoTemplate.save(user);
30 | }
31 |
32 | /**
33 | * 根据用户名查询对象
34 | * @param userName
35 | * @return
36 | */
37 | @Override
38 | public UserEntity findUserByUserName(String userName) {
39 | Query query=new Query(Criteria.where("userName").is(userName));
40 | UserEntity user = mongoTemplate.findOne(query , UserEntity.class);
41 | return user;
42 | }
43 |
44 | /**
45 | * 更新对象
46 | * @param user
47 | */
48 | @Override
49 | public int updateUser(UserEntity user) {
50 | Query query=new Query(Criteria.where("id").is(user.getId()));
51 | Update update= new Update().set("userName", user.getUserName()).set("passWord", user.getPassWord());
52 | //更新查询返回结果集的第一条
53 | mongoTemplate.updateFirst(query,update,UserEntity.class);
54 | //更新查询返回结果集的所有
55 | return 0;
56 | }
57 |
58 | /**
59 | * 删除对象
60 | * @param id
61 | */
62 | @Override
63 | public void deleteUserById(Long id) {
64 | Query query=new Query(Criteria.where("id").is(id));
65 | mongoTemplate.remove(query,UserEntity.class);
66 | }
67 |
68 | @Override
69 | public UserEntity findUser(UserEntity user) {
70 | Query query=new Query(Criteria.where("userName").is(user.getUserName()).and("passWord").is(user.getPassWord()));
71 | UserEntity userEntity = mongoTemplate.findOne(query , UserEntity.class);
72 | return userEntity;
73 | }
74 |
75 | @Override
76 | public void saveFaban(Fanban fanban) {
77 |
78 | mongoTemplate.save(fanban);
79 | }
80 |
81 | @Override
82 | public Fanban findUserByIsOK(String isOK,String ip) {
83 | Query query=new Query(Criteria.where("isOK").is(isOK).and("ip").is(ip));
84 | Fanban fanban = mongoTemplate.findOne(query , Fanban.class);
85 | return fanban;
86 | }
87 |
88 | @Override
89 | public int updateFaban(Fanban fanban) {
90 | Query query=new Query(Criteria.where("id").is(fanban.getId()));
91 | Update update= new Update()
92 | .set("userName", fanban.getIsOK())
93 | .set("isOK", fanban.getIsOK())
94 | .set("ip",fanban.getIp())
95 | .set("serverOwnership",fanban.getServerOwnership())
96 | .set("remarks",fanban.getRemarks())
97 | .set("updateTime",fanban.getUpdateTime());
98 | //更新查询返回结果集的第一条
99 | mongoTemplate.updateFirst(query,update,Fanban.class);
100 | return 0;
101 | }
102 |
103 | @Override
104 | public void deleteFabanById(String id) {
105 |
106 | Query query=new Query(Criteria.where("id").is(id));
107 | mongoTemplate.remove(query,Fanban.class);
108 |
109 | }
110 |
111 | @Override
112 | public List findAll(Fanban fanban) {
113 | Query query=new Query();
114 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC,"creationDate")));
115 | List all = mongoTemplate.find(query,Fanban.class);
116 | return all;
117 |
118 | }
119 |
120 | /**
121 | * 根据ip获取对象
122 | * @param ip
123 | * @return
124 | */
125 | @Override
126 | public Fanban findFaban(String ip) {
127 | Query query=new Query(Criteria.where("ip").is(ip));
128 | Fanban fanban = mongoTemplate.findOne(query , Fanban.class);
129 | return fanban;
130 | }
131 |
132 | }
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/dao/impl/ServiceProcessDaoImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.dao.impl;
2 |
3 | import com.example.dao.ServiceProcessDao;
4 | import com.example.demo.Entity.ServiceProcess;
5 | import com.mongodb.client.result.DeleteResult;
6 | import com.mongodb.client.result.UpdateResult;
7 | import org.apache.commons.lang.StringUtils;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.data.domain.Sort;
10 | import org.springframework.data.mongodb.core.MongoTemplate;
11 | import org.springframework.data.mongodb.core.query.Criteria;
12 | import org.springframework.data.mongodb.core.query.Query;
13 | import org.springframework.data.mongodb.core.query.Update;
14 | import org.springframework.stereotype.Component;
15 |
16 | import java.util.ArrayList;
17 | import java.util.List;
18 |
19 | @Component
20 | public class ServiceProcessDaoImpl implements ServiceProcessDao{
21 |
22 | @Autowired
23 | private MongoTemplate mongoTemplate;
24 |
25 |
26 | @Override
27 | public int saveServiceProcess(ServiceProcess serviceProcess) {
28 | //根据名字查询是否存在,验证服务进程名是否重复
29 | Query query=new Query(Criteria.where("name").is(serviceProcess.getName()));
30 | List serviceProcessList= mongoTemplate.find(query,ServiceProcess.class);
31 | if(serviceProcessList.size()>0){
32 | return 2;//代表服务进程名已存在
33 | }
34 | try {
35 | mongoTemplate.save(serviceProcess);
36 | return 1;//代表添加成功
37 | }catch (Exception e){
38 | return 0;//代表添加失败
39 | }
40 | }
41 |
42 | @Override
43 | public List getServiceProcessList(ServiceProcess serviceProcess) {
44 | Query query=new Query();
45 | if(StringUtils.isNotBlank(serviceProcess.getIp())){
46 | if(StringUtils.isNotBlank(serviceProcess.getName())){
47 | query.addCriteria(Criteria.where("ip").is(serviceProcess.getIp()).and("name").is(serviceProcess.getName()));
48 | }else if(StringUtils.isNotBlank(serviceProcess.getStatus())){
49 | query.addCriteria(Criteria.where("ip").is(serviceProcess.getIp()).and("status").is(serviceProcess.getStatus()));
50 | }else if(StringUtils.isNotBlank(serviceProcess.getStatus())
51 | && StringUtils.isNotBlank(serviceProcess.getName())){
52 | query.addCriteria(Criteria.where("ip").is(serviceProcess.getIp())
53 | .and("name").is(serviceProcess.getName())
54 | .and("status").is(serviceProcess.getStatus()));
55 | }else {
56 | query.addCriteria(Criteria.where("ip").is(serviceProcess.getIp()));
57 | }
58 | }
59 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC,"creationDate")));
60 | List serviceProcessList= mongoTemplate.find(query,ServiceProcess.class);
61 | return serviceProcessList;
62 | }
63 | @Override
64 | public Long deleteServiceProcess(ServiceProcess serviceProcess) {
65 | Query query=new Query(Criteria.where("token").is(serviceProcess.getToken()));
66 | DeleteResult a= mongoTemplate.remove(query,ServiceProcess.class);
67 | return a.getDeletedCount();
68 | }
69 |
70 | @Override
71 | public List getServiceProcessName(ServiceProcess serviceProcess) {
72 | Query query=new Query(Criteria.where("name").is(serviceProcess.getName()));
73 | List serviceProcessList= mongoTemplate.find(query,ServiceProcess.class);
74 | return serviceProcessList;
75 | }
76 |
77 | @Override
78 | public Long updateServiceProcess(ServiceProcess serviceProcess) {
79 |
80 | Query query=new Query();
81 | if(StringUtils.isBlank(serviceProcess.getMarked())) {
82 | /**
83 | * 更改临时状态
84 | * 说明:如果参数状态为1:启动服务进程,就修改为临时状态3:正在启动进程服务...
85 | * 如果参数状态为2:终止服务进程,就修改为临时状态4:正在终止进程服务...
86 | * 当服务器脚本执行完操作 回调信息请求回来 再修改状态为1/2
87 | */
88 | if (serviceProcess.getStatus().equals("1")) {
89 | serviceProcess.setStatus("3");
90 | } else if (serviceProcess.getStatus().equals("2")) {
91 | serviceProcess.setStatus("4");
92 | }
93 | query.addCriteria(Criteria.where("token").is(serviceProcess.getToken()));
94 | }else {
95 | query.addCriteria(Criteria.where("name").is(serviceProcess.getName()).and("ip").is(serviceProcess.getIp()));
96 | }
97 |
98 | Update update= new Update()
99 | .set("ip", serviceProcess.getIp())
100 | .set("name", serviceProcess.getName())
101 | .set("status",serviceProcess.getStatus())
102 | .set("remarks",serviceProcess.getRemarks())
103 | .set("updateTime",serviceProcess.getUpdateTime());
104 | UpdateResult result= mongoTemplate.upsert(query,update,ServiceProcess.class);
105 | return result.getMatchedCount();
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/service-monitoring/src/test/java/com/example/demo/DemoApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.example.demo;
2 |
3 | import com.example.dao.LinuxServerDao;
4 | import com.example.dao.ServiceProcessDao;
5 | import com.example.dao.UserDao;
6 | import com.example.demo.Entity.*;
7 | import com.example.demo.EntityList.ServiceCourse;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.springframework.beans.factory.annotation.Autowired;
11 | import org.springframework.boot.test.context.SpringBootTest;
12 | import org.springframework.test.context.junit4.SpringRunner;
13 |
14 | import java.util.List;
15 | import java.util.UUID;
16 |
17 | @RunWith(SpringRunner.class)
18 | @SpringBootTest
19 | public class DemoApplicationTests {
20 |
21 | @Autowired
22 | private UserDao userDao;
23 | @Autowired
24 | private LinuxServerDao linuxServerDao;
25 | @Autowired
26 | private ServiceProcessDao serviceProcessDao;
27 |
28 | @Test
29 | public void testsaveServiceProcess(){
30 | ServiceProcess sp=new ServiceProcess();
31 | //生成32位uuid
32 | String uuID= UUID.randomUUID().toString().replace("-", "");
33 | sp.setToken(uuID);
34 | sp.setIp("192.168.0.73");
35 | sp.setName("tomcat5");
36 | sp.setStatus("0");
37 | sp.setRemarks("备注");
38 | serviceProcessDao.saveServiceProcess(sp);
39 | }
40 |
41 | @Test
42 | public void testgetServiceProcess(){
43 | List sp=linuxServerDao.getServiceProcess("4cb12a8545f04e5887a90f422beedbf0",0);
44 | System.err.println(sp);
45 | }
46 | @Test
47 | public void testgetServerDetails(){
48 | ServerDetails sd=linuxServerDao.getServerDetails("4cb12a8545f04e5887a90f422beedbf0");
49 | System.err.println(sd);
50 | }
51 | @Test
52 | public void testGetLinuxServerList(){
53 | UnilizationRatio ls= linuxServerDao.getLinuxServerList("4cb12a8545f04e5887a90f422beedbf0","2018-06-19","11:05","12:05");
54 | System.err.println(ls);
55 | }
56 |
57 | @Test
58 | public void testSaveUser() throws Exception {
59 | UserEntity user=new UserEntity();
60 | user.setId(1L);
61 | user.setUserName("admin");
62 | user.setPassWord("admin123");
63 | userDao.saveUser(user);
64 |
65 | UserEntity user2=new UserEntity();
66 | user2.setId(2L);
67 | user2.setUserName("admin001");
68 | user2.setPassWord("admin123");
69 | userDao.saveUser(user2);
70 | }
71 |
72 | // 测试faban实体
73 | @Test
74 | public void testSaveFaban() throws Exception {
75 | Fanban fanban79=new Fanban();
76 | fanban79.setId("1");
77 | System.out.println();
78 | fanban79.setIsOK("OK");
79 | fanban79.setIp("11.24.200.79");
80 | fanban79.setServerOwnership("康师傅(康饮)");
81 | fanban79.setRemarks("");
82 | userDao.saveFaban(fanban79);
83 |
84 |
85 | Fanban fanban27=new Fanban();
86 | fanban27.setId("2");
87 | fanban27.setIsOK("notOK");
88 | fanban27.setIp("11.24.200.27");
89 | fanban27.setServerOwnership("康师傅(康饮)");
90 | fanban27.setRemarks("");
91 | userDao.saveFaban(fanban27);
92 |
93 |
94 |
95 | Fanban fanban172=new Fanban();
96 | fanban172.setId("3");
97 | fanban172.setIsOK("notOK");
98 | fanban172.setIp("11.24.201.172");
99 | fanban172.setServerOwnership("康师傅(康饮)");
100 | fanban172.setRemarks("");
101 | userDao.saveFaban(fanban172);
102 |
103 |
104 | Fanban fanban224=new Fanban();
105 | fanban224.setId("4");
106 | fanban224.setIsOK("notOK");
107 | fanban224.setIp("11.24.200.224");
108 | fanban224.setServerOwnership("康师傅(康饮)");
109 | fanban224.setRemarks("");
110 | userDao.saveFaban(fanban224);
111 |
112 |
113 |
114 | Fanban fanban223=new Fanban();
115 | fanban223.setId("5");
116 | fanban223.setIsOK("OK");
117 | fanban223.setIp("11.24.201.223");
118 | fanban223.setServerOwnership("康师傅(百饮)");
119 | fanban223.setRemarks("");
120 | userDao.saveFaban(fanban223);
121 |
122 | Fanban fanban6=new Fanban();
123 | fanban6.setId("6");
124 | fanban6.setIsOK("OK");
125 | fanban6.setIp("11.24.201.6");
126 | fanban6.setServerOwnership("康师傅(百饮)");
127 | fanban6.setRemarks("");
128 | userDao.saveFaban(fanban6);
129 |
130 | Fanban fanban230=new Fanban();
131 | fanban230.setId("7");
132 | fanban230.setIsOK("OK");
133 | fanban230.setIp("11.24.200.230");
134 | fanban230.setServerOwnership("康师傅(百饮)");
135 | fanban230.setRemarks("");
136 | userDao.saveFaban(fanban230);
137 |
138 | Fanban fanban231=new Fanban();
139 | fanban231.setId("8");
140 | fanban231.setIsOK("OK");
141 | fanban231.setIp("11.24.200.231");
142 | fanban231.setServerOwnership("康师傅(百饮)");
143 | fanban231.setRemarks("");
144 | userDao.saveFaban(fanban231);
145 |
146 | }
147 |
148 | @Test
149 | public void updateFaban(){
150 | Fanban fanban223=new Fanban();
151 | fanban223.setId("5");
152 | fanban223.setIsOK("OK");
153 | fanban223.setIp("11.24.201.223");
154 | userDao.updateFaban(fanban223);
155 | }
156 |
157 |
158 |
159 |
160 |
161 |
162 | @Test
163 | public void testSaveFaban_27() throws Exception {
164 | Fanban fanban=new Fanban();
165 | fanban.setId("4");
166 | fanban.setIsOK("notOK");
167 | fanban.setIp("11.24.200.xxxxxxxxx");
168 | userDao.saveFaban(fanban);
169 | }
170 |
171 |
172 |
173 |
174 |
175 |
176 | @Test
177 | public void findUserByUserName(){
178 | UserEntity user= userDao.findUserByUserName("小明");
179 | System.out.println("user is "+user);
180 | }
181 |
182 | @Test
183 | public void updateUser(){
184 | UserEntity user=new UserEntity();
185 | user.setId(2l);
186 | user.setUserName("天空");
187 | user.setPassWord("fffxxxx");
188 | userDao.updateUser(user);
189 | }
190 |
191 | @Test
192 | public void deleteUserById(){
193 | userDao.deleteUserById(1l);
194 | }
195 | @Test
196 | public void findFaban(){
197 | Fanban fanban =userDao.findFaban("11.24.200.79");
198 | System.err.println(fanban.getIp());
199 | }
200 | }
201 |
--------------------------------------------------------------------------------
/db-service-monitoring/build/webpack.prod.conf.js:
--------------------------------------------------------------------------------
1 | 'use strict'
2 | const path = require('path')
3 | const utils = require('./utils')
4 | const webpack = require('webpack')
5 | const config = require('../config')
6 | const merge = require('webpack-merge')
7 | const baseWebpackConfig = require('./webpack.base.conf')
8 | const CopyWebpackPlugin = require('copy-webpack-plugin')
9 | const HtmlWebpackPlugin = require('html-webpack-plugin')
10 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
11 | const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
12 | const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
13 |
14 | const env = process.env.NODE_ENV === 'testing'
15 | ? require('../config/test.env')
16 | : require('../config/prod.env')
17 |
18 | const webpackConfig = merge(baseWebpackConfig, {
19 | module: {
20 | rules: utils.styleLoaders({
21 | sourceMap: config.build.productionSourceMap,
22 | extract: true,
23 | usePostCSS: true
24 | })
25 | },
26 | devtool: config.build.productionSourceMap ? config.build.devtool : false,
27 | output: {
28 | path: config.build.assetsRoot,
29 | filename: utils.assetsPath('js/[name].[chunkhash].js'),
30 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
31 | },
32 | plugins: [
33 | // http://vuejs.github.io/vue-loader/en/workflow/production.html
34 | new webpack.DefinePlugin({
35 | 'process.env': env
36 | }),
37 | new UglifyJsPlugin({
38 | uglifyOptions: {
39 | compress: {
40 | warnings: false
41 | }
42 | },
43 | sourceMap: config.build.productionSourceMap,
44 | parallel: true
45 | }),
46 | // extract css into its own file
47 | new ExtractTextPlugin({
48 | filename: utils.assetsPath('css/[name].[contenthash].css'),
49 | // Setting the following option to `false` will not extract CSS from codesplit chunks.
50 | // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
51 | // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
52 | // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
53 | allChunks: true,
54 | }),
55 | // Compress extracted CSS. We are using this plugin so that possible
56 | // duplicated CSS from different components can be deduped.
57 | new OptimizeCSSPlugin({
58 | cssProcessorOptions: config.build.productionSourceMap
59 | ? { safe: true, map: { inline: false } }
60 | : { safe: true }
61 | }),
62 | // generate dist index.html with correct asset hash for caching.
63 | // you can customize output by editing /index.html
64 | // see https://github.com/ampedandwired/html-webpack-plugin
65 | new HtmlWebpackPlugin({
66 | filename: process.env.NODE_ENV === 'testing'
67 | ? 'index.html'
68 | : config.build.index,
69 | template: 'index.html',
70 | inject: true,
71 | minify: {
72 | removeComments: true,
73 | collapseWhitespace: true,
74 | removeAttributeQuotes: true
75 | // more options:
76 | // https://github.com/kangax/html-minifier#options-quick-reference
77 | },
78 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin
79 | chunksSortMode: 'dependency'
80 | }),
81 | // keep module.id stable when vendor modules does not change
82 | new webpack.HashedModuleIdsPlugin(),
83 | // enable scope hoisting
84 | new webpack.optimize.ModuleConcatenationPlugin(),
85 | // split vendor js into its own file
86 | new webpack.optimize.CommonsChunkPlugin({
87 | name: 'vendor',
88 | minChunks (module) {
89 | // any required modules inside node_modules are extracted to vendor
90 | return (
91 | module.resource &&
92 | /\.js$/.test(module.resource) &&
93 | module.resource.indexOf(
94 | path.join(__dirname, '../node_modules')
95 | ) === 0
96 | )
97 | }
98 | }),
99 | // extract webpack runtime and module manifest to its own file in order to
100 | // prevent vendor hash from being updated whenever app bundle is updated
101 | new webpack.optimize.CommonsChunkPlugin({
102 | name: 'manifest',
103 | minChunks: Infinity
104 | }),
105 | // This instance extracts shared chunks from code splitted chunks and bundles them
106 | // in a separate chunk, similar to the vendor chunk
107 | // see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
108 | new webpack.optimize.CommonsChunkPlugin({
109 | name: 'app',
110 | async: 'vendor-async',
111 | children: true,
112 | minChunks: 3
113 | }),
114 |
115 | // copy custom static assets
116 | new CopyWebpackPlugin([
117 | {
118 | from: path.resolve(__dirname, '../static'),
119 | to: config.build.assetsSubDirectory,
120 | ignore: ['.*']
121 | }
122 | ])
123 | ]
124 | })
125 |
126 | if (config.build.productionGzip) {
127 | const CompressionWebpackPlugin = require('compression-webpack-plugin')
128 |
129 | webpackConfig.plugins.push(
130 | new CompressionWebpackPlugin({
131 | asset: '[path].gz[query]',
132 | algorithm: 'gzip',
133 | test: new RegExp(
134 | '\\.(' +
135 | config.build.productionGzipExtensions.join('|') +
136 | ')$'
137 | ),
138 | threshold: 10240,
139 | minRatio: 0.8
140 | })
141 | )
142 | }
143 |
144 | if (config.build.bundleAnalyzerReport) {
145 | const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
146 | webpackConfig.plugins.push(new BundleAnalyzerPlugin())
147 | }
148 |
149 | module.exports = webpackConfig
150 |
--------------------------------------------------------------------------------
/.idea/artifacts/demo_war_exploded.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | $PROJECT_DIR$/service-monitoring/target/monitoring
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/service-monitoring/src/main/java/com/example/dao/impl/LinuxServerDaoImpl.java:
--------------------------------------------------------------------------------
1 | package com.example.dao.impl;
2 |
3 | import com.example.dao.LinuxServerDao;
4 | import com.example.demo.EntityList.*;
5 | import com.example.demo.Entity.LinuxServer;
6 | import com.example.demo.Entity.ServerDetails;
7 | import com.example.demo.Entity.UnilizationRatio;
8 | import com.example.util.Util;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.data.domain.Sort;
11 | import org.springframework.data.mongodb.core.MongoTemplate;
12 | import org.springframework.data.mongodb.core.query.Criteria;
13 | import org.springframework.data.mongodb.core.query.Query;
14 | import org.springframework.stereotype.Component;
15 |
16 | import java.text.NumberFormat;
17 | import java.util.ArrayList;
18 | import java.util.List;
19 |
20 | @Component
21 | public class LinuxServerDaoImpl implements LinuxServerDao {
22 | @Autowired
23 | private MongoTemplate mongoTemplate;
24 |
25 | /**
26 | * 保存采集的Linux系统数据
27 | *
28 | * @param linuxServer
29 | * @return
30 | */
31 | @Override
32 | public int saveLinuxServer(LinuxServer linuxServer) {
33 | try {
34 | mongoTemplate.save(linuxServer);
35 | return 1;
36 | } catch (Exception e) {
37 | return 0;
38 | }
39 | }
40 |
41 | /**
42 | * 根据token(服务器唯一标示)参数获取服务器信息
43 | *
44 | * @param token
45 | * @return
46 | */
47 | @Override
48 | public UnilizationRatio getLinuxServerList(String token, String dateTime, String startTime, String finishTime) {
49 | //开始拼接日期参数
50 | startTime = dateTime + " " + startTime;//拼接开始时间
51 | finishTime = dateTime + " " + finishTime;//拼接结束时间
52 | UnilizationRatio result = new UnilizationRatio();//存储最终返回数据结果
53 | Query query = new Query(Criteria.where("token").is(token).and("creationDate").gte(startTime).lte(finishTime));
54 | List linuxServerList = mongoTemplate.find(query, LinuxServer.class);
55 | Double[] disk = new Double[linuxServerList.size()];//硬盘使用率数组
56 | Double[] ram = new Double[linuxServerList.size()];//内存使用率数组
57 | Double[] cpu = new Double[linuxServerList.size()];//cpu使用率数组
58 | String[] dataArr = new String[linuxServerList.size()];//时间
59 | int i = 0;
60 | for (LinuxServer ls : linuxServerList) {
61 | Long disk_total = Long.valueOf(ls.getDisk_total());//硬盘总数
62 | Long disk_usage = Long.valueOf(ls.getDisk_usage());//硬盘使用数
63 | Long ram_total = Long.valueOf(ls.getRam_total());//内存总数
64 | Long ram_usage = Long.valueOf(ls.getRam_usage());//内存使用总数
65 | // 创建一个数值格式化对象
66 | NumberFormat numberFormat = NumberFormat.getInstance();
67 | // 设置精确到小数点后2位
68 | numberFormat.setMaximumFractionDigits(2);
69 | //计算硬盘使用率
70 | String diskResult = numberFormat.format((float) disk_usage / (float) disk_total * 100);
71 | //计算内存使用率
72 | String ramReault = numberFormat.format((float) ram_usage / (float) ram_total * 100);
73 | //开始封装返回数据
74 | disk[i] = Double.valueOf(diskResult);
75 | ram[i] = Double.valueOf(ramReault);
76 | cpu[i] = Double.valueOf(ls.getLoad_cpu());
77 | dataArr[i] = ls.getCreationDate().substring(11, 16);//截取时分
78 | i++;
79 | /* if (i == 12) {//防止数组赋值越界
80 | break;
81 | }*/
82 | }
83 | result.setDisk(disk);
84 | result.setRam(ram);
85 | result.setCpu(cpu);
86 | result.setDataArr(dataArr);
87 | return result;
88 | }
89 |
90 | /**
91 | * 获取服务器配置信息(处理计算后)
92 | *
93 | * @param token:服务器唯一标识
94 | * @return
95 | */
96 | @Override
97 | public ServerDetails getServerDetails(String token) {
98 | Query query = new Query(Criteria.where("token").is(token));
99 | query.skip(0);// skip相当于从那条记录开始
100 | query.limit(1);// 从skip开始,取多少条记录
101 | //按创建时间倒序排列
102 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "creationDate")));
103 | List linuxServerList = mongoTemplate.find(query, LinuxServer.class);
104 | Long uptime = Long.valueOf(linuxServerList.get(0).getUptime());//转换类型
105 | Long days = uptime / (24 * 60 * 60);//换算为天数
106 | //把Bytes根据数值大小转换为KB,MB,GB
107 | //接收流量
108 | String rx = Util.getNetFileSizeDescription(Long.valueOf(linuxServerList.get(0).getRx()));
109 | //发送流量
110 | String tx = Util.getNetFileSizeDescription(Long.valueOf(linuxServerList.get(0).getTx()));
111 | ServerDetails sd = new ServerDetails();
112 | sd.setUptime(days.toString());
113 | sd.setCpuName(linuxServerList.get(0).getCpu_name());
114 | sd.setOsName(linuxServerList.get(0).getOs_name() + linuxServerList.get(0).getOs_arch());
115 | sd.setIp(linuxServerList.get(0).getIpv4());
116 | sd.setCpuFreq(linuxServerList.get(0).getCpu_cores() + "x" + linuxServerList.get(0).getCpu_freq());
117 | sd.setOsKernel(linuxServerList.get(0).getOs_kernel());
118 | sd.setRx(rx);
119 | sd.setTx(tx);
120 | sd.setConnections(linuxServerList.get(0).getConnections());
121 | sd.setNic(linuxServerList.get(0).getNic());
122 | sd.setSessions(linuxServerList.get(0).getSessions());
123 | sd.setProcesses(linuxServerList.get(0).getProcesses());
124 | return sd;
125 | }
126 |
127 | //获取服务器各服务进程信息
128 | @Override
129 | public List getServiceProcess(String token,int count) {
130 | Query query = new Query(Criteria.where("token").is(token));
131 | query.skip(0);// skip相当于从那条记录开始
132 | query.limit(1);// 从skip开始,取多少条记录
133 | //按创建时间倒序排列
134 | query.with(new Sort(new Sort.Order(Sort.Direction.DESC, "creationDate")));
135 | List linuxServerList = mongoTemplate.find(query, LinuxServer.class);
136 | //获取processes_array:进程列队
137 | String processes = linuxServerList.get(0).getProcesses_array();
138 | String[] processes_array = processes.split(";");//按分号分割字符串
139 | List stringList = new ArrayList<>();
140 | /**
141 | * 循环筛选必要的进程信息保存在stringList
142 | * 有的服务进程是不要的
143 | */
144 | for (int i = 0; i < processes_array.length; i++) {
145 | stringList.add(processes_array[i]);
146 | }
147 |
148 | //实例各个服务进程对象并调用计算各个进程cop,内存占用方法
149 | List serviceCourseList = new ArrayList<>();
150 | List scList = new ArrayList<>();
151 | //封装解析后的进程数据
152 | for (String str : stringList) {
153 | String[] sc_str = str.split(" ");
154 | ServiceCourse sc = new ServiceCourse();
155 | sc.setUser(sc_str[0]);
156 | sc.setCpu(sc_str[1]);
157 | sc.setmMemory(Util.getNetFileSizeDescription(Long.valueOf(sc_str[2])));
158 | sc.setName(sc_str[3]);
159 | serviceCourseList.add(sc);
160 | }
161 | //根据count参数 保留要显示的数据
162 | //count>0 表示根据count数值显示,否则显示全部
163 | if(count>0){
164 | for(int i=0;i /dev/null 2>&1
83 | then
84 | os_name=$(prep "$(cat /etc/*release | grep '^PRETTY_NAME=\|^NAME=\|^DISTRIB_ID=' | awk -F\= '{ print $2 }' | tr -d '"' | tac)")
85 | fi
86 |
87 | if [ -z "$os_name" ]
88 | then
89 | if [ -e /etc/redhat-release ]
90 | then
91 | os_name=$(prep "$(cat /etc/redhat-release)")
92 | elif [ -e /etc/debian_version ]
93 | then
94 | os_name=$(prep "Debian $(cat /etc/debian_version)")
95 | fi
96 |
97 | if [ -z "$os_name" ]
98 | then
99 | os_name=$(prep "$(uname -s)")
100 | fi
101 | fi
102 |
103 | case $(uname -m) in
104 | x86_64)
105 | os_arch=$(prep "x64")
106 | ;;
107 | i*86)
108 | os_arch=$(prep "x86")
109 | ;;
110 | *)
111 | os_arch=$(prep "$(uname -m)")
112 | ;;
113 | esac
114 |
115 | # CPU details
116 | cpu_name=$(prep "$(cat /proc/cpuinfo | grep 'model name' | awk -F\: '{ print $2 }')")
117 | cpu_cores=$(prep "$(($(cat /proc/cpuinfo | grep 'model name' | awk -F\: '{ print $2 }' | sed -e :a -e '$!N;s/\n/\|/;ta' | tr -cd \| | wc -c)+1))")
118 |
119 | if [ -z "$cpu_name" ]
120 | then
121 | cpu_name=$(prep "$(cat /proc/cpuinfo | grep 'vendor_id' | awk -F\: '{ print $2 } END { if (!NR) print "N/A" }')")
122 | cpu_cores=$(prep "$(($(cat /proc/cpuinfo | grep 'vendor_id' | awk -F\: '{ print $2 }' | sed -e :a -e '$!N;s/\n/\|/;ta' | tr -cd \| | wc -c)+1))")
123 | fi
124 |
125 | cpu_freq=$(prep "$(cat /proc/cpuinfo | grep 'cpu MHz' | awk -F\: '{ print $2 }')")
126 |
127 | if [ -z "$cpu_freq" ]
128 | then
129 | cpu_freq=$(prep $(num "$(lscpu | grep 'CPU MHz' | awk -F\: '{ print $2 }' | sed -e 's/^ *//g' -e 's/ *$//g')"))
130 | fi
131 |
132 | # RAM usage
133 | ram_total=$(prep $(num "$(cat /proc/meminfo | grep ^MemTotal: | awk '{ print $2 }')"))
134 | ram_free=$(prep $(num "$(cat /proc/meminfo | grep ^MemFree: | awk '{ print $2 }')"))
135 | ram_cached=$(prep $(num "$(cat /proc/meminfo | grep ^Cached: | awk '{ print $2 }')"))
136 | ram_buffers=$(prep $(num "$(cat /proc/meminfo | grep ^Buffers: | awk '{ print $2 }')"))
137 | ram_usage=$((($ram_total-($ram_free+$ram_cached+$ram_buffers))*1024))
138 | ram_total=$(($ram_total*1024))
139 |
140 | # Swap usage
141 | swap_total=$(prep $(num "$(cat /proc/meminfo | grep ^SwapTotal: | awk '{ print $2 }')"))
142 | swap_free=$(prep $(num "$(cat /proc/meminfo | grep ^SwapFree: | awk '{ print $2 }')"))
143 | swap_usage=$((($swap_total-$swap_free)*1024))
144 | swap_total=$(($swap_total*1024))
145 |
146 | # Disk usage
147 | disk_total=$(prep $(num "$(($(df -P -B 1 | grep '^/' | awk '{ print $2 }' | sed -e :a -e '$!N;s/\n/+/;ta')))"))
148 | disk_usage=$(prep $(num "$(($(df -P -B 1 | grep '^/' | awk '{ print $3 }' | sed -e :a -e '$!N;s/\n/+/;ta')))"))
149 |
150 | # Disk array
151 | disk_array=$(prep "$(df -P -B 1 | grep '^/' | awk '{ print $1" "$2" "$3";" }' | sed -e :a -e '$!N;s/\n/ /;ta' | awk '{ print $0 } END { if (!NR) print "N/A" }')")
152 |
153 | # Active connections
154 | if [ -n "$(command -v ss)" ]
155 | then
156 | connections=$(prep $(num "$(ss -tun | tail -n +2 | wc -l)"))
157 | else
158 | connections=$(prep $(num "$(netstat -tun | tail -n +3 | wc -l)"))
159 | fi
160 |
161 | # Network interface
162 | nic=$(prep "$(ip route get 8.8.8.8 | grep dev | awk -F'dev' '{ print $2 }' | awk '{ print $1 }')")
163 |
164 | if [ -z $nic ]
165 | then
166 | nic=$(prep "$(ip link show | grep 'eth[0-9]' | awk '{ print $2 }' | tr -d ':')")
167 | fi
168 |
169 | # IP addresses and network usage
170 | ipv4=$(prep "$(ip addr show $nic | grep 'inet ' | awk '{ print $2 }' | awk -F\/ '{ print $1 }' | grep -v '^127' | awk '{ print $0 } END { if (!NR) print "N/A" }')")
171 | ipv6=$(prep "$(ip addr show $nic | grep 'inet6 ' | awk '{ print $2 }' | awk -F\/ '{ print $1 }' | grep -v '^::' | grep -v '^0000:' | grep -v '^fe80:' | awk '{ print $0 } END { if (!NR) print "N/A" }')")
172 |
173 | if [ -d /sys/class/net/$nic/statistics ]
174 | then
175 | rx=$(prep $(num "$(cat /sys/class/net/$nic/statistics/rx_bytes)"))
176 | tx=$(prep $(num "$(cat /sys/class/net/$nic/statistics/tx_bytes)"))
177 | else
178 | rx=$(prep $(num "$(ip -s link show $nic | grep '[0-9]*' | grep -v '[A-Za-z]' | awk '{ print $1 }' | sed -n '1 p')"))
179 | tx=$(prep $(num "$(ip -s link show $nic | grep '[0-9]*' | grep -v '[A-Za-z]' | awk '{ print $1 }' | sed -n '2 p')"))
180 | fi
181 |
182 | # Average system load
183 | load=$(prep "$(cat /proc/loadavg | awk '{ print $1" "$2" "$3 }')")
184 |
185 | # Detailed system load calculation
186 | time=$(date +%s)
187 | stat=($(cat /proc/stat | head -n1 | sed 's/[^0-9 ]*//g' | sed 's/^ *//'))
188 | cpu=$((${stat[0]}+${stat[1]}+${stat[2]}+${stat[3]}))
189 | io=$((${stat[3]}+${stat[4]}))
190 | idle=${stat[3]}
191 |
192 | if [ -e /etc/nodequery/nq-data.log ]
193 | then
194 | data=($(cat /etc/nodequery/nq-data.log))
195 | interval=$(($time-${data[0]}))
196 | cpu_gap=$(($cpu-${data[1]}))
197 | io_gap=$(($io-${data[2]}))
198 | idle_gap=$(($idle-${data[3]}))
199 |
200 | if [[ $cpu_gap > "0" ]]
201 | then
202 | load_cpu=$(((1000*($cpu_gap-$idle_gap)/$cpu_gap+5)/10))
203 | fi
204 |
205 | if [[ $io_gap > "0" ]]
206 | then
207 | load_io=$(((1000*($io_gap-$idle_gap)/$io_gap+5)/10))
208 | fi
209 |
210 | if [[ $rx > ${data[4]} ]]
211 | then
212 | rx_gap=$(($rx-${data[4]}))
213 | fi
214 |
215 | if [[ $tx > ${data[5]} ]]
216 | then
217 | tx_gap=$(($tx-${data[5]}))
218 | fi
219 | fi
220 |
221 | # System load cache
222 | echo "$time $cpu $io $idle $rx $tx" > /etc/nodequery/nq-data.log
223 |
224 | # Prepare load variables
225 | rx_gap=$(prep $(num "$rx_gap"))
226 | tx_gap=$(prep $(num "$tx_gap"))
227 | load_cpu=$(prep $(num "$load_cpu"))
228 | load_io=$(prep $(num "$load_io"))
229 |
230 | # Get network latency
231 | ping_eu=$(prep $(num "$(ping -c 2 -w 2 ping-eu.nodequery.com | grep rtt | cut -d'/' -f4 | awk '{ print $3 }')"))
232 | ping_us=$(prep $(num "$(ping -c 2 -w 2 ping-us.nodequery.com | grep rtt | cut -d'/' -f4 | awk '{ print $3 }')"))
233 | ping_as=$(prep $(num "$(ping -c 2 -w 2 ping-as.nodequery.com | grep rtt | cut -d'/' -f4 | awk '{ print $3 }')"))
234 |
235 | # Build data for post
236 | #data_post="token=${auth[0]}&data=$(base "$version") $(base "$uptime") $(base "$sessions") $(base "$processes") $(base "$processes_array") $(base "$file_handles") $(base "$file_handles_limit") $(base "$os_kernel") $(base "$os_name") $(base "$os_arch") $(base "$cpu_name") $(base "$cpu_cores") $(base "$cpu_freq") $(base "$ram_total") $(base "$ram_usage") $(base "$swap_total") $(base "$swap_usage") $(base "$disk_array") $(base "$disk_total") $(base "$disk_usage") $(base "$connections") $(base "$nic") $(base "$ipv4") $(base "$ipv6") $(base "$rx") $(base "$tx") $(base "$rx_gap") $(base "$tx_gap") $(base "$load") $(base "$load_cpu") $(base "$load_io") $(base "$ping_eu") $(base "$ping_us") $(base "$ping_as")"
237 |
238 | data_post="token=${auth[0]}&version=$version&uptime=$uptime&sessions=$sessions&processes=$processes&processes_array=$processes_array&file_handles=$file_handles&file_handles_limit=$file_handles_limit&os_kernel=$os_kernel&os_name=$os_name&os_arch=$os_arch&cpu_name=$cpu_name&cpu_cores=$cpu_cores&cpu_freq=$cpu_freq&ram_total=$ram_total&ram_usage=$ram_usage&swap_total=$swap_total&swap_usage=$swap_usage&disk_array=$disk_array&disk_total=$disk_total&disk_usage=$disk_usage&connections=$connections&nic=$nic&ipv4=$ipv4&ipv6=$ipv6&rx=$rx&tx=$tx&rx_gap=$rx_gap&tx_gap=$tx_gap&load=$load&load_cpu=$load_cpu&load_io=$load_io&ping_eu=$ping_eu&ping_us=$ping_us&ping_as=$ping_as"
239 |
240 | # API request with automatic termination
241 | if [ -n "$(command -v timeout)" ]
242 | then
243 | timeout -s SIGKILL 30 wget -q -o /dev/null -O /etc/nodequery/nq-agent.log -T 25 --post-data "$data_post" --no-check-certificate $url
244 | else
245 | wget -q -o /dev/null -O /etc/nodequery/nq-agent.log -T 25 --post-data "$data_post" --no-check-certificate $url
246 | wget_pid=$!
247 | wget_counter=0
248 | wget_timeout=30
249 |
250 | while kill -0 "$wget_pid" && (( wget_counter < wget_timeout ))
251 | do
252 | sleep 1
253 | (( wget_counter++ ))
254 | done
255 |
256 | kill -0 "$wget_pid" && kill -s SIGKILL "$wget_pid"
257 | fi
258 |
259 | # Finished
260 | exit 1
261 |
--------------------------------------------------------------------------------
/db-service-monitoring/src/components/serverRelease/ServerDetails.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 更新发版服务状态:
5 |
9 |
10 |
11 |
12 |
13 |
19 |
24 |
25 |
26 |
31 |
32 |
36 |
37 |
41 |
42 |
46 |
47 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
65 |
66 | 服务器归属:
67 |
68 |
69 |
70 | 服务器ip:
71 |
72 |
73 |
74 | 服务器状态:
75 |
76 |
81 |
82 |
83 |
84 |
85 | 备注:
86 |
87 |
88 |
92 |
93 |
94 |
95 |
96 |
97 |
110 |
320 |
--------------------------------------------------------------------------------