python3 阿里云api进行巡检发送邮件
python3 脚本爬取阿里云进行巡检
- 不确定pip能不能安装上,使用时候可以百度一下,脚本是可以使用的,没有问题的
太长时间了,pip安装依赖忘记那些了,使用科大星火询问了下,给了下面的,看看能不能使用吧
根据您提供的代码,您需要安装以下Python库:
- HTMLTable(来自HTMLTable库)
- email.mime.multipart(来自email库)
- paramiko
- clickhouse-driver(来自clickhouse_driver库)
- smtplib
- string
- json
- requests
- time
- datetime
- prettytable(来自prettytable库)
- ntpath(来自ntpath库)
- email.header(来自email库)
- aliyunsdkcore(来自aliyunsdkcore库)
- email.mime.text(来自email库)
- aliyunsdkcore.request(来自aliyunsdkcore库)
- aliyunsdkecs.request.v20140526(来自aliyunsdkecs库)
- aliyunsdkcore.acs_exception.exceptions(来自aliyunsdkcore库)
- aliyunsdkcms.request.v20190101(来自aliyunsdkcms库)
- aliyunsdkr_kvstore.request.v20150101(来自aliyunsdkr_kvstore库)
- aliyunsdkdts.request.v20200101(来自aliyunsdkdts库)
- 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能不能安装上,使用时候可以百度一下,脚本是可以使用的,没有问题的 太长时间了,pip安装依赖忘记那些了,使用科大星火询问了下,给了下面的,看看能不能使…...

【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 搭建搜索结果页面总结 上一篇我们讲解了店铺信息的展示功能,本篇讲解一下搜索功能。通常小程序在首页都配置了搜索的功能,输入关键词进行检索,可以在结果页上进行选购。同时还记录了用户的搜…...
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代码 树结构及其算法-二叉查找树 二叉树在建立的过程中是根据“左子树 < 树根 < 右子树”的原则建立的,因此只需从树根出发比较键值即可,如果比树根大就往右,否则往左而下,直到相等就找…...

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

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

linux下df -h 命令一直卡住的解决方法
在Linux中,偶尔遇到用 df -h 查看磁盘情况时,一直卡住无法显示结果。 解决方法: 1、首先使用strace追踪到底执行到哪里卡住 $ strace df -h 2、如果没有strace命令则进行安装 $ yum install strace -y 3、显示出卡住的地方,如…...
系统架构设计热点知识
系统架构设计师考点包括以下内容: 1. 系统设计和架构思想. 了解系统设计和架构的基本概念和思想,特别是面向服务架构(SOA)、微服务架构、云架构、事件驱动架构、响应式架构等。 系统设计是指在软件项目中,确定系统结…...

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

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

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

[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:apply: 2. 应用示例示例数据使用transform进行向量化操作使用apply进行更复杂的操作性能比较 3. 示例输出使用 transform 进行向量化操作使用 apply 进行更复杂的操作 4. transform再举例示例数据使用transform计算平均销售额…...

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

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

新建包含cuda和cudnn的docker
背景:服务器的cudnn版本太低了,没有权限去修改。故新建包含cuda和cudnn的docker 步骤 一、拉取镜像及创建docker 拉取相关的镜像 从镜像列表选出相关版本的镜像https://gitlab.com/nvidia/container-images/cuda/blob/master/doc/supported-tags.md …...
Opensips安装配置(以下操作均已centOS 6.3系统为准)
1. 安装依赖软件: a) Yum update //更新系统到最新 b) 安装以下所需依赖软件 gcc bison flex make openssl libmysqlclient-dev mysql-server c) 安装radiusclient: 1. wget http://pkgs.repoforge.org/radiuscli…...
第03章 用户与权限管理
第03章 用户与权限管理 1. 用户管理 1.1 登录MySQL服务器 启动MySQL服务后,可以通过mysql命令来登录MySQL服务器,命令如下: mysql –h hostname|hostIP –P port –u username –p DatabaseName –e "SQL语句"-h参数后面接主机…...

未来机器人的大脑:如何用神经网络模拟器实现更智能的决策?
编辑:陈萍萍的公主一点人工一点智能 未来机器人的大脑:如何用神经网络模拟器实现更智能的决策?RWM通过双自回归机制有效解决了复合误差、部分可观测性和随机动力学等关键挑战,在不依赖领域特定归纳偏见的条件下实现了卓越的预测准…...

K8S认证|CKS题库+答案| 11. AppArmor
目录 11. AppArmor 免费获取并激活 CKA_v1.31_模拟系统 题目 开始操作: 1)、切换集群 2)、切换节点 3)、切换到 apparmor 的目录 4)、执行 apparmor 策略模块 5)、修改 pod 文件 6)、…...
Admin.Net中的消息通信SignalR解释
定义集线器接口 IOnlineUserHub public interface IOnlineUserHub {/// 在线用户列表Task OnlineUserList(OnlineUserList context);/// 强制下线Task ForceOffline(object context);/// 发布站内消息Task PublicNotice(SysNotice context);/// 接收消息Task ReceiveMessage(…...

.Net框架,除了EF还有很多很多......
文章目录 1. 引言2. Dapper2.1 概述与设计原理2.2 核心功能与代码示例基本查询多映射查询存储过程调用 2.3 性能优化原理2.4 适用场景 3. NHibernate3.1 概述与架构设计3.2 映射配置示例Fluent映射XML映射 3.3 查询示例HQL查询Criteria APILINQ提供程序 3.4 高级特性3.5 适用场…...

【快手拥抱开源】通过快手团队开源的 KwaiCoder-AutoThink-preview 解锁大语言模型的潜力
引言: 在人工智能快速发展的浪潮中,快手Kwaipilot团队推出的 KwaiCoder-AutoThink-preview 具有里程碑意义——这是首个公开的AutoThink大语言模型(LLM)。该模型代表着该领域的重大突破,通过独特方式融合思考与非思考…...

基于Docker Compose部署Java微服务项目
一. 创建根项目 根项目(父项目)主要用于依赖管理 一些需要注意的点: 打包方式需要为 pom<modules>里需要注册子模块不要引入maven的打包插件,否则打包时会出问题 <?xml version"1.0" encoding"UTF-8…...
Angular微前端架构:Module Federation + ngx-build-plus (Webpack)
以下是一个完整的 Angular 微前端示例,其中使用的是 Module Federation 和 npx-build-plus 实现了主应用(Shell)与子应用(Remote)的集成。 🛠️ 项目结构 angular-mf/ ├── shell-app/ # 主应用&…...
重启Eureka集群中的节点,对已经注册的服务有什么影响
先看答案,如果正确地操作,重启Eureka集群中的节点,对已经注册的服务影响非常小,甚至可以做到无感知。 但如果操作不当,可能会引发短暂的服务发现问题。 下面我们从Eureka的核心工作原理来详细分析这个问题。 Eureka的…...

HashMap中的put方法执行流程(流程图)
1 put操作整体流程 HashMap 的 put 操作是其最核心的功能之一。在 JDK 1.8 及以后版本中,其主要逻辑封装在 putVal 这个内部方法中。整个过程大致如下: 初始判断与哈希计算: 首先,putVal 方法会检查当前的 table(也就…...

深入浅出深度学习基础:从感知机到全连接神经网络的核心原理与应用
文章目录 前言一、感知机 (Perceptron)1.1 基础介绍1.1.1 感知机是什么?1.1.2 感知机的工作原理 1.2 感知机的简单应用:基本逻辑门1.2.1 逻辑与 (Logic AND)1.2.2 逻辑或 (Logic OR)1.2.3 逻辑与非 (Logic NAND) 1.3 感知机的实现1.3.1 简单实现 (基于阈…...