当前位置: 首页 > news >正文

python3 阿里云api进行巡检发送邮件

python3 脚本爬取阿里云进行巡检

  • 不确定pip能不能安装上,使用时候可以百度一下,脚本是可以使用的,没有问题的

太长时间了,pip安装依赖忘记那些了,使用科大星火询问了下,给了下面的,看看能不能使用吧
根据您提供的代码,您需要安装以下Python库:

  1. HTMLTable(来自HTMLTable库)
  2. email.mime.multipart(来自email库)
  3. paramiko
  4. clickhouse-driver(来自clickhouse_driver库)
  5. smtplib
  6. string
  7. json
  8. requests
  9. time
  10. datetime
  11. prettytable(来自prettytable库)
  12. ntpath(来自ntpath库)
  13. email.header(来自email库)
  14. aliyunsdkcore(来自aliyunsdkcore库)
  15. email.mime.text(来自email库)
  16. aliyunsdkcore.request(来自aliyunsdkcore库)
  17. aliyunsdkecs.request.v20140526(来自aliyunsdkecs库)
  18. aliyunsdkcore.acs_exception.exceptions(来自aliyunsdkcore库)
  19. aliyunsdkcms.request.v20190101(来自aliyunsdkcms库)
  20. aliyunsdkr_kvstore.request.v20150101(来自aliyunsdkr_kvstore库)
  21. aliyunsdkdts.request.v20200101(来自aliyunsdkdts库)
  22. aliyunsdkr_kvstore.request.v20150101(来自aliyunsdkr_kvstore库)

不确定pip能不能安装上,使用时候可以百度一下,脚本是可以使用的,没有问题的

pip install HTMLTable
pip install email
pip install paramiko
pip install clickhouse-driver
pip install smtplib
pip install string
pip install json
pip install requests
pip install time
pip install datetime
pip install prettytable
pip install ntpath
pip install email.header
pip install aliyunsdkcore
pip install email.mime.text
pip install aliyunsdkcore.request
pip install aliyunsdkecs.request.v20140526
pip install aliyunsdkcore.acs_exception.exceptions
pip install aliyunsdkcms.request.v20190101
pip install aliyunsdkr_kvstore.request.v20150101
pip install aliyunsdkdts.request.v20200101
pip install aliyunsdkr_kvstore.request.v20150101
#!/usr/bin/
env python
# -*- coding: utf-8 -*-
from HTMLTable import (HTMLTable,)
from email.mime.multipart import MIMEMultipartimport paramiko
from clickhouse_driver import Client, connect
import smtplib
import string
import json
import requests
import time
import datetime
import prettytable as pt
from ntpath import join
from email.header import Header
from aliyunsdkcore import client
from email.mime.text import MIMEText
from aliyunsdkcore.request import CommonRequest
from aliyunsdkecs.request.v20140526 import DescribeInstancesRequest
from aliyunsdkcore.acs_exception.exceptions import ClientException
from aliyunsdkcore.acs_exception.exceptions import ServerException
from aliyunsdkcms.request.v20190101.DescribeMetricTopRequest import DescribeMetricTopRequest
from aliyunsdkr_kvstore.request.v20150101.DescribeInstancesRequest import \DescribeInstancesRequest as DescribeInstancesRequest2
from aliyunsdkdts.request.v20200101.DescribeDtsJobsRequest import DescribeDtsJobsRequest
from aliyunsdkr_kvstore.request.v20150101.DescribeInstanceAttributeRequest import DescribeInstanceAttributeRequest# 阿里云认证
clt = client.AcsClient('TT','BB', 'cn-chengdu')# 脚本所需参数
# 设置页数
page_number = '1'
# 设置每页返回多少,默认为10条
strip_number = '100'
# ECS到期时间范围单位是‘天’
expire_days = '7'
# 云服务的数据命名空间(磁盘使用率那进行调用)
ecs_namespace = 'acs_ecs_dashboard'
# 云服务(ECS)的监控项名称
Disk_metricname = 'vm.DiskUtilization'  # 磁盘
Mem_metricname = 'vm.MemoryUtilization'  # 内存
CPU_metricname = 'cpu_total'  # CPU
# 磁盘使用率阀值(%)
Disk_use_rate = '70'
# 内存使用率阀值(%)
Mem_user_rate = '70'
# CPU使用率阀值(%)
Cpu_user_rate = '70'
str_time = "%s-%s-%s" % (datetime.datetime.now().year,datetime.datetime.now().month, datetime.datetime.now().day)
time_mail = time.strftime('%Y%m%d%H%M%S ', time.localtime(time.time()))
# 发送邮件相关信息
sender = 'aaaaaaa@163.com'# 收件人邮箱
receiver = 'bbbbb@163.com','ccccc@163.com'
# receiver = 'wangzq@icbf.com.cn','yangyang@icbf.com.cn'subject = '%s运维巡检表' % (str_time)
# 邮箱账户命密码
username = 'aaaaaaa@163.com'
password = 'aaaaaaaa''''
阿里云采样范围太大就会提示(是因为每个月阿里云api是有固定免费额度的)
{"status":"error","errorType":"execution",
"error":"query processing would load too many samples into memory in query execution"}
'''# 生成表格
def form(column_name, field_information, title):table = HTMLTable(caption='')table.append_header_rows(((column_name),))for field in field_information:table.append_data_rows(((field),))# 表格样式,即<table>标签样式table.set_style({'border-collapse': 'collapse','word-break': 'keep-all','white-space': 'nowrap','font-size': '14px','margin-left': '30px','text-align': 'center',})# 统一设置所有单元格样式,<td>或<th>table.set_cell_style({'border-color': '#000','border-width': '1px','border-style': 'solid','padding': '5px',})# 表头样式table.set_header_row_style({'color': '#fff','background-color': '#48a6fb','font-size': '18px',})# 覆盖表头单元格字体样式table.set_header_cell_style({'padding': '15px',})html = table.to_html()html = '<h3 style="color:red;margin-left: 30px" > %s </h3>' % (title) + htmlreturn html# 把巡检信息进行html格式化
def html_formatting( Aliyun_html):html_text = """
<!DOCTYPE html>
<html lang="en">
<head><title></title><meta charset="utf-8">
</head>
<body><div class="page" style="margin-left: 20px"><h1> {time_mail} 巡检结果如下 </h1><h2 style="color:blue;margin-left: 15px"> 阿里云 </h2>{Aliyun_html}</div></div>
</body>
</html>
""".format(time_mail=str_time,Aliyun_html=Aliyun_html,)msge = html_textreturn msge# 列表---ECS列表
def get_sys_info():request = DescribeInstancesRequest.DescribeInstancesRequest()# request.set_PageNumber('page_number')   #设置页数request.set_PageSize(strip_number)  # 设置每页返回多少,默认为10条request.set_accept_format('json')response = json.loads(clt.do_action(request)).get('Instances').get('Instance')return response# ECS 5天内到期时间
def ecs_five_endtime():field_information = []count = 0for i in get_sys_info():# 阿里云UTC时间转换成北京时间ecs_endtime_0 = i['ExpiredTime']ecs_endtime_1 = "%Y-%m-%dT%H:%MZ"ecs_endtime_2 = datetime.datetime.strptime(ecs_endtime_0, ecs_endtime_1)ecs_endtime_3 = ecs_endtime_2 + \datetime.timedelta(hours=8) - datetime.timedelta(seconds=1)ecs_endtime_4 = ecs_endtime_3.strftime('%Y-%m-%d')# 计算到期时间与现在时间之差current_time = time.strftime("%Y-%m-%d", time.localtime())current = time.mktime(time.strptime(current_time, '%Y-%m-%d'))ecs_endtime_5 = time.mktime(time.strptime(ecs_endtime_4, '%Y-%m-%d'))count_days = int((ecs_endtime_5 - current) / (24 * 60 * 60))# 距离到期时间小于天数if count_days <= int(expire_days):count = count + 1ecs_remarks = i['InstanceId'], i['InstanceName']ecs_IP_0 = i['VpcAttributes']ecs_IP_1 = ecs_IP_0["PrivateIpAddress"]["IpAddress"][0]field = count, list(ecs_remarks)[0], ecs_IP_1, ecs_endtime_3.strftime('%Y年%m月%d日 %H:%M'), list(ecs_remarks)[1]#    print(field)field_information.append(field)title = 'ECS到期时间(%s天内)' % (expire_days)column_name = ["序号", "实例ID", "IP地址", "到期时间", "备注"]html_table = form(column_name=column_name, title=title,field_information=field_information)return html_table# ECS磁盘使用率
def disk_info():request = DescribeMetricTopRequest()request.set_accept_format('json')request.set_Namespace(ecs_namespace)request.set_MetricName(Disk_metricname)request.set_Orderby("Average")request.set_Length(strip_number)response_0 = clt.do_action_with_exception(request)response_1 = str(response_0, encoding='utf-8')return response_1# 列出超出磁盘阈值的ECS信息
def get_disk_Value():field_information = []count = 0Slicing_0 = eval(str(disk_info()))Slicing_1 = Slicing_0["Datapoints"]Slicing_2 = eval(Slicing_1)for Slicing_3 in Slicing_2:if Slicing_3.get("Average") >= float(Disk_use_rate):for ecs_id_0 in get_sys_info():if Slicing_3.get("instanceId") == ecs_id_0['InstanceId']:count += 1ecs_remarks = ecs_id_0['InstanceId'], ecs_id_0['InstanceName']ecs_IP_0 = ecs_id_0['VpcAttributes']ecs_IP_1 = ecs_IP_0["PrivateIpAddress"]["IpAddress"][0]field = count, Slicing_3.get("instanceId"), ecs_IP_1, Slicing_3.get("mountpoint"), Slicing_3.get("Maximum"), list(ecs_remarks)[1]field_information.append(field)title = 'ECS磁盘使用率大于%s' % (Disk_use_rate)column_name = ["序号", "实例ID", "IP地址", "目录", "使用率(%)", "备注"]html_table = form(column_name=column_name, title=title,field_information=field_information)return html_table# ECS-CPU使用率
def CPU_info():request = DescribeMetricTopRequest()request.set_accept_format('json')request.set_Namespace(ecs_namespace)request.set_MetricName(CPU_metricname)request.set_Orderby("Average")request.set_Length(strip_number)response_0 = clt.do_action_with_exception(request)response_1 = str(response_0, encoding='utf-8')return response_1# 列出超出CPU阈值的ECS信息
def get_CPU_Value():count = 0field_information = []Slicing_0 = eval(str(CPU_info()))Slicing_1 = Slicing_0["Datapoints"]Slicing_2 = eval(Slicing_1)for Slicing_3 in Slicing_2:if Slicing_3.get("Average") >= float(Cpu_user_rate):for ecs_id_0 in get_sys_info():if Slicing_3.get("instanceId") == ecs_id_0['InstanceId']:ecs_remarks = ecs_id_0['InstanceId'], ecs_id_0['InstanceName']ecs_IP_0 = ecs_id_0['VpcAttributes']ecs_IP_1 = ecs_IP_0["PrivateIpAddress"]["IpAddress"][0]count += 1field = count, Slicing_3.get("instanceId"), ecs_IP_1, Slicing_3.get("Maximum"), list(ecs_remarks)[1]field_information.append(field)title = 'ECS-CPU使用率大于%s' % (Cpu_user_rate)column_name = ["序号", "实例ID", "IP地址", "使用率(%)", "备注"]html_table = form(column_name=column_name, title=title,field_information=field_information)return html_table# ECS内存使用率
def Member_info():request = DescribeMetricTopRequest()request.set_accept_format('json')request.set_Namespace(ecs_namespace)request.set_MetricName(Mem_metricname)request.set_Orderby("Average")request.set_Length(strip_number)response_0 = clt.do_action_with_exception(request)response_1 = str(response_0, encoding='utf-8')return response_1# 列出超出内存阈值的ECS信息
def get_Member_Value():count = 0field_information = []Slicing_0 = eval(str(Member_info()))Slicing_1 = Slicing_0["Datapoints"]Slicing_2 = eval(Slicing_1)for Slicing_3 in Slicing_2:if Slicing_3.get("Average") >= float(Mem_user_rate):for ecs_id_0 in get_sys_info():if Slicing_3.get("instanceId") == ecs_id_0['InstanceId']:ecs_remarks = ecs_id_0['InstanceId'], ecs_id_0['InstanceName']ecs_IP_0 = ecs_id_0['VpcAttributes']ecs_IP_1 = ecs_IP_0["PrivateIpAddress"]["IpAddress"][0]count += 1field = count, Slicing_3.get("instanceId"), ecs_IP_1, Slicing_3.get("Maximum"), list(ecs_remarks)[1]field_information.append(field)title = 'ECS内存使用率大于%s' % (Mem_user_rate)column_name = ["序号", "实例ID", "IP地址", "使用率(%)", "备注"]html_table = form(column_name=column_name, title=title,field_information=field_information)return html_table# 列表---RDS实例列表
def get_rds_info():request = CommonRequest()request.set_accept_format('json')request.set_domain('rds.aliyuncs.com')request.set_method('POST')request.set_protocol_type('https')  # https | httprequest.set_version('2014-08-15')request.set_action_name('DescribeDBInstances')request.add_query_param('RegionId', "cn-beijing")request.add_query_param('PageSize', strip_number)  # 条数# request.add_query_param('PageNumber', page_number) ###页码response = clt.do_action(request)false = 0rds_list_0 = eval(str(response, encoding='utf-8'))rds_list_1 = rds_list_0["Items"]["DBInstance"]return rds_list_1# 列出RDS到期时间
def rds_endtime():field_information = []count = 0for i in get_rds_info():# 阿里云UTC时间转换成北京时间rds_endtime_0 = i['ExpireTime']rds_endtime_1 = "%Y-%m-%dT%H:%M:%SZ"rds_endtime_2 = datetime.datetime.strptime(rds_endtime_0, rds_endtime_1)rds_endtime_3 = rds_endtime_2 + \datetime.timedelta(hours=8) - datetime.timedelta(seconds=1)rds_endtime_4 = rds_endtime_3.strftime('%Y-%m-%d')# 计算到期时间与现在时间之差current_time = time.strftime("%Y-%m-%d", time.localtime())current = time.mktime(time.strptime(current_time, '%Y-%m-%d'))rds_endtime_5 = time.mktime(time.strptime(rds_endtime_4, '%Y-%m-%d'))count_days = int((rds_endtime_5 - current) / (24 * 60 * 60))# 距离到期时间小于天数if count_days <= int(expire_days):count = count + 1field = count, i["DBInstanceId"], rds_endtime_3.strftime('%Y年%m月%d日 %H:%M'), i["DBInstanceDescription"]field_information.append(field)title = 'RDS到期时间(%s天内)' % (expire_days)column_name = ["序号", "实例ID", "到期时间", "备注"]html_table = form(column_name=column_name, title=title,field_information=field_information)return html_table# 列出RDS磁盘使用率
def rds_disk_info():request = DescribeMetricTopRequest()request.set_accept_format('json')request.set_MetricName("DiskUsage")request.set_Namespace("acs_rds_dashboard")request.set_Orderby("Average")request.set_Length(strip_number)response_0 = clt.do_action_with_exception(request)response_1 = str(response_0, encoding='utf-8')return response_1# 列出RDS超出阀值的资源
def rds_disk_threshold():count = 0field_information = []rds_threshold_0 = eval(rds_disk_info())rds_threshold_1 = eval(rds_threshold_0["Datapoints"])for rds_threshold_3 in rds_threshold_1:if rds_threshold_3["Average"] >= float(Disk_use_rate):for rds_id_0 in get_rds_info():if rds_id_0["DBInstanceId"] == 'rm-2ze3bzdt0ej4za0t6':breakif rds_threshold_3["instanceId"] == rds_id_0["DBInstanceId"]:count += 1field = count, rds_threshold_3["instanceId"], rds_id_0["DBInstanceDescription"], rds_threshold_3["Average"]field_information.append(field)title = 'RDS-磁盘使用率大于70%'column_name = ["序号", "实例ID", "备注", "使用率(%)"]html_table = form(column_name=column_name, title=title,field_information=field_information)return html_table# 列出redis实例列表
def get_redis_info():request = DescribeInstancesRequest2()request.set_accept_format('json')request.set_PageNumber(page_number)  # 页码request.set_PageSize(strip_number)  # 条数response_0 = clt.do_action_with_exception(request)false = true = 0response_1 = eval(str(response_0, encoding='utf-8'))response_2 = response_1["Instances"]["KVStoreInstance"]return response_2# Redis到期时间
def redis_endtime():field_information = []count = 0for i in get_redis_info():# 阿里云UTC时间转换成北京时间# if i.get('UserName') == 'r-2vcik2bo8gzn07yri9':redis_endtime_0 = i['EndTime']redis_endtime_1 = "%Y-%m-%dT%H:%M:%SZ"redis_endtime_2 = datetime.datetime.strptime(redis_endtime_0, redis_endtime_1)redis_endtime_3 = redis_endtime_2 + datetime.timedelta(hours=8)redis_endtime_4 = redis_endtime_3.strftime('%Y-%m-%d')# 计算到期时间与现在时间之差current_time = time.strftime("%Y-%m-%d", time.localtime())current = time.mktime(time.strptime(current_time, '%Y-%m-%d'))redis_endtime_5 = time.mktime(time.strptime(redis_endtime_4, '%Y-%m-%d'))count_days = int((redis_endtime_5 - current) / (24 * 60 * 60))# 距离到期时间小于天数if count_days <= int(expire_days):count = count + 1field = [count, i["InstanceId"], redis_endtime_3.strftime('%Y年%m月%d日 %H:%M'), i["InstanceName"]]field_information.append(field)title = 'Redis到期时间(%s天内)' %(expire_days)column_name = ["序号", "实例ID", "到期时间", "备注"]html_table = form(column_name=column_name, title=title,field_information=field_information)return html_table# 邮件
def send_mail(email_html):msg = MIMEMultipart()msg['Subject'] = Header(subject, 'utf-8')msg['From'] = Header('patrol-alarm@icbf.com.cn', 'utf-8')  # 发送者msg['To'] = Header('运维组', 'utf-8')msg.attach(MIMEText(email_html, 'html', 'utf-8'))smtp = smtplib.SMTP()smtp.connect('smtp.qiye.aliyun.com')smtp.login(username, password)for mailuser in receiver:smtp.sendmail(sender, mailuser, msg.as_string())print("邮件发送成功")smtp.quit()# 执行
if __name__ == '__main__':# 到期时间 ETC_endtime() + redis_endtime() + rds_endtime() + ecs_five_endtime()# 磁盘阀值类: rds_disk_threshold() + get_disk_Value()# CPU&内存类:get_CPU_Value() + get_Member_Value()# print(redis_endtime())html = html_formatting(Aliyun_html=get_disk_Value() +rds_disk_threshold() +rds_endtime() +ecs_five_endtime() +get_CPU_Value() +get_Member_Value() +redis_endtime())send_mail(email_html=html)

效果展示
在这里插入图片描述

相关文章:

python3 阿里云api进行巡检发送邮件

python3 脚本爬取阿里云进行巡检 不确定pip能不能安装上&#xff0c;使用时候可以百度一下&#xff0c;脚本是可以使用的&#xff0c;没有问题的 太长时间了&#xff0c;pip安装依赖忘记那些了&#xff0c;使用科大星火询问了下&#xff0c;给了下面的&#xff0c;看看能不能使…...

【Linux】安装使用Nginx负载均衡,并且部署前端项目

目录 一、Nginx概述 1. 什么 2. 背景 3. 作用 二、Nginx负载均衡 1. 讲述 2. 使用 1. 下载 2. 安装 3. 负载均衡 三、前端部署 1. 准备 2. 部署 一、Nginx概述 1. 什么 Nginx是一个高性能的开源Web服务器和反向代理服务器。它具有轻量级、高并发、低内存消耗的…...

k8s中 pod 或节点的资源利用率监控

pod 或节点的资源利用率监控 1 简介2 Kubectl Top介绍3 生效kubectl top命令3.1 下载配置components.yaml3.2 修改配置components.yaml参数3 kubectl top 应用3.1 查看node节点的资源占⽤率3.2 查看pod的资源占⽤率1 简介 通过Kubectl Top命令,可以查看你k8snode节点或者pod的…...

订水商城实战教程07-搜索

目录 1 创建数据源2 首页搜索功能3 创建搜索页面4 搭建搜索结果页面总结 上一篇我们讲解了店铺信息的展示功能&#xff0c;本篇讲解一下搜索功能。通常小程序在首页都配置了搜索的功能&#xff0c;输入关键词进行检索&#xff0c;可以在结果页上进行选购。同时还记录了用户的搜…...

stm32内 misc stm32f10x_hd stm32f10x_it stm32f10x_conf关系

STM32启动流程 初始位置 startup_stm32f10x_hd.s 查看源码 ;******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** ;* File Name : startup_stm32f10x_hd.s ;* Author : MCD Application Team ;* Version :…...

树结构及其算法-二叉查找树

目录 树结构及其算法-二叉查找树 C代码 树结构及其算法-二叉查找树 二叉树在建立的过程中是根据“左子树 < 树根 < 右子树”的原则建立的&#xff0c;因此只需从树根出发比较键值即可&#xff0c;如果比树根大就往右&#xff0c;否则往左而下&#xff0c;直到相等就找…...

PHP自定义文件缓存实现

文件缓存&#xff1a;可以将PHP脚本的执行结果缓存到文件中。当一个PHP脚本被请求时&#xff0c;先查看是否存在缓存文件&#xff0c;如果存在且未过期&#xff0c;则直接读取缓存文件内容返回给客户端&#xff0c;而无需执行脚本 1、文件缓存写法一&#xff0c;每个文件缓存一…...

猫耳 Android 播放框架开发实践

概述 猫耳FM是中国最大的 95 后声音内容分享平台&#xff0c;是B站重要平台之一&#xff0c;深度合作国内顶级声优工作室&#xff0c;打造了数百部精品广播剧&#xff0c;全站播放总量超过百亿次。 MEPlayer 是猫耳 Android 技术团队研发的一款适用于音视频、直播、特效播放等…...

linux下df -h 命令一直卡住的解决方法

在Linux中&#xff0c;偶尔遇到用 df -h 查看磁盘情况时&#xff0c;一直卡住无法显示结果。 解决方法&#xff1a; 1、首先使用strace追踪到底执行到哪里卡住 $ strace df -h 2、如果没有strace命令则进行安装 $ yum install strace -y 3、显示出卡住的地方&#xff0c;如…...

系统架构设计热点知识

系统架构设计师考点包括以下内容&#xff1a; 1. 系统设计和架构思想. 了解系统设计和架构的基本概念和思想&#xff0c;特别是面向服务架构&#xff08;SOA&#xff09;、微服务架构、云架构、事件驱动架构、响应式架构等。 系统设计是指在软件项目中&#xff0c;确定系统结…...

2023-在mac下安装Homebrew的国内镜像

mac安装Homebrew的国内镜像 尝试使用其他下载源&#xff1a;GitHub 可能会受到访问限制&#xff0c;尝试使用其他镜像或下载源。您可以使用清华大学、中科大或阿里云的 Homebrew 镜像&#xff0c;以提高下载速度和可靠性。例如&#xff0c;可以使用阿里云的镜像来安装 Homebre…...

Ubuntu 20.04设置虚拟内存 (交换内存swap)解决内存不足

数据库服务器程序在运行起来之后&#xff0c;系统内存不足。 在系统监控中发现&#xff0c;当数据库服务程序启动后&#xff0c;占用了大量内存空间&#xff0c;导致系统的剩余的内存往往只有几十MB。 在ubuntu系统中&#xff0c;swap空间就是虚拟内存&#xff0c;所以考虑在磁…...

RabbitMQ-死信交换机和死信队列

1. 简介 1.1 DLX简介 DLX: Dead-Letter-Exchange 死信交换器&#xff0c;死信邮箱 当消息成为Dead message后&#xff0c;可以被重新发送到另一个交换机&#xff0c;这个交换机就是DLX。 如下图所示&#xff1a; 其实死信队列就是一个普通的交换机&#xff0c;有些队列的消息…...

[HNCTF 2022 WEEK2]easy_include 文件包含遇上nginx

这道纯粹记录 完全没想到 <?php //WEB手要懂得搜索if(isset($_GET[file])){$file $_GET[file];if(preg_match("/php|flag|data|\~|\!|\|\#|\\$|\%|\^|\&|\*|\(|\)|\-|\_|\|\/i", $file)){die("error");}include($file); }else{highlight_file(__…...

python中transform和apply的区别是什么

文章目录 1. 介绍transform&#xff1a;apply&#xff1a; 2. 应用示例示例数据使用transform进行向量化操作使用apply进行更复杂的操作性能比较 3. 示例输出使用 transform 进行向量化操作使用 apply 进行更复杂的操作 4. transform再举例示例数据使用transform计算平均销售额…...

TCP 协议

文章目录 协议格式1面向连接:1.1三次握手&#xff08;建立连接&#xff09;1.2包序管理1.2四次挥手&#xff08;断开连接&#xff09; 2可靠传输:一。保证数据可靠有序的到达对端:确认应答机制超时重传机制 二。提高传输效率:1.提升自身发送数据量滑动窗口机制 rwnd滑动窗口丢包…...

Azure机器学习 - 在 Azure 机器学习中上传、访问和浏览数据

目录 一、环境准备二、设置内核三、下载使用的数据四、创建工作区的句柄五、将数据上传到云存储空间六、访问笔记本中的数据七、创建新版本的数据资产八、清理资源 机器学习项目的开始阶段通常涉及到探索性数据分析 (EDA)、数据预处理&#xff08;清理、特征工程&#xff09;以…...

新建包含cuda和cudnn的docker

背景&#xff1a;服务器的cudnn版本太低了&#xff0c;没有权限去修改。故新建包含cuda和cudnn的docker 步骤 一、拉取镜像及创建docker 拉取相关的镜像 从镜像列表选出相关版本的镜像https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/supported-tags.md …...

Opensips安装配置(以下操作均已centOS 6.3系统为准)

1. 安装依赖软件&#xff1a; a) Yum update //更新系统到最新 b) 安装以下所需依赖软件 gcc bison flex make openssl libmysqlclient-dev mysql-server c) 安装radiusclient&#xff1a; 1. wget http://pkgs.repoforge.org/radiuscli…...

第03章 用户与权限管理

第03章 用户与权限管理 1. 用户管理 1.1 登录MySQL服务器 启动MySQL服务后&#xff0c;可以通过mysql命令来登录MySQL服务器&#xff0c;命令如下&#xff1a; mysql –h hostname|hostIP –P port –u username –p DatabaseName –e "SQL语句"-h参数后面接主机…...

【kafka】Golang实现分布式Masscan任务调度系统

要求&#xff1a; 输出两个程序&#xff0c;一个命令行程序&#xff08;命令行参数用flag&#xff09;和一个服务端程序。 命令行程序支持通过命令行参数配置下发IP或IP段、端口、扫描带宽&#xff0c;然后将消息推送到kafka里面。 服务端程序&#xff1a; 从kafka消费者接收…...

基于FPGA的PID算法学习———实现PID比例控制算法

基于FPGA的PID算法学习 前言一、PID算法分析二、PID仿真分析1. PID代码2.PI代码3.P代码4.顶层5.测试文件6.仿真波形 总结 前言 学习内容&#xff1a;参考网站&#xff1a; PID算法控制 PID即&#xff1a;Proportional&#xff08;比例&#xff09;、Integral&#xff08;积分&…...

Java-41 深入浅出 Spring - 声明式事务的支持 事务配置 XML模式 XML+注解模式

点一下关注吧&#xff01;&#xff01;&#xff01;非常感谢&#xff01;&#xff01;持续更新&#xff01;&#xff01;&#xff01; &#x1f680; AI篇持续更新中&#xff01;&#xff08;长期更新&#xff09; 目前2025年06月05日更新到&#xff1a; AI炼丹日志-28 - Aud…...

2025盘古石杯决赛【手机取证】

前言 第三届盘古石杯国际电子数据取证大赛决赛 最后一题没有解出来&#xff0c;实在找不到&#xff0c;希望有大佬教一下我。 还有就会议时间&#xff0c;我感觉不是图片时间&#xff0c;因为在电脑看到是其他时间用老会议系统开的会。 手机取证 1、分析鸿蒙手机检材&#x…...

【Zephyr 系列 10】实战项目:打造一个蓝牙传感器终端 + 网关系统(完整架构与全栈实现)

🧠关键词:Zephyr、BLE、终端、网关、广播、连接、传感器、数据采集、低功耗、系统集成 📌目标读者:希望基于 Zephyr 构建 BLE 系统架构、实现终端与网关协作、具备产品交付能力的开发者 📊篇幅字数:约 5200 字 ✨ 项目总览 在物联网实际项目中,**“终端 + 网关”**是…...

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的“no matching...“系列算法协商失败问题

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的"no matching..."系列算法协商失败问题 摘要&#xff1a; 近期&#xff0c;在使用较新版本的OpenSSH客户端连接老旧SSH服务器时&#xff0c;会遇到 "no matching key exchange method found"​, "n…...

CSS | transition 和 transform的用处和区别

省流总结&#xff1a; transform用于变换/变形&#xff0c;transition是动画控制器 transform 用来对元素进行变形&#xff0c;常见的操作如下&#xff0c;它是立即生效的样式变形属性。 旋转 rotate(角度deg)、平移 translateX(像素px)、缩放 scale(倍数)、倾斜 skewX(角度…...

热烈祝贺埃文科技正式加入可信数据空间发展联盟

2025年4月29日&#xff0c;在福州举办的第八届数字中国建设峰会“可信数据空间分论坛”上&#xff0c;可信数据空间发展联盟正式宣告成立。国家数据局党组书记、局长刘烈宏出席并致辞&#xff0c;强调该联盟是推进全国一体化数据市场建设的关键抓手。 郑州埃文科技有限公司&am…...

起重机起升机构的安全装置有哪些?

起重机起升机构的安全装置是保障吊装作业安全的关键部件&#xff0c;主要用于防止超载、失控、断绳等危险情况。以下是常见的安全装置及其功能和原理&#xff1a; 一、超载保护装置&#xff08;核心安全装置&#xff09; 1. 起重量限制器 功能&#xff1a;实时监测起升载荷&a…...

Java中HashMap底层原理深度解析:从数据结构到红黑树优化

一、HashMap概述与核心特性 HashMap作为Java集合框架中最常用的数据结构之一&#xff0c;是基于哈希表的Map接口非同步实现。它允许使用null键和null值&#xff08;但只能有一个null键&#xff09;&#xff0c;并且不保证映射顺序的恒久不变。与Hashtable相比&#xff0c;Hash…...