kube-prometheus监控Linux主机

参考 https://blog.51cto.com/u_11880730/11223693

https://github.com/prometheus/node_exporter

tar zxvf node_exporter-1.8.2.linux-amd64.tar.gz -C /usr/local/
cd  /usr/local/
mv node_exporter-1.0.1.linux-amd64 node_exporter

vim /usr/lib/systemd/system/node_exporter.service

[Unit]
Description=node_exporter
After=network.target[Service]
Type=simple
ExecStart=/usr/local/node_exporter/node_exporter[Install]
WantedBy=multi-user.target

http://172.17.13.1:9100/metrics

vim external-nodeexporter-service.yaml

apiVersion: v1
kind: Endpoints
metadata:labels:app.kubernetes.io/name: external-node-exporter    #endpoints 资源Labels标签name: external-node-exporter #endpoints 名称namespace: monitoring   #所属命名空间
subsets:  #用于指定一个或者多个IP,代表后端服务实例的地址
- addresses:- ip: 172.17.13.1- ip: 172.17.13.2- ip: 172.17.13.3- ip: 172.17.13.4- ip: 172.17.13.6- ip: 172.17.13.7- ip: 172.17.13.8- ip: 172.17.13.9- ip: 172.17.13.13ports:        #描述IP所使用的端口号信息- name: http-metricsport: 9100protocol: TCP
---
apiVersion: v1
kind: Service
metadata:labels:app.kubernetes.io/name: external-node-exporter #同样是用于指定svc资源的标签Labelsname: external-node-exporter #定义svc资源的名称namespace: monitoring   #定义所属命名空间
spec:ports: #定义了Svc所监控的端口以及关联的后端Pod端口信息- name: http-metrics   #定义了端口的名称port: 9100  #定义了svc所暴露出来的端口protocol: TCP  #定义了端口使用的协议targetPort: 9100  #定义了与svc所关联的Pod端口,该端口一般是Pod容器服务的内部端口sessionAffinity: None  #定义了会话亲和力类型,表示不启用亲和性,即新的请求可能会被路由到不同的后端Pod上,而不考虑之前请求的路由情况type: ClusterIP   #定义Svc访问类型,该类型只能在集群内部使用,适合作为后端服务的访问入口

vim external-nodeexporter-serviceMonitor.yaml

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor # prometheus-operator 定义的CRD
metadata:name: external-node-exporter namespace: monitoringlabels:k8s-apps: external-node-exporter
spec:jobLabel: app.kubernetes.io/name selector:matchLabels:app.kubernetes.io/name: external-node-exporternamespaceSelector:matchNames:  # 配置需要自动发现的命名空间,可以配置多个- monitoringendpoints:- port: http-metrics # 拉去metric的端口,这个写的是 service的端口名称,即 service yaml的spec.ports.nameinterval: 15s # 拉取metric的时间间隔

vim external-nodeexporter-prometheusRule.yaml
需注意复用的规则应将监控目标修改成外部的node Job名称,上述job名称为external-node-exporter。那么该规则同样要指定该job名称,否则监控规则无法生效

apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:labels:app.kubernetes.io/component: exporterapp.kubernetes.io/name: external-node-exporterapp.kubernetes.io/part-of: kube-prometheusapp.kubernetes.io/version: 1.8.2prometheus: k8srole: alert-rulesname: external-node-exporter-rulesnamespace: monitoring
spec:groups:- name: external-node-exporterrules:- alert: NodeFilesystemSpaceFillingUpannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left and is filling up.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemspacefillingupsummary: Filesystem is predicted to run out of space within the next 24 hours.expr: |(node_filesystem_avail_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_size_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 15andpredict_linear(node_filesystem_avail_bytes{job="external-node-exporter",fstype!="",mountpoint!=""}[6h], 24*60*60) < 0andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 1hlabels:severity: warning- alert: NodeFilesystemSpaceFillingUpannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left and is filling up fast.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemspacefillingupsummary: Filesystem is predicted to run out of space within the next 4 hours.expr: |(node_filesystem_avail_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_size_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 10andpredict_linear(node_filesystem_avail_bytes{job="external-node-exporter",fstype!="",mountpoint!=""}[6h], 4*60*60) < 0andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 1hlabels:severity: critical- alert: NodeFilesystemAlmostOutOfSpaceannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemalmostoutofspacesummary: Filesystem has less than 5% space left.expr: |(node_filesystem_avail_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_size_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 5andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 30mlabels:severity: warning- alert: NodeFilesystemAlmostOutOfSpaceannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available space left.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemalmostoutofspacesummary: Filesystem has less than 3% space left.expr: |(node_filesystem_avail_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_size_bytes{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 3andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 30mlabels:severity: critical- alert: NodeFilesystemFilesFillingUpannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left and is filling up.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemfilesfillingupsummary: Filesystem is predicted to run out of inodes within the next 24 hours.expr: |(node_filesystem_files_free{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_files{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 40andpredict_linear(node_filesystem_files_free{job="external-node-exporter",fstype!="",mountpoint!=""}[6h], 24*60*60) < 0andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 1hlabels:severity: warning- alert: NodeFilesystemFilesFillingUpannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left and is filling up fast.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemfilesfillingupsummary: Filesystem is predicted to run out of inodes within the next 4 hours.expr: |(node_filesystem_files_free{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_files{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 20andpredict_linear(node_filesystem_files_free{job="external-node-exporter",fstype!="",mountpoint!=""}[6h], 4*60*60) < 0andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 1hlabels:severity: critical- alert: NodeFilesystemAlmostOutOfFilesannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemalmostoutoffilessummary: Filesystem has less than 5% inodes left.expr: |(node_filesystem_files_free{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_files{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 5andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 1hlabels:severity: warning- alert: NodeFilesystemAlmostOutOfFilesannotations:description: Filesystem on {{ $labels.device }}, mounted on {{ $labels.mountpoint }}, at {{ $labels.instance }} has only {{ printf "%.2f" $value }}% available inodes left.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefilesystemalmostoutoffilessummary: Filesystem has less than 3% inodes left.expr: |(node_filesystem_files_free{job="external-node-exporter",fstype!="",mountpoint!=""} / node_filesystem_files{job="external-node-exporter",fstype!="",mountpoint!=""} * 100 < 3andnode_filesystem_readonly{job="external-node-exporter",fstype!="",mountpoint!=""} == 0)for: 1hlabels:severity: critical- alert: NodeNetworkReceiveErrsannotations:description: '{{ $labels.instance }} interface {{ $labels.device }} has encountered {{ printf "%.0f" $value }} receive errors in the last two minutes.'runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodenetworkreceiveerrssummary: Network interface is reporting many receive errors.expr: |rate(node_network_receive_errs_total{job="external-node-exporter"}[2m]) / rate(node_network_receive_packets_total{job="external-node-exporter"}[2m]) > 0.01for: 1hlabels:severity: warning- alert: NodeNetworkTransmitErrsannotations:description: '{{ $labels.instance }} interface {{ $labels.device }} has encountered {{ printf "%.0f" $value }} transmit errors in the last two minutes.'runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodenetworktransmiterrssummary: Network interface is reporting many transmit errors.expr: |rate(node_network_transmit_errs_total{job="external-node-exporter"}[2m]) / rate(node_network_transmit_packets_total{job="external-node-exporter"}[2m]) > 0.01for: 1hlabels:severity: warning- alert: NodeHighNumberConntrackEntriesUsedannotations:description: '{{ $value | humanizePercentage }} of conntrack entries are used.'runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodehighnumberconntrackentriesusedsummary: Number of conntrack are getting close to the limit.expr: |(node_nf_conntrack_entries{job="external-node-exporter"} / node_nf_conntrack_entries_limit) > 0.75labels:severity: warning- alert: NodeTextFileCollectorScrapeErrorannotations:description: Node Exporter text file collector on {{ $labels.instance }} failed to scrape.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodetextfilecollectorscrapeerrorsummary: Node Exporter text file collector failed to scrape.expr: |node_textfile_scrape_error{job="external-node-exporter"} == 1labels:severity: warning- alert: NodeClockSkewDetectedannotations:description: Clock at {{ $labels.instance }} is out of sync by more than 0.05s. Ensure NTP is configured correctly on this host.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodeclockskewdetectedsummary: Clock skew detected.expr: |(node_timex_offset_seconds{job="external-node-exporter"} > 0.05andderiv(node_timex_offset_seconds{job="external-node-exporter"}[5m]) >= 0)or(node_timex_offset_seconds{job="external-node-exporter"} < -0.05andderiv(node_timex_offset_seconds{job="external-node-exporter"}[5m]) <= 0)for: 10mlabels:severity: warning- alert: NodeRAIDDegradedannotations:description: RAID array '{{ $labels.device }}' at {{ $labels.instance }} is in degraded state due to one or more disks failures. Number of spare drives is insufficient to fix issue automatically.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/noderaiddegradedsummary: RAID Array is degraded.expr: |node_md_disks_required{job="external-node-exporter",device=~"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)"} - ignoring (state) (node_md_disks{state="active",job="external-node-exporter",device=~"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)"}) > 0for: 15mlabels:severity: critical- alert: NodeRAIDDiskFailureannotations:description: At least one device in RAID array at {{ $labels.instance }} failed. Array '{{ $labels.device }}' needs attention and possibly a disk swap.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/noderaiddiskfailuresummary: Failed device in RAID array.expr: |node_md_disks{state="failed",job="external-node-exporter",device=~"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)"} > 0labels:severity: warning- alert: NodeFileDescriptorLimitannotations:description: File descriptors limit at {{ $labels.instance }} is currently at {{ printf "%.2f" $value }}%.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefiledescriptorlimitsummary: Kernel is predicted to exhaust file descriptors limit soon.expr: |(node_filefd_allocated{job="external-node-exporter"} * 100 / node_filefd_maximum{job="external-node-exporter"} > 70)for: 15mlabels:severity: warning- alert: NodeFileDescriptorLimitannotations:description: File descriptors limit at {{ $labels.instance }} is currently at {{ printf "%.2f" $value }}%.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodefiledescriptorlimitsummary: Kernel is predicted to exhaust file descriptors limit soon.expr: |(node_filefd_allocated{job="external-node-exporter"} * 100 / node_filefd_maximum{job="external-node-exporter"} > 90)for: 15mlabels:severity: critical- alert: NodeCPUHighUsageannotations:description: |CPU usage at {{ $labels.instance }} has been above 90% for the last 15 minutes, is currently at {{ printf "%.2f" $value }}%.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodecpuhighusagesummary: High CPU usage.expr: |sum without(mode) (avg without (cpu) (rate(node_cpu_seconds_total{job="external-node-exporter", mode!="idle"}[2m]))) * 100 > 90for: 15mlabels:severity: info- alert: NodeSystemSaturationannotations:description: |System load per core at {{ $labels.instance }} has been above 2 for the last 15 minutes, is currently at {{ printf "%.2f" $value }}.This might indicate this instance resources saturation and can cause it becoming unresponsive.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodesystemsaturationsummary: System saturated, load per core is very high.expr: |node_load1{job="external-node-exporter"}/ count without (cpu, mode) (node_cpu_seconds_total{job="external-node-exporter", mode="idle"}) > 2for: 15mlabels:severity: warning- alert: NodeMemoryMajorPagesFaultsannotations:description: |Memory major pages are occurring at very high rate at {{ $labels.instance }}, 500 major page faults per second for the last 15 minutes, is currently at {{ printf "%.2f" $value }}.Please check that there is enough memory available at this instance.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodememorymajorpagesfaultssummary: Memory major page faults are occurring at very high rate.expr: |rate(node_vmstat_pgmajfault{job="external-node-exporter"}[5m]) > 500for: 15mlabels:severity: warning- alert: NodeMemoryHighUtilizationannotations:description: |Memory is filling up at {{ $labels.instance }}, has been above 90% for the last 15 minutes, is currently at {{ printf "%.2f" $value }}%.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodememoryhighutilizationsummary: Host is running out of memory.expr: |100 - (node_memory_MemAvailable_bytes{job="external-node-exporter"} / node_memory_MemTotal_bytes{job="external-node-exporter"} * 100) > 90for: 15mlabels:severity: warning- alert: NodeDiskIOSaturationannotations:description: |Disk IO queue (aqu-sq) is high on {{ $labels.device }} at {{ $labels.instance }}, has been above 10 for the last 30 minutes, is currently at {{ printf "%.2f" $value }}.This symptom might indicate disk saturation.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodediskiosaturationsummary: Disk IO queue is high.expr: |rate(node_disk_io_time_weighted_seconds_total{job="external-node-exporter", device=~"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)"}[5m]) > 10for: 30mlabels:severity: warning- alert: NodeSystemdServiceFailedannotations:description: Systemd service {{ $labels.name }} has entered failed state at {{ $labels.instance }}runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodesystemdservicefailedsummary: Systemd service has entered failed state.expr: |node_systemd_unit_state{job="external-node-exporter", state="failed"} == 1for: 5mlabels:severity: warning- alert: NodeBondingDegradedannotations:description: Bonding interface {{ $labels.master }} on {{ $labels.instance }} is in degraded state due to one or more slave failures.runbook_url: https://runbooks.prometheus-operator.dev/runbooks/node/nodebondingdegradedsummary: Bonding interface is degradedexpr: |(node_bonding_slaves - node_bonding_active) != 0for: 5mlabels:severity: warning- name: external-external-node-exporter.rulesrules:- expr: |count without (cpu, mode) (node_cpu_seconds_total{job="external-node-exporter",mode="idle"})record: instance:node_num_cpu:sum- expr: |1 - avg without (cpu) (sum without (mode) (rate(node_cpu_seconds_total{job="external-node-exporter", mode=~"idle|iowait|steal"}[5m])))record: instance:node_cpu_utilisation:rate5m- expr: |(node_load1{job="external-node-exporter"}/instance:node_num_cpu:sum{job="external-node-exporter"})record: instance:node_load1_per_cpu:ratio- expr: |1 - ((node_memory_MemAvailable_bytes{job="external-node-exporter"}or(node_memory_Buffers_bytes{job="external-node-exporter"}+node_memory_Cached_bytes{job="external-node-exporter"}+node_memory_MemFree_bytes{job="external-node-exporter"}+node_memory_Slab_bytes{job="external-node-exporter"}))/node_memory_MemTotal_bytes{job="external-node-exporter"})record: instance:node_memory_utilisation:ratio- expr: |rate(node_vmstat_pgmajfault{job="external-node-exporter"}[5m])record: instance:node_vmstat_pgmajfault:rate5m- expr: |rate(node_disk_io_time_seconds_total{job="external-node-exporter", device=~"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)"}[5m])record: instance_device:node_disk_io_time_seconds:rate5m- expr: |rate(node_disk_io_time_weighted_seconds_total{job="external-node-exporter", device=~"(/dev/)?(mmcblk.p.+|nvme.+|rbd.+|sd.+|vd.+|xvd.+|dm-.+|md.+|dasd.+)"}[5m])record: instance_device:node_disk_io_time_weighted_seconds:rate5m- expr: |sum without (device) (rate(node_network_receive_bytes_total{job="external-node-exporter", device!="lo"}[5m]))record: instance:node_network_receive_bytes_excluding_lo:rate5m- expr: |sum without (device) (rate(node_network_transmit_bytes_total{job="external-node-exporter", device!="lo"}[5m]))record: instance:node_network_transmit_bytes_excluding_lo:rate5m- expr: |sum without (device) (rate(node_network_receive_drop_total{job="external-node-exporter", device!="lo"}[5m]))record: instance:node_network_receive_drop_excluding_lo:rate5m- expr: |sum without (device) (rate(node_network_transmit_drop_total{job="external-node-exporter", device!="lo"}[5m]))record: instance:node_network_transmit_drop_excluding_lo:rate5m

grafana
Node 模版ID1860

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/67100.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ExplaineR:集成K-means聚类算法的SHAP可解释性分析 | 可视化混淆矩阵、决策曲线、模型评估与各类SHAP图

集成K-means聚类算法的SHAP可解释性分析 加载数据集并训练机器学习模型 SHAP 分析以提取特征对预测的影响 通过混淆矩阵可视化模型性能 决策曲线分析 模型评估&#xff08;多指标和ROC曲线的目视检查&#xff09; 带注释阈值的 ROC 曲线 加载 SHAP 结果以进行下游分析 与…

【Python通过UDP协议传输视频数据】(界面识别)

提示&#xff1a;界面识别项目 前言 随着网络通信技术的发展&#xff0c;视频数据的实时传输在各种场景中得到了广泛应用。UDP&#xff08;User Datagram Protocol&#xff09;作为一种无连接的协议&#xff0c;凭借其低延迟、高效率的特性&#xff0c;在实时性要求较高的视频…

浅谈云计算03 | 云计算的技术支撑(云使能技术)

云计算的技术支撑 一、定义与内涵1.1 定义与内涵 二、云计算使能技术架构2.1 宽带网络和 Internet 架构2.2 数据中心技术2.3 虚拟化技术2.4 Web 技术2.5 多租户技术2.6 服务技术 一、定义与内涵 1.1 定义与内涵 云计算技术包含一些基础的关键技术&#xff0c;这里称为使能技术…

QGraphicsView QGraphicsScene QGraphicsItem

QGraphicsView && QGraphicsScene &#xff1a; QGraphicsView 是 Qt 中用于显示和交互处理 2D 图形的控件&#xff0c;QGraphicsView 用于显示 QGraphicsScene 中的内容。 .h #ifndef MAINWINDOW_H #define MAINWINDOW_H#include <QMainWindow> #include &…

【大数据】机器学习-----线性模型

一、线性模型基本形式 线性模型旨在通过线性组合输入特征来预测输出。其一般形式为&#xff1a; 其中&#xff1a; x ( x 1 , x 2 , ⋯ , x d ) \mathbf{x}(x_1,x_2,\cdots,x_d) x(x1​,x2​,⋯,xd​) 是输入特征向量&#xff0c;包含 d d d 个特征。 w ( w 1 , w 2 , ⋯ ,…

基于千帆(ERNIE-Functions-8K)Function Calling的简单使用

1.Function Calling是什么&#xff1f; 1.1 概念 Function calling是一种将LLM(大语言模型Large language model)连接外部工具的能力&#xff0c;LLM经过微调后&#xff0c;可以检测出何时需要调用函数以及需要调用函数的方法名及参数&#xff0c;并返回给调用方以便调用外部…

Deep Attentional Guided Image Filtering

This work achieved the first place in the real depth map SR challenge held in ACM ICMR 2021. 目的&#xff1a;从一个target image(如低分辨的深度图)和guidance image(如高分辨的RGB图)&#xff0c;得到输出(如高分辨的深度图)。 主要思想是考虑了target和guidance之间的…

SpringBoot+Lombok项目实体属性名xXxx格式,前端接收不到

问题解析 今天发现后端传给前端的实体类中&#xff0c;有属性为xXxxx格式的&#xff0c;前端也使用相同名称接收&#xff0c;结果却不显示值&#xff01;研究了一会发现接口请求回来后&#xff0c;原xXxxx的属性名&#xff0c;会被转为全小写。具体原因为&#xff1a;使用Lombo…

高级运维:shell练习2

1、需求&#xff1a;判断192.168.1.0/24网络中&#xff0c;当前在线的ip有哪些&#xff0c;并编写脚本打印出来。 vim check.sh #!/bin/bash# 定义网络前缀 network_prefix"192.168.1"# 循环遍历1-254的IP for i in {1..254}; do# 构造完整的IP地址ip"$network_…

为深度学习创建PyTorch张量 - 最佳选项

为深度学习创建PyTorch张量 - 最佳选项 正如我们所看到的&#xff0c;PyTorch张量是torch.Tensor​ PyTorch类的实例。张量的抽象概念与PyTorch张量之间的区别在于&#xff0c;PyTorch张量为我们提供了一个可以在代码中操作的具体实现。 在上一篇文章中&#xff0c;我们看到了…

28.找出字符串中第一个匹配项的下标【力扣】KMP前缀表 ≈ find() 函数、暴力解法

class Solution { public: //得到前缀表void getNext(int *next,string needle){int j0;for(int i1;i<needle.size();i){while(j>0 && needle[j]!needle[i]) jnext[j-1];//**j>0**>j0是出口if(needle[i]needle[j]) j;next[i]j;//若写入if中&#xff0c;则该…

mysql 创建临时表报错

1. 问题描述 5.7.31 版本 mysql 数据库创建临时表报错 -- 报错语句 CREATE TEMPORARY TABLE temp_table_name SELECT * FROM table_name LIMIT 0;报错截图 [HY000][1005] Can’t create table ‘new_tbl’ (errno: 13) 2. 解决方案 步骤一&#xff1a; 查询 linux m…

使用 WPF 和 C# 将纹理应用于三角形

此示例展示了如何将纹理应用于三角形,以使场景比覆盖纯色的场景更逼真。以下是为三角形添加纹理的基本步骤。 创建一个MeshGeometry3D对象。像往常一样定义三角形的点和法线。通过向网格的TextureCoordinates集合添加值来设置三角形的纹理坐标。创建一个使用想要显示的纹理的 …

mac homebrew配置使用

本文介绍mac上homebrew工具的安装、配置过程。homebrew功能类似于centos的yum&#xff0c;用于软件包的管理&#xff0c;使用上有命令的差异。 本次配置过程使用mac&#xff0c;看官方文档&#xff0c;在linux上也可以用&#xff0c;但我没试过&#xff0c;有兴趣的同学可以试试…

OpenCV基础:矩阵的创建、检索与赋值

本文主要是介绍如何使用numpy进行矩阵的创建&#xff0c;以及从矩阵中读取数据&#xff0c;修改矩阵数据。 创建矩阵 import numpy as npa np.array([1,2,3]) b np.array([[1,2,3],[4,5,6]]) #print(a) #print(b)# 创建全0数组 eros矩阵 c np.zeros((8,8), np.uint8) #prin…

Unreal Engine 5 (UE5) Metahuman 的头部材质

在图中&#xff0c;你展示了 Unreal Engine 5 (UE5) Metahuman 的头部材质部分&#xff0c;列出了头部材质的多个元素。以下是对每个部分的解释&#xff1a; 材质解释 Element 0 - MI_HeadSynthesized_Baked 作用&#xff1a; 这是 Metahuman 的主要头部材质&#xff0c;控制整…

鸿蒙中自定义slider实现字体大小变化

ui&#xff1a; import { display, mediaquery, router } from kit.ArkUI import CommonConstants from ./CommonConstants; import PreferencesUtil from ./PreferencesUtil; import StyleConstants from ./StyleConstants;// 字体大小 Entry Component struct FontSize {Sta…

LabVIEW智能水肥一体灌溉控制系统

本文详细介绍了一种基于LabVIEW的智能水肥一体灌溉控制系统的设计与实现。该系统采用模糊控制策略&#xff0c;能够自动调节土壤湿度和肥液浓度&#xff0c;满足不同作物在不同生长阶段的需求&#xff0c;有效提高水肥利用效率&#xff0c;对现代精准农业具有重要的实践和推广价…

【高可用自动化体系】自动化体系

架构设计的愿景就是高可用、高性能、高扩展、高效率。为了实现架构设计四高愿景&#xff0c;需要实现自动化系统目标&#xff1a; 标准化。 流程自助化。 可视化&#xff1a;可观测系统各项指标、包括全链路跟踪。 自动化&#xff1a;ci/cd 自动化部署。 精细化&#xff1a…

Docker与虚拟机的区别及常用指令详解

在现代软件开发中&#xff0c;容器化和虚拟化技术已经成为不可或缺的工具。Docker和虚拟机&#xff08;VM&#xff09;是两种常见的技术&#xff0c; 它们都可以帮助开发者在不同的环境中运行应用程序。然而&#xff0c;它们的工作原理和使用场景有很大的不同。本文将详细探讨D…