index.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. /* eslint-disable quote-props */
  2. import i18n from '@/locales'
  3. import BrandIcon from '@/sections/BrandIcon'
  4. export const metricMaps = {
  5. cpu: {
  6. key: 'cpu',
  7. label: i18n.t('monitor.metrics_cpu'),
  8. metrics: {
  9. usage_active: {
  10. key: 'usage_active',
  11. label: i18n.t('monitor.metrics_cpu_usage_active'),
  12. },
  13. },
  14. },
  15. disk: {
  16. key: 'disk',
  17. label: i18n.t('monitor.metrics_disk'),
  18. metrics: {
  19. used_percent: {
  20. key: 'used_percent',
  21. label: i18n.t('monitor.metrics_disk_used_percent'),
  22. },
  23. },
  24. },
  25. diskio: {
  26. key: 'diskio',
  27. label: i18n.t('monitor.metrics_disk_used_percent'),
  28. },
  29. haproxy: {
  30. key: 'haproxy',
  31. label: '',
  32. },
  33. internal_agent: {
  34. key: 'internal_agent',
  35. label: '',
  36. },
  37. internal_gather: {
  38. key: 'internal_gather',
  39. label: '',
  40. },
  41. internal_http_listener: {
  42. key: 'internal_http_listener',
  43. label: '',
  44. },
  45. internal_write: {
  46. key: 'internal_write',
  47. label: '',
  48. },
  49. jenkins_node: {
  50. key: 'jenkins_node',
  51. label: '',
  52. },
  53. kernel: {
  54. key: 'kernel',
  55. label: '',
  56. },
  57. kernel_vmstat: {
  58. key: 'kernel_vmstat',
  59. label: '',
  60. },
  61. mem: {
  62. key: 'mem',
  63. label: i18n.t('monitor.metrics_mem'),
  64. },
  65. net: {
  66. key: 'net',
  67. label: i18n.t('monitor.metrics_net'),
  68. },
  69. netstat: {
  70. key: 'netstat',
  71. label: '',
  72. },
  73. nstat: {
  74. key: 'nstat',
  75. label: '',
  76. },
  77. ntpq: {
  78. key: 'ntpq',
  79. label: '',
  80. },
  81. ping: {
  82. key: 'ping',
  83. label: '',
  84. },
  85. processes: {
  86. key: 'processes',
  87. label: '',
  88. },
  89. swap: {
  90. key: 'swap',
  91. label: '',
  92. },
  93. system: {
  94. key: 'system',
  95. label: '',
  96. },
  97. usage: {
  98. key: 'usage',
  99. label: '',
  100. },
  101. vm_capacity: {
  102. key: 'vm_capacity',
  103. label: i18n.t('monitor.metrics_vm_capacity'),
  104. metrics: {
  105. disk: {
  106. key: 'disk',
  107. label: i18n.t('monitor.metrics_vm_capacity_disk'),
  108. },
  109. vcpu_count: {
  110. key: 'vcpu_count',
  111. label: i18n.t('monitor.metrics_vm_capacity_vcpu_count'),
  112. },
  113. vmem_size: {
  114. key: 'vmem_size',
  115. label: i18n.t('monitor.metrics_vm_capacity_vmem_size'),
  116. },
  117. },
  118. },
  119. vm_cpu: {
  120. key: 'vm_cpu',
  121. label: i18n.t('monitor.metrics_vm_cpu'),
  122. metrics: {
  123. cpu_count: {
  124. key: 'cpu_count',
  125. label: i18n.t('monitor.metrics_vm_cpu_cpu_count'),
  126. },
  127. usage_active: {
  128. key: 'usage_active',
  129. label: i18n.t('monitor.metrics_vm_cpu_usage_active'),
  130. },
  131. },
  132. },
  133. vm_diskio: {
  134. key: 'vm_diskio',
  135. label: i18n.t('monitor.metrics_vm_diskio'),
  136. },
  137. vm_mem: {
  138. key: 'vm_mem',
  139. label: i18n.t('monitor.metrics_vm_mem'),
  140. },
  141. vm_netio: {
  142. key: 'vm_netio',
  143. label: i18n.t('monitor.metrics_vm_netio'),
  144. },
  145. }
  146. // 顺序决定在 tableColumn 的顺序
  147. export const tableColumnMaps = {
  148. __metric: {
  149. title: i18n.t('monitor.monitor_metric'),
  150. field: '__metric',
  151. },
  152. vm_name: {
  153. title: i18n.t('common.name'),
  154. field: 'vm_name',
  155. },
  156. oss_name: {
  157. title: i18n.t('common.name'),
  158. field: 'oss_name',
  159. },
  160. redis_name: {
  161. title: i18n.t('common.name'),
  162. field: 'redis_name',
  163. },
  164. rds_name: {
  165. title: i18n.t('common.name'),
  166. field: 'rds_name',
  167. },
  168. storage_name: {
  169. title: i18n.t('common.name'),
  170. field: 'storage_name',
  171. },
  172. vm_ip: {
  173. title: 'IP',
  174. field: 'vm_ip',
  175. },
  176. host: {
  177. title: i18n.t('common_305'),
  178. field: 'host',
  179. },
  180. path: {
  181. title: i18n.t('monitor.path'),
  182. field: 'path',
  183. },
  184. host_ip: {
  185. title: `${i18n.t('common_305')} IP`,
  186. field: 'host_ip',
  187. },
  188. cloudaccount_name: {
  189. title: i18n.t('common_295'),
  190. field: 'cloudaccount_name',
  191. },
  192. brand: {
  193. title: i18n.t('common.brand'),
  194. field: 'brand',
  195. slots: {
  196. default: ({ row }, h) => {
  197. if (row.brand) {
  198. return [<BrandIcon name={ row.brand } />]
  199. }
  200. return '-'
  201. },
  202. },
  203. },
  204. }
  205. export const alertStrategyMaps = {
  206. avg: i18n.t('monitor.avg'),
  207. max: i18n.t('monitor.max'),
  208. min: i18n.t('monitor.min'),
  209. last: i18n.t('monitor.last'),
  210. delta: i18n.t('monitor.delta'),
  211. }
  212. export const preiodMaps = {
  213. '5m': { key: '5m', label: i18n.t('monitor.text00018') },
  214. '10m': { key: '10m', label: i18n.t('monitor.text00019') },
  215. '15m': { key: '15m', label: i18n.t('monitor.text00020') },
  216. '30m': { key: '30m', label: i18n.t('monitor.text00021') },
  217. '60m': { key: '60m', label: i18n.t('monitor.text00022') },
  218. '180m': { key: '180m', label: i18n.t('monitor.text00023') },
  219. }
  220. export const levelMaps = {
  221. normal: {
  222. color: 'cyan',
  223. key: 'normal',
  224. label: i18n.t('monitor.normal'),
  225. },
  226. important: {
  227. color: 'pink',
  228. key: 'important',
  229. label: i18n.t('monitor.important'),
  230. },
  231. fatal: {
  232. color: 'red',
  233. key: 'fatal',
  234. label: i18n.t('monitor.fatal'),
  235. },
  236. }
  237. export const metric_zh = {
  238. 'CPU idle rate per core': i18n.t('monitor_metric_1'),
  239. 'CPU usage per core': i18n.t('monitor_metric_2'),
  240. 'CPU user state time': i18n.t('monitor_metric_3'),
  241. 'CPU system state time': i18n.t('monitor_metric_4'),
  242. 'CPU active state utilization rate': i18n.t('monitor_metric_5'),
  243. 'CPU guest usage': i18n.t('monitor_metric_6'),
  244. 'CPU guest_ Nice usage': i18n.t('monitor_metric_7'),
  245. 'CPU idle state utilization rate': i18n.t('monitor_metric_8'),
  246. 'CPU IO usage': i18n.t('monitor_metric_9'),
  247. 'CPU IRQ usage': i18n.t('monitor_metric_10'),
  248. 'CPU priority switch utilization': i18n.t('monitor_metric_11'),
  249. 'CPU softirq usage': i18n.t('monitor_metric_12'),
  250. 'Utilization rate of CPU steel': i18n.t('monitor_metric_13'),
  251. 'CPU system state utilization rate': i18n.t('monitor_metric_14'),
  252. 'CPU user mode utilization rate': i18n.t('monitor_metric_15'),
  253. 'Free space size': i18n.t('monitor_metric_16'),
  254. 'Percentage of used inodes': i18n.t('monitor_metric_inodes_used_percent'),
  255. 'Available inode': i18n.t('monitor_metric_17'),
  256. 'Total inodes': i18n.t('monitor_metric_18'),
  257. 'Number of inodes used': i18n.t('monitor_metric_19'),
  258. 'Total disk size': i18n.t('monitor_metric_20'),
  259. 'Used disk size': i18n.t('monitor_metric_21'),
  260. 'Percentage of used disks': i18n.t('monitor_metric_22'),
  261. 'Number of reads': i18n.t('monitor_metric_23'),
  262. 'Number of writes': i18n.t('monitor_metric_24'),
  263. 'Bytes read': i18n.t('monitor_metric_25'),
  264. 'Time to wait for read': i18n.t('monitor_metric_26'),
  265. 'I / O request queuing time': i18n.t('monitor_metric_27'),
  266. 'I / O request waiting time': i18n.t('monitor_metric_28'),
  267. 'Number of I / O requests issued but not yet completed': i18n.t('monitor_metric_29'),
  268. 'Available memory rate': i18n.t('monitor_metric_30'),
  269. 'Buffer memory': i18n.t('monitor_metric_31'),
  270. 'Cache memory': i18n.t('monitor_metric_32'),
  271. 'Free memory': i18n.t('monitor_metric_33'),
  272. 'Number of kernel caches': i18n.t('monitor_metric_34'),
  273. 'The total number of bytes sent by the network interface': i18n.t('monitor_metric_35'),
  274. 'The total number of bytes received by the network interface': i18n.t('monitor_metric_36'),
  275. 'The total number of packets sent by the network interface': i18n.t('monitor_metric_37'),
  276. 'The total number of receive errors detected by the network interface': i18n.t('monitor_metric_38'),
  277. 'The total number of transmission errors detected by the network interface': i18n.t('monitor_metric_39'),
  278. 'The total number of received packets dropped by the network interface': i18n.t('monitor_metric_40'),
  279. 'System disk total read BPS': i18n.t('monitor_metric_41'),
  280. 'System disk read IOPs': i18n.t('monitor_metric_42'),
  281. 'Virtual memory consumption': i18n.t('monitor_metric_43'),
  282. 'Actual use of physical memory': i18n.t('monitor_metric_44'),
  283. 'Object storage latency': i18n.t('monitor_metric_45'),
  284. 'Request average E2E delay': i18n.t('monitor_metric_46'),
  285. 'Object storage network traffic': i18n.t('monitor_metric_47'),
  286. 'Receive byte': i18n.t('monitor_metric_48'),
  287. 'Send byte': i18n.t('monitor.text_117'),
  288. 'Object store request': i18n.t('monitor_metric_49'),
  289. 'Connection usage': i18n.t('db.text_18'),
  290. 'Average memory usage': i18n.t('monitor_metric_50'),
  291. 'Received traffic per second': i18n.t('monitor_metric_51'),
  292. 'Send traffic per second': i18n.t('monitor_metric_52'),
  293. 'Number of commands processed per second': i18n.t('monitor_metric_53'),
  294. 'Number of cache keys': i18n.t('monitor_metric_54'),
  295. 'Data node memory usage': i18n.t('monitor_metric_55'),
  296. 'Disk traffic and timing': i18n.t('monitor_metric_56'),
  297. 'Guest memory': i18n.t('monitor_metric_57'),
  298. 'Redis operator': i18n.t('monitor_metric_58'),
  299. 'Disk usage': i18n.t('monitor_metric_59'),
  300. 'Network interface and protocol usage': i18n.t('monitor_metric_60'),
  301. 'Guest CPU usage': i18n.t('monitor_metric_61'),
  302. 'Guest disk traffic': i18n.t('monitor_metric_62'),
  303. 'Redis keys': i18n.t('monitor_metric_63'),
  304. 'Redis data memory': i18n.t('monitor_metric_64'),
  305. 'Rds connect': i18n.t('monitor_metric_65'),
  306. 'Rds disk usage': i18n.t('monitor_metric_66'),
  307. 'Rds network traffic': i18n.t('monitor_metric_67'),
  308. 'Redis connect': i18n.t('monitor_metric_68'),
  309. 'Rds memory': i18n.t('monitor_metric_69'),
  310. 'Redis network traffic': i18n.t('monitor_metric_70'),
  311. 'Redis memory': i18n.t('monitor_metric_71'),
  312. 'Redis CPU usage': i18n.t('monitor_metric_72'),
  313. 'Memory': i18n.t('monitor_metric_73'),
  314. 'CPU usage': i18n.t('monitor_metric_74'),
  315. 'Rds CPU usage': i18n.t('monitor_metric_74'),
  316. 'Cloud account balance': i18n.t('monitor_metric_76'),
  317. 'balance': i18n.t('monitor_metric_77'),
  318. 'Disk read rate': i18n.t('monitor_metric_79'),
  319. 'Disk write rate': i18n.t('monitor_metric_80'),
  320. 'Disk read operate rate': i18n.t('monitor_metric_81'),
  321. 'Disk write operate rate': i18n.t('monitor_metric_82'),
  322. 'Bytes write': i18n.t('monitor_metric_83'),
  323. 'Time to wait for write': i18n.t('monitor_metric_84'),
  324. 'Used memory rate': i18n.t('monitor_metric_85'),
  325. 'Used memory': i18n.t('monitor_metric_86'),
  326. 'Available memory': i18n.t('monitor_metric_87'),
  327. 'The amount of active memory': i18n.t('monitor_metric_88'),
  328. 'The amount of inactive memory': i18n.t('monitor_metric_89'),
  329. 'Total memory': i18n.t('monitor_metric_90'),
  330. 'The total number of packets received by the network interface': i18n.t('monitor_metric_91'),
  331. 'Outbound bandwidth utilization': i18n.t('monitor.out_bandwidth_usage'),
  332. 'The total number of transmission packets dropped by the network interface': i18n.t('monitor_metric_92'),
  333. 'CPU utilization rate per core': i18n.t('monitor_metric_93'),
  334. 'The number of threads used by the process': i18n.t('monitor_metric_94'),
  335. 'inodes_free/inodes_total': i18n.t('monitor_metric_96'),
  336. 'free/total': i18n.t('monitor_metric_97'),
  337. 'Guest network traffic': i18n.t('monitor_metric_98'),
  338. 'memory usage': i18n.t('monitor_metric_85'),
  339. 'request count': i18n.t('monitor.text_118'),
  340. 'Storage usage': i18n.t('monitor.storage_usage'),
  341. 'Free storage': i18n.t('monitor.free_storage'),
  342. 'Storage utilization rate': i18n.t('monitor.storage_utilization_rate'),
  343. 'cost_alert': i18n.t('monitor_metric_99'),
  344. 'amount': i18n.t('monitor_metric_100'),
  345. 'Guest disk': i18n.t('monitor_metric_59'),
  346. 'Used vm disk rate': i18n.t('monitor_metric_22'),
  347. 'Send packets per second': i18n.t('monitor.pps_sent'),
  348. 'Received packets per second': i18n.t('monitor.pps_recv'),
  349. 'k8s node': i18n.t('monitor.k8s_node'),
  350. }
  351. export const filterKeyMap = {
  352. brand: i18n.t('common.brand'),
  353. host: i18n.t('dictionary.host'),
  354. host_ip: i18n.t('dictionary.hostip'),
  355. tenant: { t: 'dictionary.project' },
  356. project_domain: { t: 'table.title.owner_domain' },
  357. cloudregion: i18n.t('common.region'),
  358. zone: i18n.t('common.zone'),
  359. vm_name: i18n.t('dictionary.server'),
  360. vm_ip: i18n.t('dictionary.serverip'),
  361. storage_name: i18n.t('storage.text_37'),
  362. oss_name: i18n.t('scope.text_77'),
  363. oss_ip: i18n.t('common_721'),
  364. elb_name: i18n.t('scope.text_105'),
  365. elb_ip: i18n.t('common_722'),
  366. cloudaccount_name: i18n.t('dictionary.cloudaccount'),
  367. disk_type: i18n.t('dictionary.disktype'),
  368. paltform: i18n.t('common.brand'),
  369. account: i18n.t('common.account'),
  370. database: i18n.t('db.text_28'),
  371. engine: i18n.t('monitor.instance_engine'),
  372. server_type: i18n.t('db.text_119'),
  373. rds_name: i18n.t('db.text_60'),
  374. currency: i18n.t('monitor.currency'),
  375. }
  376. export const MONITOR_MAX_POINTERS = 30