50 changed files with 992 additions and 1512 deletions
@ -1,5 +1,6 @@ |
|||||
dependencies { |
dependencies { |
||||
api( |
api( |
||||
"com.github.oshi:oshi-core:${oshi_version}", |
"com.github.oshi:oshi-core:${oshi_version}", |
||||
|
project(":io.sc.platform.core"), |
||||
) |
) |
||||
} |
} |
||||
|
@ -1,960 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<diagram> |
|
||||
<page_setting> |
|
||||
<direction_horizontal>true</direction_horizontal> |
|
||||
<scale>100</scale> |
|
||||
<paper_size>A4 210 x 297 mm</paper_size> |
|
||||
<top_margin>30</top_margin> |
|
||||
<left_margin>30</left_margin> |
|
||||
<bottom_margin>30</bottom_margin> |
|
||||
<right_margin>30</right_margin> |
|
||||
</page_setting> |
|
||||
<category_index>0</category_index> |
|
||||
<zoom>1.0</zoom> |
|
||||
<x>0</x> |
|
||||
<y>0</y> |
|
||||
<default_color> |
|
||||
<r>128</r> |
|
||||
<g>128</g> |
|
||||
<b>192</b> |
|
||||
</default_color> |
|
||||
<color> |
|
||||
<r>255</r> |
|
||||
<g>255</g> |
|
||||
<b>255</b> |
|
||||
</color> |
|
||||
<font_name>.SF NS Text</font_name> |
|
||||
<font_size>9</font_size> |
|
||||
<settings> |
|
||||
<database>MySQL</database> |
|
||||
<capital>false</capital> |
|
||||
<table_style></table_style> |
|
||||
<notation></notation> |
|
||||
<notation_level>0</notation_level> |
|
||||
<notation_expand_group>true</notation_expand_group> |
|
||||
<view_mode>2</view_mode> |
|
||||
<outline_view_mode>1</outline_view_mode> |
|
||||
<view_order_by>1</view_order_by> |
|
||||
<auto_ime_change>false</auto_ime_change> |
|
||||
<validate_physical_name>true</validate_physical_name> |
|
||||
<use_bezier_curve>false</use_bezier_curve> |
|
||||
<suspend_validator>false</suspend_validator> |
|
||||
<export_setting> |
|
||||
<export_ddl_setting> |
|
||||
<output_path>doc/database/structure.sql</output_path> |
|
||||
<encoding>UTF-8</encoding> |
|
||||
<line_feed>LF</line_feed> |
|
||||
<is_open_after_saved>true</is_open_after_saved> |
|
||||
<environment_id>0</environment_id> |
|
||||
<category_id>null</category_id> |
|
||||
<ddl_target> |
|
||||
<create_comment>true</create_comment> |
|
||||
<create_foreignKey>true</create_foreignKey> |
|
||||
<create_index>true</create_index> |
|
||||
<create_sequence>true</create_sequence> |
|
||||
<create_table>true</create_table> |
|
||||
<create_tablespace>true</create_tablespace> |
|
||||
<create_trigger>true</create_trigger> |
|
||||
<create_view>true</create_view> |
|
||||
<drop_index>true</drop_index> |
|
||||
<drop_sequence>true</drop_sequence> |
|
||||
<drop_table>true</drop_table> |
|
||||
<drop_tablespace>true</drop_tablespace> |
|
||||
<drop_trigger>true</drop_trigger> |
|
||||
<drop_view>true</drop_view> |
|
||||
<inline_column_comment>true</inline_column_comment> |
|
||||
<inline_table_comment>true</inline_table_comment> |
|
||||
<comment_value_description>true</comment_value_description> |
|
||||
<comment_value_logical_name>false</comment_value_logical_name> |
|
||||
<comment_value_logical_name_description>false</comment_value_logical_name_description> |
|
||||
<comment_replace_line_feed>false</comment_replace_line_feed> |
|
||||
<comment_replace_string></comment_replace_string> |
|
||||
</ddl_target> |
|
||||
</export_ddl_setting> |
|
||||
<export_excel_setting> |
|
||||
<category_id>null</category_id> |
|
||||
<output_path></output_path> |
|
||||
<template></template> |
|
||||
<template_path></template_path> |
|
||||
<used_default_template_lang></used_default_template_lang> |
|
||||
<image_output></image_output> |
|
||||
<is_open_after_saved>true</is_open_after_saved> |
|
||||
<is_put_diagram>true</is_put_diagram> |
|
||||
<is_use_logical_name>true</is_use_logical_name> |
|
||||
</export_excel_setting> |
|
||||
<export_html_setting> |
|
||||
<output_dir></output_dir> |
|
||||
<with_category_image>true</with_category_image> |
|
||||
<with_image>true</with_image> |
|
||||
<is_open_after_saved>true</is_open_after_saved> |
|
||||
</export_html_setting> |
|
||||
<export_image_setting> |
|
||||
<output_file_path></output_file_path> |
|
||||
<category_dir_path></category_dir_path> |
|
||||
<with_category_image>true</with_category_image> |
|
||||
<is_open_after_saved>true</is_open_after_saved> |
|
||||
</export_image_setting> |
|
||||
<export_java_setting> |
|
||||
<java_output></java_output> |
|
||||
<package_name></package_name> |
|
||||
<class_name_suffix></class_name_suffix> |
|
||||
<src_file_encoding></src_file_encoding> |
|
||||
<with_hibernate>false</with_hibernate> |
|
||||
</export_java_setting> |
|
||||
<export_testdata_setting> |
|
||||
<file_encoding></file_encoding> |
|
||||
<file_path></file_path> |
|
||||
<format>0</format> |
|
||||
</export_testdata_setting> |
|
||||
</export_setting> |
|
||||
<category_settings> |
|
||||
<free_layout>false</free_layout> |
|
||||
<show_referred_tables>false</show_referred_tables> |
|
||||
<categories> |
|
||||
</categories> |
|
||||
</category_settings> |
|
||||
<translation_settings> |
|
||||
<use>false</use> |
|
||||
<translations> |
|
||||
</translations> |
|
||||
</translation_settings> |
|
||||
<model_properties> |
|
||||
<id></id> |
|
||||
<height>-1</height> |
|
||||
<width>-1</width> |
|
||||
<font_name>.SF NS Text</font_name> |
|
||||
<font_size>9</font_size> |
|
||||
<x>50</x> |
|
||||
<y>50</y> |
|
||||
<color> |
|
||||
<r>255</r> |
|
||||
<g>255</g> |
|
||||
<b>255</b> |
|
||||
</color> |
|
||||
<connections> |
|
||||
</connections> |
|
||||
<display>false</display> |
|
||||
<creation_date>2016-03-10 20:37:38</creation_date> |
|
||||
<updated_date>2016-03-16 02:25:45</updated_date> |
|
||||
<model_property> |
|
||||
<name>Project Name</name> |
|
||||
<value></value> |
|
||||
</model_property> |
|
||||
<model_property> |
|
||||
<name>Model Name</name> |
|
||||
<value></value> |
|
||||
</model_property> |
|
||||
<model_property> |
|
||||
<name>Version</name> |
|
||||
<value></value> |
|
||||
</model_property> |
|
||||
<model_property> |
|
||||
<name>Company</name> |
|
||||
<value></value> |
|
||||
</model_property> |
|
||||
<model_property> |
|
||||
<name>Author</name> |
|
||||
<value></value> |
|
||||
</model_property> |
|
||||
</model_properties> |
|
||||
<table_properties> |
|
||||
<schema></schema> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<storage_engine></storage_engine> |
|
||||
<primary_key_length_of_text>null</primary_key_length_of_text> |
|
||||
</table_properties> |
|
||||
<environment_setting> |
|
||||
<environment> |
|
||||
<id>0</id> |
|
||||
<name>Default</name> |
|
||||
</environment> |
|
||||
</environment_setting> |
|
||||
</settings> |
|
||||
<dictionary> |
|
||||
<word> |
|
||||
<id>0</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean autowire</logical_name> |
|
||||
<physical_name>FD_AUTOWIRE</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>1</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean customizer-ref</logical_name> |
|
||||
<physical_name>FD_CUSTOMIZER_REF</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>2</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean depends-on</logical_name> |
|
||||
<physical_name>FD_DEPENDS_ON</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>3</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean描述</logical_name> |
|
||||
<physical_name>FD_DESCRIPTION</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>4</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean destroy-method</logical_name> |
|
||||
<physical_name>FD_DESTROY_METHOD</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>5</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean id</logical_name> |
|
||||
<physical_name>FD_ID</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>6</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean init-method</logical_name> |
|
||||
<physical_name>FD_INIT_METHOD</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>7</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean名称</logical_name> |
|
||||
<physical_name>FD_NAME</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>8</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean proxy-target-class</logical_name> |
|
||||
<physical_name>FD_PROXY_TARGET_CLASS</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>9</id> |
|
||||
<length>4</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean refresh-check-delay</logical_name> |
|
||||
<physical_name>FD_REFRESH_CHECK_DELAY</physical_name> |
|
||||
<type>int(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>10</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean scope</logical_name> |
|
||||
<physical_name>FD_SCOPE</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>11</id> |
|
||||
<length>3000</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean脚本内容</logical_name> |
|
||||
<physical_name>FD_SCRIPT</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>12</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean实现接口</logical_name> |
|
||||
<physical_name>FD_SCRIPT_INTERFACE</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>13</id> |
|
||||
<length>255</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description>GROOVY:groovy Bean,BSH:bsh Bean</description> |
|
||||
<logical_name>Bean类型</logical_name> |
|
||||
<physical_name>FD_TYPE</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
<word> |
|
||||
<id>14</id> |
|
||||
<length>36</length> |
|
||||
<decimal>null</decimal> |
|
||||
<array>false</array> |
|
||||
<array_dimension>null</array_dimension> |
|
||||
<unsigned>false</unsigned> |
|
||||
<zerofill>false</zerofill> |
|
||||
<binary>false</binary> |
|
||||
<args></args> |
|
||||
<char_semantics>false</char_semantics> |
|
||||
<description></description> |
|
||||
<logical_name>Bean定义ID</logical_name> |
|
||||
<physical_name>FD_UUID</physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
</word> |
|
||||
</dictionary> |
|
||||
<tablespace_set> |
|
||||
</tablespace_set> |
|
||||
<contents> |
|
||||
<table> |
|
||||
<id>0</id> |
|
||||
<height>75</height> |
|
||||
<width>120</width> |
|
||||
<font_name>.SF NS Text</font_name> |
|
||||
<font_size>9</font_size> |
|
||||
<x>137</x> |
|
||||
<y>74</y> |
|
||||
<color> |
|
||||
<r>128</r> |
|
||||
<g>128</g> |
|
||||
<b>192</b> |
|
||||
</color> |
|
||||
<connections> |
|
||||
</connections> |
|
||||
<physical_name>WSP_DYNAMIC_BEAN</physical_name> |
|
||||
<logical_name>动态SpringBean定义表</logical_name> |
|
||||
<description></description> |
|
||||
<constraint></constraint> |
|
||||
<primary_key_name></primary_key_name> |
|
||||
<option></option> |
|
||||
<columns> |
|
||||
<normal_column> |
|
||||
<word_id>14</word_id> |
|
||||
<id>0</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>true</not_null> |
|
||||
<primary_key>true</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>13</word_id> |
|
||||
<id>1</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>5</word_id> |
|
||||
<id>2</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>7</word_id> |
|
||||
<id>3</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>3</word_id> |
|
||||
<id>4</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>12</word_id> |
|
||||
<id>5</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>11</word_id> |
|
||||
<id>6</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>0</word_id> |
|
||||
<id>7</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>1</word_id> |
|
||||
<id>8</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>2</word_id> |
|
||||
<id>9</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>4</word_id> |
|
||||
<id>10</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>6</word_id> |
|
||||
<id>11</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>8</word_id> |
|
||||
<id>12</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>9</word_id> |
|
||||
<id>13</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>int(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
<normal_column> |
|
||||
<word_id>10</word_id> |
|
||||
<id>14</id> |
|
||||
<description></description> |
|
||||
<unique_key_name></unique_key_name> |
|
||||
<logical_name></logical_name> |
|
||||
<physical_name></physical_name> |
|
||||
<type>varchar(n)</type> |
|
||||
<constraint></constraint> |
|
||||
<default_value></default_value> |
|
||||
<auto_increment>false</auto_increment> |
|
||||
<foreign_key>false</foreign_key> |
|
||||
<not_null>false</not_null> |
|
||||
<primary_key>false</primary_key> |
|
||||
<unique_key>false</unique_key> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<sequence> |
|
||||
<name></name> |
|
||||
<schema></schema> |
|
||||
<increment></increment> |
|
||||
<min_value></min_value> |
|
||||
<max_value></max_value> |
|
||||
<start></start> |
|
||||
<cache></cache> |
|
||||
<nocache>false</nocache> |
|
||||
<cycle>false</cycle> |
|
||||
<order>false</order> |
|
||||
<description></description> |
|
||||
<data_type></data_type> |
|
||||
<decimal_size>0</decimal_size> |
|
||||
</sequence> |
|
||||
</normal_column> |
|
||||
</columns> |
|
||||
<indexes> |
|
||||
</indexes> |
|
||||
<complex_unique_key_list> |
|
||||
</complex_unique_key_list> |
|
||||
<table_properties> |
|
||||
<schema></schema> |
|
||||
<character_set></character_set> |
|
||||
<collation></collation> |
|
||||
<storage_engine></storage_engine> |
|
||||
<primary_key_length_of_text>null</primary_key_length_of_text> |
|
||||
</table_properties> |
|
||||
</table> |
|
||||
</contents> |
|
||||
<column_groups> |
|
||||
</column_groups> |
|
||||
<test_data_list> |
|
||||
</test_data_list> |
|
||||
<sequence_set> |
|
||||
</sequence_set> |
|
||||
<trigger_set> |
|
||||
</trigger_set> |
|
||||
<change_tracking_list> |
|
||||
</change_tracking_list> |
|
||||
</diagram> |
|
@ -1,34 +0,0 @@ |
|||||
SET SESSION FOREIGN_KEY_CHECKS=0; |
|
||||
|
|
||||
/* Drop Tables */ |
|
||||
|
|
||||
DROP TABLE IF EXISTS WSP_DYNAMIC_BEAN; |
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
/* Create Tables */ |
|
||||
|
|
||||
CREATE TABLE WSP_DYNAMIC_BEAN |
|
||||
( |
|
||||
FD_UUID varchar(36) NOT NULL, |
|
||||
-- GROOVY:groovy Bean,BSH:bsh Bean |
|
||||
FD_TYPE varchar(255) COMMENT 'GROOVY:groovy Bean,BSH:bsh Bean', |
|
||||
FD_ID varchar(255), |
|
||||
FD_NAME varchar(255), |
|
||||
FD_DESCRIPTION varchar(255), |
|
||||
FD_SCRIPT_INTERFACE varchar(255), |
|
||||
FD_SCRIPT varchar(3000), |
|
||||
FD_AUTOWIRE varchar(255), |
|
||||
FD_CUSTOMIZER_REF varchar(255), |
|
||||
FD_DEPENDS_ON varchar(255), |
|
||||
FD_DESTROY_METHOD varchar(255), |
|
||||
FD_INIT_METHOD varchar(255), |
|
||||
FD_PROXY_TARGET_CLASS varchar(255), |
|
||||
FD_REFRESH_CHECK_DELAY int(4), |
|
||||
FD_SCOPE varchar(255), |
|
||||
PRIMARY KEY (FD_UUID) |
|
||||
); |
|
||||
|
|
||||
|
|
||||
|
|
@ -1,5 +1,7 @@ |
|||||
package io.sc.platform.monitor.service; |
package io.sc.platform.monitor.service; |
||||
|
|
||||
|
import io.sc.platform.monitor.service.support.ServerInfo; |
||||
|
|
||||
public interface SystemMonitor { |
public interface SystemMonitor { |
||||
public void getCpuInfo(); |
public ServerInfo getServerInfo() throws Exception; |
||||
} |
} |
||||
|
@ -1,26 +1,11 @@ |
|||||
package io.sc.platform.monitor.service.impl; |
package io.sc.platform.monitor.service.impl; |
||||
|
|
||||
import io.sc.platform.monitor.service.SystemMonitor; |
import io.sc.platform.monitor.service.SystemMonitor; |
||||
import oshi.SystemInfo; |
import io.sc.platform.monitor.service.support.ServerInfo; |
||||
import oshi.hardware.CentralProcessor; |
|
||||
import oshi.hardware.ComputerSystem; |
|
||||
import oshi.hardware.HardwareAbstractionLayer; |
|
||||
|
|
||||
public class SystemMonitorImpl implements SystemMonitor { |
public class SystemMonitorImpl implements SystemMonitor { |
||||
@Override |
@Override |
||||
public void getCpuInfo() { |
public ServerInfo getServerInfo() throws Exception { |
||||
SystemInfo si =new SystemInfo(); |
return ServerInfo.info(); |
||||
HardwareAbstractionLayer hal = si.getHardware(); |
|
||||
CentralProcessor processor = hal.getProcessor(); |
|
||||
double[] loadAverage = processor.getSystemLoadAverage(3); |
|
||||
System.out.println("CPU load averages:" + (loadAverage[0] < 0 ? " N/A" : String.format(" %.2f", loadAverage[0])) |
|
||||
+ (loadAverage[1] < 0 ? " N/A" : String.format(" %.2f", loadAverage[1])) |
|
||||
+ (loadAverage[2] < 0 ? " N/A" : String.format(" %.2f", loadAverage[2]))); |
|
||||
|
|
||||
} |
|
||||
|
|
||||
public static void main(String[] args) { |
|
||||
SystemMonitor monitor =new SystemMonitorImpl(); |
|
||||
monitor.getCpuInfo(); |
|
||||
} |
} |
||||
} |
} |
||||
|
@ -0,0 +1,45 @@ |
|||||
|
package io.sc.platform.monitor.service.support; |
||||
|
|
||||
|
import io.sc.platform.core.util.StringUtil; |
||||
|
|
||||
|
import java.io.File; |
||||
|
|
||||
|
public class Disk { |
||||
|
private long total; |
||||
|
private long free; |
||||
|
private long used; |
||||
|
|
||||
|
public static Disk from() { |
||||
|
File file =new File("/"); |
||||
|
|
||||
|
Disk disk =new Disk(); |
||||
|
disk.setTotal(file.getTotalSpace()); |
||||
|
disk.setUsed(file.getTotalSpace()-file.getFreeSpace()); |
||||
|
disk.setFree(file.getFreeSpace()); |
||||
|
return disk; |
||||
|
} |
||||
|
|
||||
|
public long getTotal() { |
||||
|
return total; |
||||
|
} |
||||
|
|
||||
|
public void setTotal(long total) { |
||||
|
this.total = total; |
||||
|
} |
||||
|
|
||||
|
public long getFree() { |
||||
|
return free; |
||||
|
} |
||||
|
|
||||
|
public void setFree(long free) { |
||||
|
this.free = free; |
||||
|
} |
||||
|
|
||||
|
public long getUsed() { |
||||
|
return used; |
||||
|
} |
||||
|
|
||||
|
public void setUsed(long used) { |
||||
|
this.used = used; |
||||
|
} |
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
package io.sc.platform.monitor.service.support; |
||||
|
|
||||
|
import oshi.hardware.ComputerSystem; |
||||
|
import oshi.hardware.HardwareAbstractionLayer; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public class Hardware { |
||||
|
private String uuid; |
||||
|
private String manufacturer; |
||||
|
private String model; |
||||
|
private String serialNumber; |
||||
|
private int logicalProcessorCount; |
||||
|
private int physicalProcessorCount; |
||||
|
private long physicalMemory; |
||||
|
|
||||
|
public static Hardware from(HardwareAbstractionLayer hd) { |
||||
|
ComputerSystem cs =hd.getComputerSystem(); |
||||
|
Hardware hardware =new Hardware(); |
||||
|
hardware.setLogicalProcessorCount(hd.getProcessor().getLogicalProcessors().size()); |
||||
|
hardware.setPhysicalProcessorCount(hd.getProcessor().getPhysicalProcessors().size()); |
||||
|
hardware.setUuid(cs.getHardwareUUID()); |
||||
|
hardware.setManufacturer(cs.getManufacturer()); |
||||
|
hardware.setModel(cs.getModel()); |
||||
|
hardware.setSerialNumber(cs.getSerialNumber()); |
||||
|
hardware.setPhysicalMemory(hd.getMemory().getTotal()); |
||||
|
return hardware; |
||||
|
} |
||||
|
|
||||
|
public String getUuid() { |
||||
|
return uuid; |
||||
|
} |
||||
|
|
||||
|
public void setUuid(String uuid) { |
||||
|
this.uuid = uuid; |
||||
|
} |
||||
|
|
||||
|
public String getManufacturer() { |
||||
|
return manufacturer; |
||||
|
} |
||||
|
|
||||
|
public void setManufacturer(String manufacturer) { |
||||
|
this.manufacturer = manufacturer; |
||||
|
} |
||||
|
|
||||
|
public String getModel() { |
||||
|
return model; |
||||
|
} |
||||
|
|
||||
|
public void setModel(String model) { |
||||
|
this.model = model; |
||||
|
} |
||||
|
|
||||
|
public String getSerialNumber() { |
||||
|
return serialNumber; |
||||
|
} |
||||
|
|
||||
|
public void setSerialNumber(String serialNumber) { |
||||
|
this.serialNumber = serialNumber; |
||||
|
} |
||||
|
|
||||
|
public int getLogicalProcessorCount() { |
||||
|
return logicalProcessorCount; |
||||
|
} |
||||
|
|
||||
|
public void setLogicalProcessorCount(int logicalProcessorCount) { |
||||
|
this.logicalProcessorCount = logicalProcessorCount; |
||||
|
} |
||||
|
|
||||
|
public int getPhysicalProcessorCount() { |
||||
|
return physicalProcessorCount; |
||||
|
} |
||||
|
|
||||
|
public void setPhysicalProcessorCount(int physicalProcessorCount) { |
||||
|
this.physicalProcessorCount = physicalProcessorCount; |
||||
|
} |
||||
|
|
||||
|
public long getPhysicalMemory() { |
||||
|
return physicalMemory; |
||||
|
} |
||||
|
|
||||
|
public void setPhysicalMemory(long physicalMemory) { |
||||
|
this.physicalMemory = physicalMemory; |
||||
|
} |
||||
|
} |
@ -1,21 +1,20 @@ |
|||||
package io.sc.platform.monitor.service.support; |
package io.sc.platform.monitor.service.support; |
||||
|
|
||||
public class Mem { |
import oshi.hardware.GlobalMemory; |
||||
/** |
|
||||
* 内存总量 |
|
||||
*/ |
|
||||
private double total; |
|
||||
|
|
||||
/** |
public class Memory { |
||||
* 已用内存 |
private double total; |
||||
*/ |
|
||||
private double used; |
private double used; |
||||
|
|
||||
/** |
|
||||
* 剩余内存 |
|
||||
*/ |
|
||||
private double free; |
private double free; |
||||
|
|
||||
|
public static Memory from(GlobalMemory m){ |
||||
|
Memory memory =new Memory(); |
||||
|
memory.setTotal(m.getTotal()); |
||||
|
memory.setUsed(m.getTotal() - m.getAvailable()); |
||||
|
memory.setFree(m.getAvailable()); |
||||
|
return memory; |
||||
|
} |
||||
|
|
||||
public double getTotal() { |
public double getTotal() { |
||||
return total; |
return total; |
||||
} |
} |
@ -0,0 +1,95 @@ |
|||||
|
package io.sc.platform.monitor.service.support; |
||||
|
|
||||
|
import io.sc.platform.core.util.DateUtil; |
||||
|
import oshi.software.os.OperatingSystem; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.Properties; |
||||
|
|
||||
|
public class Os { |
||||
|
private String computerName; |
||||
|
private String ip; |
||||
|
private String name; |
||||
|
private String version; |
||||
|
private String arch; |
||||
|
private String manufacturer; |
||||
|
private String bootTime; |
||||
|
private int upTime; |
||||
|
|
||||
|
public static Os from(OperatingSystem operatingSystem){ |
||||
|
Properties props = System.getProperties(); |
||||
|
|
||||
|
Os os =new Os(); |
||||
|
os.setName(props.getProperty("os.name")); |
||||
|
os.setVersion(operatingSystem.getVersionInfo().getVersion() + " - " + operatingSystem.getVersionInfo().getCodeName()); |
||||
|
os.setArch(props.getProperty("os.arch")); |
||||
|
os.setManufacturer(operatingSystem.getManufacturer()); |
||||
|
os.setBootTime(DateUtil.formatDate(operatingSystem.getSystemBootTime()*1000)); |
||||
|
os.setUpTime((int)operatingSystem.getSystemUptime()/(60*60*24)); |
||||
|
return os; |
||||
|
} |
||||
|
|
||||
|
public String getComputerName() { |
||||
|
return computerName; |
||||
|
} |
||||
|
|
||||
|
public void setComputerName(String computerName) { |
||||
|
this.computerName = computerName; |
||||
|
} |
||||
|
|
||||
|
public String getIp() { |
||||
|
return ip; |
||||
|
} |
||||
|
|
||||
|
public void setIp(String ip) { |
||||
|
this.ip = ip; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getVersion() { |
||||
|
return version; |
||||
|
} |
||||
|
|
||||
|
public void setVersion(String version) { |
||||
|
this.version = version; |
||||
|
} |
||||
|
|
||||
|
public String getArch() { |
||||
|
return arch; |
||||
|
} |
||||
|
|
||||
|
public void setArch(String arch) { |
||||
|
this.arch = arch; |
||||
|
} |
||||
|
|
||||
|
public String getManufacturer() { |
||||
|
return manufacturer; |
||||
|
} |
||||
|
|
||||
|
public void setManufacturer(String manufacturer) { |
||||
|
this.manufacturer = manufacturer; |
||||
|
} |
||||
|
|
||||
|
public String getBootTime() { |
||||
|
return bootTime; |
||||
|
} |
||||
|
|
||||
|
public void setBootTime(String bootTime) { |
||||
|
this.bootTime = bootTime; |
||||
|
} |
||||
|
|
||||
|
public int getUpTime() { |
||||
|
return upTime; |
||||
|
} |
||||
|
|
||||
|
public void setUpTime(int upTime) { |
||||
|
this.upTime = upTime; |
||||
|
} |
||||
|
} |
@ -1,174 +0,0 @@ |
|||||
package io.sc.platform.monitor.service.support; |
|
||||
|
|
||||
import oshi.SystemInfo; |
|
||||
import oshi.hardware.CentralProcessor; |
|
||||
import oshi.hardware.GlobalMemory; |
|
||||
import oshi.hardware.HardwareAbstractionLayer; |
|
||||
import oshi.software.os.FileSystem; |
|
||||
import oshi.software.os.OSFileStore; |
|
||||
import oshi.software.os.OperatingSystem; |
|
||||
import oshi.util.Util; |
|
||||
import oshi.hardware.CentralProcessor.TickType; |
|
||||
|
|
||||
import java.net.UnknownHostException; |
|
||||
import java.util.LinkedList; |
|
||||
import java.util.List; |
|
||||
import java.util.Properties; |
|
||||
|
|
||||
public class Server { |
|
||||
private static final int OSHI_WAIT_SECOND = 1000; |
|
||||
|
|
||||
/** |
|
||||
* CPU相关信息 |
|
||||
*/ |
|
||||
private Cpu cpu = new Cpu(); |
|
||||
|
|
||||
/** |
|
||||
* 內存相关信息 |
|
||||
*/ |
|
||||
private Mem mem = new Mem(); |
|
||||
|
|
||||
/** |
|
||||
* JVM相关信息 |
|
||||
*/ |
|
||||
private Jvm jvm = new Jvm(); |
|
||||
|
|
||||
/** |
|
||||
* 服务器相关信息 |
|
||||
*/ |
|
||||
private Sys sys = new Sys(); |
|
||||
|
|
||||
/** |
|
||||
* 磁盘相关信息 |
|
||||
*/ |
|
||||
private List<SysFile> sysFiles = new LinkedList<SysFile>(); |
|
||||
|
|
||||
|
|
||||
public void copyTo() throws Exception { |
|
||||
SystemInfo si = new SystemInfo(); |
|
||||
HardwareAbstractionLayer hal = si.getHardware(); |
|
||||
setCpuInfo(hal.getProcessor()); |
|
||||
setMemInfo(hal.getMemory()); |
|
||||
setSysInfo(); |
|
||||
setJvmInfo(); |
|
||||
setSysFiles(si.getOperatingSystem()); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 设置CPU信息 |
|
||||
*/ |
|
||||
private void setCpuInfo(CentralProcessor processor) { |
|
||||
// CPU信息
|
|
||||
long[] prevTicks = processor.getSystemCpuLoadTicks(); |
|
||||
Util.sleep(OSHI_WAIT_SECOND); |
|
||||
long[] ticks = processor.getSystemCpuLoadTicks(); |
|
||||
long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()]; |
|
||||
long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()]; |
|
||||
long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()]; |
|
||||
long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()]; |
|
||||
long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()]; |
|
||||
long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()]; |
|
||||
long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()]; |
|
||||
long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()]; |
|
||||
long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal; |
|
||||
cpu.setNumber(processor.getLogicalProcessorCount()); |
|
||||
cpu.setTotalUsed(totalCpu); |
|
||||
cpu.setSysUsed(cSys); |
|
||||
cpu.setUserUsed(user); |
|
||||
cpu.setWait(iowait); |
|
||||
cpu.setFree(idle); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 设置内存信息 |
|
||||
*/ |
|
||||
private void setMemInfo(GlobalMemory memory) { |
|
||||
mem.setTotal(memory.getTotal()); |
|
||||
mem.setUsed(memory.getTotal() - memory.getAvailable()); |
|
||||
mem.setFree(memory.getAvailable()); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 设置服务器信息 |
|
||||
*/ |
|
||||
private void setSysInfo() { |
|
||||
Properties props = System.getProperties(); |
|
||||
sys.setOsName(props.getProperty("os.name")); |
|
||||
sys.setOsArch(props.getProperty("os.arch")); |
|
||||
sys.setUserDir(props.getProperty("user.dir")); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 设置Java虚拟机 |
|
||||
*/ |
|
||||
private void setJvmInfo() throws UnknownHostException { |
|
||||
Properties props = System.getProperties(); |
|
||||
jvm.setTotal(Runtime.getRuntime().totalMemory()); |
|
||||
jvm.setMax(Runtime.getRuntime().maxMemory()); |
|
||||
jvm.setFree(Runtime.getRuntime().freeMemory()); |
|
||||
jvm.setVersion(props.getProperty("java.version")); |
|
||||
jvm.setHome(props.getProperty("java.home")); |
|
||||
} |
|
||||
|
|
||||
/** |
|
||||
* 设置磁盘信息 |
|
||||
*/ |
|
||||
private void setSysFiles(OperatingSystem os) { |
|
||||
FileSystem fileSystem = os.getFileSystem(); |
|
||||
List<OSFileStore> fsArray = fileSystem.getFileStores(); |
|
||||
for (OSFileStore fs : fsArray) { |
|
||||
long free = fs.getUsableSpace(); |
|
||||
long total = fs.getTotalSpace(); |
|
||||
long used = total - free; |
|
||||
SysFile sysFile = new SysFile(); |
|
||||
sysFile.setDirName(fs.getMount()); |
|
||||
sysFile.setSysTypeName(fs.getType()); |
|
||||
sysFile.setTypeName(fs.getName()); |
|
||||
sysFile.setTotal(total); |
|
||||
sysFile.setFree(free); |
|
||||
sysFile.setUsed(used); |
|
||||
sysFile.setUsage(used/total); |
|
||||
sysFiles.add(sysFile); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
public Cpu getCpu() { |
|
||||
return cpu; |
|
||||
} |
|
||||
|
|
||||
public void setCpu(Cpu cpu) { |
|
||||
this.cpu = cpu; |
|
||||
} |
|
||||
|
|
||||
public Mem getMem() { |
|
||||
return mem; |
|
||||
} |
|
||||
|
|
||||
public void setMem(Mem mem) { |
|
||||
this.mem = mem; |
|
||||
} |
|
||||
|
|
||||
public Jvm getJvm() { |
|
||||
return jvm; |
|
||||
} |
|
||||
|
|
||||
public void setJvm(Jvm jvm) { |
|
||||
this.jvm = jvm; |
|
||||
} |
|
||||
|
|
||||
public Sys getSys() { |
|
||||
return sys; |
|
||||
} |
|
||||
|
|
||||
public void setSys(Sys sys) { |
|
||||
this.sys = sys; |
|
||||
} |
|
||||
|
|
||||
public List<SysFile> getSysFiles() { |
|
||||
return sysFiles; |
|
||||
} |
|
||||
|
|
||||
public void setSysFiles(List<SysFile> sysFiles) { |
|
||||
this.sysFiles = sysFiles; |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,82 @@ |
|||||
|
package io.sc.platform.monitor.service.support; |
||||
|
|
||||
|
import oshi.SystemInfo; |
||||
|
|
||||
|
public class ServerInfo { |
||||
|
private Hardware hardware; |
||||
|
private Os os; |
||||
|
private Cpu cpu; |
||||
|
private Memory memory; |
||||
|
private Disk disk; |
||||
|
private Jvm jvm; |
||||
|
private int onlineUserCount; |
||||
|
|
||||
|
public static ServerInfo info(){ |
||||
|
SystemInfo si = new SystemInfo(); |
||||
|
|
||||
|
ServerInfo server =new ServerInfo(); |
||||
|
server.setHardware(Hardware.from(si.getHardware())); |
||||
|
server.setOs(Os.from(si.getOperatingSystem())); |
||||
|
server.setCpu(Cpu.from(si.getHardware().getProcessor())); |
||||
|
server.setMemory(Memory.from(si.getHardware().getMemory())); |
||||
|
server.setDisk(Disk.from()); |
||||
|
server.setJvm(Jvm.from()); |
||||
|
return server; |
||||
|
} |
||||
|
|
||||
|
public Hardware getHardware() { |
||||
|
return hardware; |
||||
|
} |
||||
|
|
||||
|
public void setHardware(Hardware hardware) { |
||||
|
this.hardware = hardware; |
||||
|
} |
||||
|
|
||||
|
public Os getOs() { |
||||
|
return os; |
||||
|
} |
||||
|
|
||||
|
public void setOs(Os os) { |
||||
|
this.os = os; |
||||
|
} |
||||
|
|
||||
|
public Cpu getCpu() { |
||||
|
return cpu; |
||||
|
} |
||||
|
|
||||
|
public void setCpu(Cpu cpu) { |
||||
|
this.cpu = cpu; |
||||
|
} |
||||
|
|
||||
|
public Memory getMemory() { |
||||
|
return memory; |
||||
|
} |
||||
|
|
||||
|
public void setMemory(Memory memory) { |
||||
|
this.memory = memory; |
||||
|
} |
||||
|
|
||||
|
public Disk getDisk() { |
||||
|
return disk; |
||||
|
} |
||||
|
|
||||
|
public void setDisk(Disk disk) { |
||||
|
this.disk = disk; |
||||
|
} |
||||
|
|
||||
|
public Jvm getJvm() { |
||||
|
return jvm; |
||||
|
} |
||||
|
|
||||
|
public void setJvm(Jvm jvm) { |
||||
|
this.jvm = jvm; |
||||
|
} |
||||
|
|
||||
|
public int getOnlineUserCount() { |
||||
|
return onlineUserCount; |
||||
|
} |
||||
|
|
||||
|
public void setOnlineUserCount(int onlineUserCount) { |
||||
|
this.onlineUserCount = onlineUserCount; |
||||
|
} |
||||
|
} |
@ -1,68 +0,0 @@ |
|||||
package io.sc.platform.monitor.service.support; |
|
||||
|
|
||||
public class Sys { |
|
||||
/** |
|
||||
* 服务器名称 |
|
||||
*/ |
|
||||
private String computerName; |
|
||||
|
|
||||
/** |
|
||||
* 服务器Ip |
|
||||
*/ |
|
||||
private String computerIp; |
|
||||
|
|
||||
/** |
|
||||
* 项目路径 |
|
||||
*/ |
|
||||
private String userDir; |
|
||||
|
|
||||
/** |
|
||||
* 操作系统 |
|
||||
*/ |
|
||||
private String osName; |
|
||||
|
|
||||
/** |
|
||||
* 系统架构 |
|
||||
*/ |
|
||||
private String osArch; |
|
||||
|
|
||||
public String getComputerName() { |
|
||||
return computerName; |
|
||||
} |
|
||||
|
|
||||
public void setComputerName(String computerName) { |
|
||||
this.computerName = computerName; |
|
||||
} |
|
||||
|
|
||||
public String getComputerIp() { |
|
||||
return computerIp; |
|
||||
} |
|
||||
|
|
||||
public void setComputerIp(String computerIp) { |
|
||||
this.computerIp = computerIp; |
|
||||
} |
|
||||
|
|
||||
public String getUserDir() { |
|
||||
return userDir; |
|
||||
} |
|
||||
|
|
||||
public void setUserDir(String userDir) { |
|
||||
this.userDir = userDir; |
|
||||
} |
|
||||
|
|
||||
public String getOsName() { |
|
||||
return osName; |
|
||||
} |
|
||||
|
|
||||
public void setOsName(String osName) { |
|
||||
this.osName = osName; |
|
||||
} |
|
||||
|
|
||||
public String getOsArch() { |
|
||||
return osArch; |
|
||||
} |
|
||||
|
|
||||
public void setOsArch(String osArch) { |
|
||||
this.osArch = osArch; |
|
||||
} |
|
||||
} |
|
@ -1,94 +0,0 @@ |
|||||
package io.sc.platform.monitor.service.support; |
|
||||
|
|
||||
public class SysFile { |
|
||||
/** |
|
||||
* 盘符路径 |
|
||||
*/ |
|
||||
private String dirName; |
|
||||
|
|
||||
/** |
|
||||
* 盘符类型 |
|
||||
*/ |
|
||||
private String sysTypeName; |
|
||||
|
|
||||
/** |
|
||||
* 文件类型 |
|
||||
*/ |
|
||||
private String typeName; |
|
||||
|
|
||||
/** |
|
||||
* 总大小 |
|
||||
*/ |
|
||||
private long total; |
|
||||
|
|
||||
/** |
|
||||
* 剩余大小 |
|
||||
*/ |
|
||||
private long free; |
|
||||
|
|
||||
/** |
|
||||
* 已经使用量 |
|
||||
*/ |
|
||||
private long used; |
|
||||
|
|
||||
/** |
|
||||
* 资源的使用率 |
|
||||
*/ |
|
||||
private double usage; |
|
||||
|
|
||||
public String getDirName() { |
|
||||
return dirName; |
|
||||
} |
|
||||
|
|
||||
public void setDirName(String dirName) { |
|
||||
this.dirName = dirName; |
|
||||
} |
|
||||
|
|
||||
public String getSysTypeName() { |
|
||||
return sysTypeName; |
|
||||
} |
|
||||
|
|
||||
public void setSysTypeName(String sysTypeName) { |
|
||||
this.sysTypeName = sysTypeName; |
|
||||
} |
|
||||
|
|
||||
public String getTypeName() { |
|
||||
return typeName; |
|
||||
} |
|
||||
|
|
||||
public void setTypeName(String typeName) { |
|
||||
this.typeName = typeName; |
|
||||
} |
|
||||
|
|
||||
public long getTotal() { |
|
||||
return total; |
|
||||
} |
|
||||
|
|
||||
public void setTotal(long total) { |
|
||||
this.total = total; |
|
||||
} |
|
||||
|
|
||||
public long getFree() { |
|
||||
return free; |
|
||||
} |
|
||||
|
|
||||
public void setFree(long free) { |
|
||||
this.free = free; |
|
||||
} |
|
||||
|
|
||||
public long getUsed() { |
|
||||
return used; |
|
||||
} |
|
||||
|
|
||||
public void setUsed(long used) { |
|
||||
this.used = used; |
|
||||
} |
|
||||
|
|
||||
public double getUsage() { |
|
||||
return usage; |
|
||||
} |
|
||||
|
|
||||
public void setUsage(double usage) { |
|
||||
this.usage = usage; |
|
||||
} |
|
||||
} |
|
@ -1,4 +1,4 @@ |
|||||
Manifest-Version: 1.0 |
Manifest-Version: 1.0 |
||||
Implementation-Vendor: io.sc |
Implementation-Vendor: io.sc |
||||
Implementation-Title: io.sc.platform.mvc |
Implementation-Title: io.sc.platform.monitor |
||||
Implementation-Version: 1.0.0 |
Implementation-Version: 1.0.0 |
||||
|
@ -1,15 +0,0 @@ |
|||||
# Auto Configuration |
|
||||
#org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ |
|
||||
#io.sc.platform.mvc.autoconfigure.MvcWebMvcAutoConfiguration,\ |
|
||||
#io.sc.platform.mvc.autoconfigure.MvcServiceProviderAutoConfiguration,\ |
|
||||
#io.sc.platform.mvc.autoconfigure.ReturnValueAutoConfiguration,\ |
|
||||
#io.sc.platform.mvc.autoconfigure.MvcErrorAutoConfiguration |
|
||||
|
|
||||
# Auto Configuration |
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ |
|
||||
io.sc.platform.mvc.autoconfigure.MvcServiceProviderAutoConfiguration |
|
||||
|
|
||||
|
|
||||
# platform plugin spi service |
|
||||
io.sc.platform.core.spi.PluginSpiService=\ |
|
||||
io.sc.platform.mvc.plugins.PluginSpiServiceImpl |
|
@ -0,0 +1,44 @@ |
|||||
|
package io.sc.platform.mvc.autoconfigure.support; |
||||
|
|
||||
|
import io.sc.platform.security.util.SecurityUtil; |
||||
|
import org.apache.commons.logging.Log; |
||||
|
import org.apache.commons.logging.LogFactory; |
||||
|
import org.springframework.lang.Nullable; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.util.StringUtils; |
||||
|
import org.springframework.web.servlet.HandlerInterceptor; |
||||
|
import org.springframework.web.servlet.LocaleResolver; |
||||
|
import org.springframework.web.servlet.support.RequestContextUtils; |
||||
|
|
||||
|
import javax.servlet.ServletException; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import java.util.HashSet; |
||||
|
import java.util.Locale; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
public class OnlineUserCounterInterceptor implements HandlerInterceptor { |
||||
|
private static final Set<String> sessionIds =new HashSet<>(); |
||||
|
|
||||
|
public static void addSession(String sessionId) { |
||||
|
if(StringUtils.hasText(sessionId)) { |
||||
|
sessionIds.add(sessionId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static void removeSession(String sessionId) { |
||||
|
if(StringUtils.hasText(sessionId)) { |
||||
|
sessionIds.remove(sessionId); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public static int count(){ |
||||
|
return sessionIds.size(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException { |
||||
|
OnlineUserCounterInterceptor.addSession(SecurityUtil.getUserId()); |
||||
|
return true; |
||||
|
} |
||||
|
} |
@ -1,4 +0,0 @@ |
|||||
<template> |
|
||||
<div>Resources</div> |
|
||||
</template> |
|
||||
<script setup lang="ts"></script> |
|
@ -0,0 +1,215 @@ |
|||||
|
<template> |
||||
|
<div class="pt-4"> |
||||
|
<div class="row"> |
||||
|
<div class="col-4 px-4"> |
||||
|
<q-card> |
||||
|
<q-card-section> |
||||
|
<div class="text-h6">{{ $t('system.monitor.serverInfo.hardware') }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600"> |
||||
|
{{ $t('system.monitor.serverInfo.hardware.manufacturer') }} : {{ serverInfo?.hardware?.manufacturer }} |
||||
|
</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.hardware.model') }} : {{ serverInfo?.hardware?.model }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600"> |
||||
|
{{ $t('system.monitor.serverInfo.hardware.serialNumber') }} : {{ serverInfo?.hardware?.serialNumber }} |
||||
|
</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600"> |
||||
|
{{ $t('system.monitor.serverInfo.hardware.physicalProcessorCount') }} : {{ serverInfo?.hardware?.physicalProcessorCount }} |
||||
|
</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600"> |
||||
|
{{ $t('system.monitor.serverInfo.hardware.logicalProcessorCount') }} : {{ serverInfo?.hardware?.logicalProcessorCount }} |
||||
|
</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600"> |
||||
|
{{ $t('system.monitor.serverInfo.hardware.physicalMemory') }} : {{ serverInfo?.hardware?.physicalMemory }} G |
||||
|
</div> |
||||
|
</q-card-section> |
||||
|
</q-card> |
||||
|
</div> |
||||
|
<div class="col-4 px-4"> |
||||
|
<q-card> |
||||
|
<q-card-section> |
||||
|
<div class="text-h6">{{ $t('system.monitor.serverInfo.os') }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.name') }} : {{ serverInfo?.os?.name }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.version') }} : {{ serverInfo?.os?.version }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.arch') }} : {{ serverInfo?.os?.arch }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.manufacturer') }} : {{ serverInfo?.os?.manufacturer }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.bootTime') }} : {{ serverInfo?.os?.bootTime }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.upTime') }} : {{ serverInfo?.os?.upTime }}</div> |
||||
|
</q-card-section> |
||||
|
</q-card> |
||||
|
</div> |
||||
|
<div class="col-4 px-4"> |
||||
|
<q-card> |
||||
|
<q-card-section> |
||||
|
<div class="text-h6">{{ $t('system.monitor.serverInfo.jvm') }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.total') }} : {{ serverInfo?.jvm?.total }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.max') }} : {{ serverInfo?.jvm?.max }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.free') }} : {{ serverInfo?.jvm?.free }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.version') }} : {{ serverInfo?.jvm?.version }}</div> |
||||
|
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.home') }} : {{ serverInfo?.jvm?.home }}</div> |
||||
|
</q-card-section> |
||||
|
<q-separator /> |
||||
|
</q-card> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row pt-4"> |
||||
|
<div class="col-4 px-4"> |
||||
|
<q-card> |
||||
|
<q-card-section> |
||||
|
<div class="text-h6">{{ $t('system.monitor.serverInfo.cpu') }}</div> |
||||
|
<w-echarts ref="cpuEchartsRef" style="width: 100%; height: 250px" :option="cpuOption"></w-echarts> |
||||
|
</q-card-section> |
||||
|
</q-card> |
||||
|
</div> |
||||
|
<div class="col-4 px-4"> |
||||
|
<q-card> |
||||
|
<q-card-section> |
||||
|
<div class="text-h6">{{ $t('system.monitor.serverInfo.memory') }}</div> |
||||
|
<w-echarts ref="memoryEchartsRef" style="width: 100%; height: 250px" :option="memoryOption"></w-echarts> |
||||
|
</q-card-section> |
||||
|
</q-card> |
||||
|
</div> |
||||
|
<div class="col-4 px-4"> |
||||
|
<q-card> |
||||
|
<q-card-section> |
||||
|
<div class="text-h6">{{ $t('system.monitor.serverInfo.disk') }}</div> |
||||
|
<w-echarts ref="diskEchartsRef" style="width: 100%; height: 250px" :option="diskOption"></w-echarts> |
||||
|
</q-card-section> |
||||
|
</q-card> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="row pt-4"> |
||||
|
<div class="col-4 px-4"> |
||||
|
<q-card> |
||||
|
<q-card-section> |
||||
|
<div class="text-h6">{{ $t('system.monitor.serverInfo.online') }}</div> |
||||
|
<w-echarts ref="onlineEchartsRef" style="width: 100%; height: 250px" :option="onlineOption"></w-echarts> |
||||
|
</q-card-section> |
||||
|
</q-card> |
||||
|
</div> |
||||
|
<div class="col-4 px-4"></div> |
||||
|
<div class="col-4 px-4"></div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { ref, onMounted, onActivated, onDeactivated } from 'vue'; |
||||
|
import { axios, Environment, t } from 'platform-core'; |
||||
|
|
||||
|
const serverInfo = ref(); |
||||
|
const cpuEchartsRef = ref(); |
||||
|
const cpuOption = { |
||||
|
animation: false, |
||||
|
legend: { data: [t('system.monitor.serverInfo.cpu.system'), t('system.monitor.serverInfo.cpu.user')] }, |
||||
|
grid: { right: '4%', bottom: '3%' }, |
||||
|
xAxis: [{ type: 'category', data: [] }], |
||||
|
yAxis: [{ type: 'value', min: 0, max: 1 }], |
||||
|
series: [ |
||||
|
{ name: t('system.monitor.serverInfo.cpu.system'), type: 'line', stack: 'Total', showSymbol: false, smooth: true, areaStyle: {}, data: [] }, |
||||
|
{ name: t('system.monitor.serverInfo.cpu.user'), type: 'line', stack: 'Total', showSymbol: false, smooth: true, areaStyle: {}, data: [] }, |
||||
|
], |
||||
|
}; |
||||
|
|
||||
|
const memoryEchartsRef = ref(); |
||||
|
const memoryOption = { |
||||
|
animation: false, |
||||
|
grid: { right: '4%', bottom: '3%' }, |
||||
|
xAxis: [{ type: 'category', data: [] }], |
||||
|
yAxis: [{ type: 'value', min: 0, max: 1 }], |
||||
|
series: [{ type: 'line', stack: 'Total', showSymbol: false, smooth: true, areaStyle: {}, data: [] }], |
||||
|
}; |
||||
|
|
||||
|
const diskEchartsRef = ref(); |
||||
|
const diskOption = { |
||||
|
animation: false, |
||||
|
legend: {}, |
||||
|
tooltip: { |
||||
|
trigger: 'item', |
||||
|
formatter: (params) => { |
||||
|
return params.value + ' G'; |
||||
|
}, |
||||
|
}, |
||||
|
series: [ |
||||
|
{ |
||||
|
type: 'pie', |
||||
|
top: 50, |
||||
|
emphasis: { |
||||
|
itemStyle: { |
||||
|
shadowBlur: 10, |
||||
|
shadowOffsetX: 0, |
||||
|
shadowColor: 'rgba(0, 0, 0, 0.5)', |
||||
|
}, |
||||
|
}, |
||||
|
avoidLabelOverlap: false, |
||||
|
label: { |
||||
|
show: false, |
||||
|
position: 'center', |
||||
|
}, |
||||
|
data: [ |
||||
|
{ value: 0, name: t('system.monitor.serverInfo.disk.used') }, |
||||
|
{ value: 0, name: t('system.monitor.serverInfo.disk.free') }, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
|
||||
|
const onlineEchartsRef = ref(); |
||||
|
const onlineOption = { |
||||
|
animation: false, |
||||
|
grid: { right: '4%', bottom: '3%' }, |
||||
|
xAxis: [{ type: 'category', data: [] }], |
||||
|
yAxis: [{ type: 'value' }], |
||||
|
series: [{ type: 'line', stack: 'Total', showSymbol: false, smooth: true, data: [] }], |
||||
|
}; |
||||
|
|
||||
|
const refresh = () => { |
||||
|
axios.get(Environment.apiContextPath('/api/monitor/metrics')).then((response) => { |
||||
|
const data = response.data; |
||||
|
data.hardware.physicalMemory = (data.hardware.physicalMemory / 1024 / 1024 / 1024).toFixed(2); |
||||
|
serverInfo.value = data; |
||||
|
// cpu |
||||
|
cpuOption.xAxis[0].data.push(''); |
||||
|
cpuOption.series[0].data.push(data.cpu.sysUsed / data.cpu.totalUsed); |
||||
|
cpuOption.series[1].data.push(data.cpu.userUsed / data.cpu.totalUsed); |
||||
|
if (cpuOption.xAxis[0].data.length > 60) { |
||||
|
cpuOption.xAxis[0].data.shift(); |
||||
|
cpuOption.series[0].data.shift(); |
||||
|
cpuOption.series[1].data.shift(); |
||||
|
} |
||||
|
cpuEchartsRef.value.setOption(cpuOption); |
||||
|
// memory |
||||
|
memoryOption.xAxis[0].data.push(''); |
||||
|
memoryOption.series[0].data.push(data.memory.used / data.memory.total); |
||||
|
if (memoryOption.xAxis[0].data.length > 60) { |
||||
|
memoryOption.xAxis[0].data.shift(); |
||||
|
memoryOption.series[0].data.shift(); |
||||
|
} |
||||
|
memoryEchartsRef.value.setOption(memoryOption); |
||||
|
// disk |
||||
|
diskOption.series[0].data[0].value = (data.disk.used / 1000 / 1000 / 1000).toFixed(2); |
||||
|
diskOption.series[0].data[1].value = (data.disk.free / 1000 / 1000 / 1000).toFixed(2); |
||||
|
diskEchartsRef.value.setOption(diskOption); |
||||
|
// online user |
||||
|
onlineOption.xAxis[0].data.push(''); |
||||
|
onlineOption.series[0].data.push(data.onlineUserCount); |
||||
|
if (onlineOption.xAxis[0].data.length > 60) { |
||||
|
onlineOption.xAxis[0].data.shift(); |
||||
|
onlineOption.series[0].data.shift(); |
||||
|
} |
||||
|
onlineEchartsRef.value.setOption(onlineOption); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
onMounted(() => { |
||||
|
refresh(); |
||||
|
}); |
||||
|
|
||||
|
let intervalHandler; |
||||
|
|
||||
|
onActivated(() => { |
||||
|
intervalHandler = setInterval(refresh, 2000); |
||||
|
}); |
||||
|
|
||||
|
onDeactivated(() => { |
||||
|
clearInterval(intervalHandler); |
||||
|
}); |
||||
|
</script> |
@ -0,0 +1,21 @@ |
|||||
|
package io.sc.platform.system.monitor.controller; |
||||
|
|
||||
|
import io.sc.platform.monitor.service.SystemMonitor; |
||||
|
import io.sc.platform.monitor.service.impl.SystemMonitorImpl; |
||||
|
import io.sc.platform.monitor.service.support.ServerInfo; |
||||
|
import io.sc.platform.mvc.autoconfigure.support.OnlineUserCounterInterceptor; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/api/monitor") |
||||
|
public class MetricsWebController { |
||||
|
@GetMapping("metrics") |
||||
|
public ServerInfo metrics() throws Exception { |
||||
|
SystemMonitor monitor =new SystemMonitorImpl(); |
||||
|
ServerInfo serverInfo =monitor.getServerInfo(); |
||||
|
serverInfo.setOnlineUserCount(OnlineUserCounterInterceptor.count()); |
||||
|
return serverInfo; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue