使用iKuai的Docker 安装Uptime 监控网络状况并设置通知提醒 Uptime Kuma 简介 我爱开源 Uptime Kuma 是一个开源项目,它的项目地址是在这里https://github.com/louislam 开发者是以为香港Coder, 该项目已经有了43.4k star. 大家再给他多一些星星吧! 缘由 有时候有些服务器因为某些原因离线了,忘记检查了。 然后造成服务器无法正常服务。于是就有了想法在iKuai的 Docker 中安装Uptime 来监控服务器和网络设备的在线状态 先决条件 路由器要有空闲磁盘来存储Docker数据, 不然无法正常安装Docker插件 iKuai 版本要在3.5以上 在iKuai云平台绑定设备,并安装好Docker插件 安装步骤 在路由器的USB口插入一张USB磁盘并在"系统设置" - " 磁盘管理- 磁盘分区中" 将磁盘分区并挂载 绑定业务选择" 普通存储" 即可 在云平台的" 插件应用 " 插件市场中选择要安装docker的设备 在云平台 "插件管理" 检查插件安装状态, 显示安装成功则可以进行下一步操作 回到路由器中的"高级应用" - "插件管理" 点击蓝色的 "docker" (需要在云平台安装好docker插件成功才能看到) - " 服务设置 " 将镜像库URL 设置为微软的https://mcr.microsoft.com/ 点击确认保存 回到Docker 界面 点击 "镜像管理" 点击添加, 选择"镜像库下载" 在搜索框中输入Uptime 选择: louislam/uptime-kuma 下载, 然后等待提示下载成功下载时间取决于您的网络状况和磁盘速度 回到Docker 界面 点击 "接口管理" 添加新的接口 如下图:(可以根据您的自身需求设置,但是不可以与路由器本身的LAN地址冲突) 回到Docker 界面, 点击"容器列表" 添加新的容器如下图 添加完容器之后启动即可 容器端口映射 端口映射只要将容器的3001端口映射出去就可以使用外网地址访问了 参考: https://www.ikuai8.com/zhic/ymgn/lyym/2019-12-13-06-35-05/2021-03-08-07-27-41.html 基本使用 Uptime Kuma 自带多国语言 配置简单 使用方便 , 大大减低了运维人员的学习成本. 总的来说, uptime的基本使用分为4部分 创建管理员账号 添加需要监控的设备或者服务 创建状态页面给非运维人员查看 若有需求,可以设置通知渠道进行提醒 更高级的API功能就大家自己去研究啦 基本使用如图所示 通知提醒设置 请参考设置页面中的链接, 有具体文档, 其中本人是使用的Telegram Bot , 因为Telegram Bot 是最简单,最方便的. 最后感谢 感谢张品正同学的分享, 感谢iKuai的产品. 是因为他们我才想到把它部署到iKuai并完成我的需求.

December 29, 2023 0comments 23hotness 0likes Read all

缘由 因为11月份是快递量比较大时候,会有有很多快递单需要查询快递状态;之前是因为单量少,每一个单每一个单去baidu 直接看百度查询到的结果。这两个月由于快递单特别多,于是就打算用Python 结合快递100的API 来查询快递状态 代码 快递100 API 实时查询状态 # coding = utf-8 import hashlib import json import requests class KuaiDi100: def __init__(self): self.key = '' # TODO 客户授权key self.customer = '' # TODO 查询公司编号 self.url = 'https://poll.kuaidi100.com/poll/query.do' # 请求地址 def track(self, com, num, phone, ship_from, ship_to): """ 物流轨迹实时查询 :param com: 查询的快递公司的编码,一律用小写字母 :param num: 查询的快递单号,单号的最大长度是32个字符 :param phone: 收件人或寄件人的手机号或固话(也可以填写后四位,如果是固话,请不要上传分机号) :param ship_from: 出发地城市,省-市-区,非必填,填了有助于提升签收状态的判断的准确率,请尽量提供 :param ship_to: 目的地城市,省-市-区,非必填,填了有助于提升签收状态的判断的准确率,且到达目的地后会加大监控频率,请尽量提供 :return: requests.Response.text """ param = { 'com': com, 'num': num, 'phone': phone, 'from': ship_from, 'to': ship_to, 'resultv2': '1', # 添加此字段表示开通行政区域解析功能。0:关闭(默认),1:开通行政区域解析功能,2:开通行政解析功能并且返回出发、目的及当前城市信息 'show': '0', # 返回数据格式。0:json(默认),1:xml,2:html,3:text 'order': 'desc' # 返回结果排序方式。desc:降序(默认),asc:升序 } param_str = json.dumps(param) # 转json字符串 1. 签名加密, 用于验证身份, 按param + key + customer 的顺序进行MD5加密(注意加密后字符串要转大写), 不需要“+”号 temp_sign = param_str + self.key + self.customer md = hashlib.md5() md.update(temp_sign.encode()) sign = md.hexdigest().upper() request_data = {'customer': self.customer, 'param': param_str, 'sign': sign} return requests.post(self.url, request_data).text # 发送请求 result = KuaiDi100().track('yuantong', 'YT9693083639795', '', '广东省江门市', '广东省深圳市') print(result) 接口文档 https://api.kuaidi100.com/document/5f0ffb5ebc8da837cbd8aefc 导入快递单和填写结果 # coding = utf-8 import openpyxl from openpyxl import Workbook from kuaidi1000_function import KuaiDi100 import json import time wb = Workbook() ws = wb.active 1. 定义表头 title = ['客户名称','快递单号','快递状态','最后更新时间','快递开始时间','详情','时效/天'] ws.append(title) start_time = time.time() #读取excel表格 customer_file_path = 'F:/EXCEL/info/Customer.xlsx' customer_workbook = openpyxl.load_workbook(customer_file_path) 1. 获取工作表的Sheet customer_sheet = customer_workbook['海运SEA'] sheet = customer_sheet.title #顺丰快递需要手机号验证 air = 2699 sea = 8166 phone = '' #判断当前表格是否海运还是空运并赋值给phone if sheet == '海运SEA': phone = sea else: phone = air 1. 获取Customer.xlsx中A2:A100列的所有客户名字和B2:B100列的相对应的快递单号 customer_names =[(customer_sheet.cell(row=i, column=1).value) for i in range(2,100)] express_numbers = [(customer_sheet.cell(row=i, column=2).value) for i in range(2,100)] 1. 将快递单号使用for循环查询快递状态 ,并append 到 infomation_first中 for express_number, customer_name in zip(express_numbers,customer_names): response = KuaiDi100().track('',express_number,phone,'','') #定义获取到的数据 api_data = json.loads(response) #判断数据是否存在 if 'data' in api_data and api_data['data']: last_data = api_data['data'][-1]…

December 8, 2023 0comments 61hotness 0likes Read all

缘由 好久没给网吧维护了,最近给日本网吧维护的时候, 由于要在工作站开机启动之后执行一些初始化程序,要用到一个延迟启动程序。(程序是前辈写的,帮了很多忙。鞠躬)但是在日本语系统下无法正常运行 报错如下: 如果要解决该错误,需要在区域选项中,将程式区域改为中国即可。如此一来会产生一个新的问题, 某些程式会用区域来判断用户的location, 会导致一些软件无法正常运行。 于是我依葫芦画瓢,手搓了一个能在日本语系统下正常运行的延迟启动工具 功能和用法 简介 该延迟启动工具的本体只有一个exe执行文件和ini配置文件 执行文件会读取ini文件中的配置,然后执行相关任务 配置文件说明 配置文件包含TargetPath,FileExtensions,Timeout选项 TargetPath: 所需要执行的目录路径(绝对路径) FileExtenions: 需要执行的文件格式 Timeout: 延迟时间 毫秒为单位 用法 在给工作站开超级时,将Hiderun.exe 添加到系统启动项 根据你自身需求,在配置文件中“config.ini”填写相对应的路径和文件格式,以及时间。 日志 程序会在程序根目录生成log文件记录执行状态和报错,遇到问题可以在日志中查看明细。

December 6, 2023 0comments 32hotness 0likes Read all

Intuduction When we need to check some IP address information , do we have to open the browser, then type the googl domain and copy-paste the IP address? In this article . I'm goinG to use python with IP GUIDE to check ipaddres information .This much better before. Let's started Install Python found what version can be match your OS , download it and installl .https://www.python.org/downloads/ Install requests library website: https://pypi.org/project/requests/ $ python -m pip install requests Code #import requests library import requests #get data from ip guide response = requests.get(f'https://ip.guide/').json() #function get_ip def get_ip(): return response["ip"] #function get_location def get_location(): location_data = { "Latitude":response["location"]["latitude"], "Longitude" : response["location"]["longitude"], "City": response["location"]["city"], "Country": response["location"]["country"] } return location_data #function get_network def get_network(): network_data = { "Cidr": response["network"]["cidr"], "Host Start" : response["network"]["hosts"]["start"], "Host end" : response["network"]["hosts"]["end"] } return network_data #dictionary variable network_data = get_network() location_data = get_location() ipaddress = get_ip() 1. output information print(f"Your internet IPaddress is :{ipaddress}\n and below is this IPaddress other informations\n") 1. for loop for key,value in network_data.items(): print(f"{key}: {value}") print(" \n") for key,value in location_data.items(): print(f"{key}: {value}") print(" \n") Refrence: https://ip.guide/ https://pypi.org/project/requests/

December 2, 2023 0comments 29hotness 0likes Read all