首页 文章 精选 留言 我的

精选列表

搜索[TDSQL PostgreSQL 版],共10000篇文章
优秀的个人博客,低调大师

go-carbon 1.4.5版本发布,修复已知 bug 和优化功能

carbon 是一个轻量级、语义化、对开发者友好的Golang时间处理库,支持链式调用、农历和gorm、xorm等主流orm 如果您觉得不错,请给个 star 吧 github:github.com/golang-module/carbon gitee:gitee.com/go-package/carbon 更新日志 修复IsFebruary()备注信息错误的bug 修复WeekOfMonth()计算错误的bug 修复文档中单词拼写错误 部分源码中增加英文备注 ToRfc1123ZString()方法改名为ToRfc1123zString()

优秀的个人博客,低调大师

k8s监控体系搭建prometheus+grafana+alertmanager无坑版

2 --> 提前准备 1.已经安装了k8s集群 2.已经安装了storgeclass(可以参考k8s存储管理 https://blog.51cto.com/luoguoling/2966225) 一.安装prometheus 1.0 提前设置namespace apiVersion: v1 kind: Namespace metadata: name: ops 1.1 prometheus配置文件 prometheus-configmap.yaml apiVersion: v1 kind: ConfigMap metadata: name: prometheus-config namespace: ops data: prometheus.yml: | rule_files: - /etc/config/rules/*.rules scrape_configs: - job_name: prometheus static_configs: - targets: - localhost:9090 - job_name: kubernetes-apiservers kubernetes_sd_configs: - role: endpoints relabel_configs: - action: keep regex: default;kubernetes;https source_labels: - __meta_kubernetes_namespace - __meta_kubernetes_service_name - __meta_kubernetes_endpoint_port_name scheme: https tls_config: ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt insecure_skip_verify: true bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: kubernetes-nodes-kubelet kubernetes_sd_configs: - role: node # 发现集群中的节点 relabel_configs: # 将标签(.*)作为新标签名,原有值不变 - action: labelmap regex: __meta_kubernetes_node_label_(.+) scheme: https tls_config: ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt insecure_skip_verify: true bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: kubernetes-nodes-cadvisor kubernetes_sd_configs: - role: node relabel_configs: # 将标签(.*)作为新标签名,原有值不变 - action: labelmap regex: __meta_kubernetes_node_label_(.+) # 实际访问指标接口 https://NodeIP:10250/metrics/cadvisor,这里替换默认指标URL路径 - target_label: __metrics_path__ replacement: /metrics/cadvisor scheme: https tls_config: ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt insecure_skip_verify: true bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token - job_name: kubernetes-service-endpoints kubernetes_sd_configs: - role: endpoints # 从Service列表中的Endpoint发现Pod为目标 relabel_configs: # Service没配置注解prometheus.io/scrape的不采集 - action: keep regex: true source_labels: - __meta_kubernetes_service_annotation_prometheus_io_scrape # 重命名采集目标协议 - action: replace regex: (https?) source_labels: - __meta_kubernetes_service_annotation_prometheus_io_scheme target_label: __scheme__ # 重命名采集目标指标URL路径 - action: replace regex: (.+) source_labels: - __meta_kubernetes_service_annotation_prometheus_io_path target_label: __metrics_path__ # 重命名采集目标地址 - action: replace regex: ([^:]+)(?::\d+)?;(\d+) replacement: $1:$2 source_labels: - __address__ - __meta_kubernetes_service_annotation_prometheus_io_port target_label: __address__ # 将K8s标签(.*)作为新标签名,原有值不变 - action: labelmap regex: __meta_kubernetes_service_label_(.+) # 生成命名空间标签 - action: replace source_labels: - __meta_kubernetes_namespace target_label: kubernetes_namespace # 生成Service名称标签 - action: replace source_labels: - __meta_kubernetes_service_name target_label: kubernetes_name - job_name: kubernetes-pods kubernetes_sd_configs: - role: pod # 发现所有Pod为目标 # 重命名采集目标协议 relabel_configs: - action: keep regex: true source_labels: - __meta_kubernetes_pod_annotation_prometheus_io_scrape # 重命名采集目标指标URL路径 - action: replace regex: (.+) source_labels: - __meta_kubernetes_pod_annotation_prometheus_io_path target_label: __metrics_path__ # 重命名采集目标地址 - action: replace regex: ([^:]+)(?::\d+)?;(\d+) replacement: $1:$2 source_labels: - __address__ - __meta_kubernetes_pod_annotation_prometheus_io_port target_label: __address__ # 将K8s标签(.*)作为新标签名,原有值不变 - action: labelmap regex: __meta_kubernetes_pod_label_(.+) # 生成命名空间标签 - action: replace source_labels: - __meta_kubernetes_namespace target_label: kubernetes_namespace # 生成Service名称标签 - action: replace source_labels: - __meta_kubernetes_pod_name target_label: kubernetes_pod_name alerting: alertmanagers: - static_configs: - targets: ["alertmanager:80"] 1.2 prometheus部署文件 prometheus-deploy.yaml apiVersion: apps/v1 kind: Deployment metadata: name: prometheus namespace: ops labels: k8s-app: prometheus spec: replicas: 1 selector: matchLabels: k8s-app: prometheus template: metadata: labels: k8s-app: prometheus spec: serviceAccountName: prometheus initContainers: - name: "init-chown-data" image: "busybox:latest" # imagePullPolicy: "IfNotPresent" command: ["chown", "-R", "65534:65534", "/data"] volumeMounts: - name: prometheus-data mountPath: /data subPath: "" containers: - name: prometheus-server-configmap-reload image: "jimmidyson/configmap-reload:v0.1" # imagePullPolicy: "IfNotPresent" args: - --volume-dir=/etc/config - --webhook-url=http://localhost:9090/-/reload volumeMounts: - name: config-volume mountPath: /etc/config readOnly: true - mountPath: /etc/localtime name: timezone resources: limits: cpu: 10m memory: 100Mi requests: cpu: 10m memory: 100Mi - name: prometheus-server image: "prom/prometheus:v2.20.0" # imagePullPolicy: "IfNotPresent" args: - --config.file=/etc/config/prometheus.yml - --storage.tsdb.path=/data - --web.console.libraries=/etc/prometheus/console_libraries - --web.console.templates=/etc/prometheus/consoles - --web.enable-lifecycle ports: - containerPort: 9090 readinessProbe: httpGet: path: /-/ready port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30 livenessProbe: httpGet: path: /-/healthy port: 9090 initialDelaySeconds: 30 timeoutSeconds: 30 resources: limits: cpu: 500m memory: 800Mi requests: cpu: 200m memory: 400Mi volumeMounts: - name: config-volume mountPath: /etc/config - name: prometheus-data mountPath: /data subPath: "" - name: prometheus-rules mountPath: /etc/config/rules - mountPath: /etc/localtime name: timezone volumes: - name: config-volume configMap: name: prometheus-config - name: prometheus-rules configMap: name: prometheus-rules - name: prometheus-data persistentVolumeClaim: claimName: prometheus - name: timezone hostPath: path: /usr/share/zoneinfo/Asia/Shanghai --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: prometheus namespace: ops spec: storageClassName: "managed-nfs-storage" accessModes: - ReadWriteMany resources: requests: storage: 10Gi --- apiVersion: v1 kind: Service metadata: name: prometheus namespace: ops spec: type: NodePort ports: - name: http port: 9090 protocol: TCP targetPort: 9090 nodePort: 30089 selector: k8s-app: prometheus --- apiVersion: v1 kind: ServiceAccount metadata: name: prometheus namespace: ops --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: name: prometheus rules: - apiGroups: - "" resources: - nodes - nodes/metrics - services - endpoints - pods verbs: - get - list - watch - apiGroups: - "" resources: - configmaps verbs: - get - nonResourceURLs: - "/metrics" verbs: - get --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: prometheus roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: prometheus subjects: - kind: ServiceAccount name: prometheus namespace: ops 1.3 prometheus配置报警规则 prometheus-rules.yaml apiVersion: v1 kind: ConfigMap metadata: name: prometheus-rules namespace: ops data: general.rules: | groups: - name: general.rules rules: - alert: InstanceDown expr: up == 0 for: 1m labels: severity: error annotations: summary: "Instance {{ $labels.instance }} 停止工作" description: "{{ $labels.instance }} job {{ $labels.job }} 已经停止5分钟以上." node.rules: | groups: - name: node.rules rules: - alert: NodeFilesystemUsage expr: | 100 - (node_filesystem_free{fstype=~"ext4|xfs"} / node_filesystem_size{fstype=~"ext4|xfs"} * 100) > 80 for: 1m labels: severity: warning annotations: summary: "Instance {{ $labels.instance }} : {{ $labels.mountpoint }} 分区使用率过高" description: "{{ $labels.instance }}: {{ $labels.mountpoint }} 分区使用大于80% (当前值: {{ $value }})" - alert: NodeMemoryUsage expr: | 100 - (node_memory_MemFree+node_memory_Cached+node_memory_Buffers) / node_memory_MemTotal * 100 > 20 for: 1m labels: severity: warning annotations: summary: "Instance {{ $labels.instance }} 内存使用率过高" description: "{{ $labels.instance }}内存使用大于80% (当前值: {{ $value }})" - alert: NodeCPUUsage expr: | 100 - (avg(irate(node_cpu_seconds_total{mode="idle"}[5m])) by (instance) * 100) > 60 for: 1m labels: severity: warning annotations: summary: "Instance {{ $labels.instance }} CPU使用率过高" description: "{{ $labels.instance }}CPU使用大于60% (当前值: {{ $value }})" - alert: KubeNodeNotReady expr: | kube_node_status_condition{condition="Ready",status="true"} == 0 for: 1m labels: severity: error annotations: message: '{{ $labels.node }} 已经有10多分钟没有准备好了.' pod.rules: | groups: - name: pod.rules rules: - alert: PodCPUUsage expr: | sum(rate(container_cpu_usage_seconds_total{image!=""}[1m]) * 100) by (pod_name, namespace) > 5 for: 5m labels: severity: warning annotations: summary: "命名空间: {{ $labels.namespace }} | Pod名称: {{ $labels.pod_name }} CPU使用大于80% (当前值: {{ $value }})" - alert: PodMemoryUsage expr: | sum(container_memory_rss{image!=""}) by(pod_name, namespace) / sum(container_spec_memory_limit_bytes{image!=""}) by(pod_name, namespace) * 100 != +inf > 80 for: 5m labels: severity: error annotations: summary: "命名空间: {{ $labels.namespace }} | Pod名称: {{ $labels.pod_name }} 内存使用大于80% (当前值: {{ $value }})" - alert: PodNetworkReceive expr: | sum(rate(container_network_receive_bytes_total{image!="",name=~"^k8s_.*"}[5m]) /1000) by (pod_name,namespace) > 30000 for: 5m labels: severity: warning annotations: summary: "命名空间: {{ $labels.namespace }} | Pod名称: {{ $labels.pod_name }} 入口流量大于30MB/s (当前值: {{ $value }}K/s)" - alert: PodNetworkTransmit expr: | sum(rate(container_network_transmit_bytes_total{image!="",name=~"^k8s_.*"}[5m]) /1000) by (pod_name,namespace) > 30000 for: 5m labels: severity: warning annotations: summary: "命名空间: {{ $labels.namespace }} | Pod名称: {{ $labels.pod_name }} 出口流量大于30MB/s (当前值: {{ $value }}/K/s)" - alert: PodRestart expr: | sum(changes(kube_pod_container_status_restarts_total[1m])) by (pod,namespace) > 0 for: 1m labels: severity: warning annotations: summary: "命名空间: {{ $labels.namespace }} | Pod名称: {{ $labels.pod }} Pod重启 (当前值: {{ $value }})" - alert: PodFailed expr: | sum(kube_pod_status_phase{phase="Failed"}) by (pod,namespace) > 0 for: 5s labels: severity: error annotations: summary: "命名空间: {{ $labels.namespace }} | Pod名称: {{ $labels.pod }} Pod状态Failed (当前值: {{ $value }})" - alert: PodPending expr: | sum(kube_pod_status_phase{phase="Pending"}) by (pod,namespace) > 0 for: 1m labels: severity: error annotations: summary: "命名空间: {{ $labels.namespace }} | Pod名称: {{ $labels.pod }} Pod状态Pending (当前值: {{ $value }})" e 二.alertmanager搭建 2.1 alertmanager配置文件alertmanger-configmap.yaml 注:邮箱需要自己去网易邮箱申请并且取得授权管理密码 apiVersion: v1 kind: ConfigMap metadata: name: alertmanager-config namespace: ops data: alertmanager.yml: |- global: # 在没有报警的情况下声明为已解决的时间 resolve_timeout: 5m # 配置邮件发送信息 smtp_smarthost: 'smtp.163.com:465' smtp_from: 'xxx@163.com' smtp_auth_username: 'xxx@163.com' smtp_auth_password: 'GMZFNPIWGYEPMGDK' smtp_hello: '163.com' smtp_require_tls: false # 所有报警信息进入后的根路由,用来设置报警的分发策略 route: # 这里的标签列表是接收到报警信息后的重新分组标签,例如,接收到的报警信息里面有许多具有 cluster=A 和 alertname=LatncyHigh 这样的标签的报警信息将会批量被聚合到一个分组里面 group_by: ['alertname', 'cluster'] # 当一个新的报警分组被创建后,需要等待至少group_wait时间来初始化通知,这种方式可以确保您能有足够的时间为同一分组来获取多个警报,然后一起触发这个报警信息。 group_wait: 30s # 当第一个报警发送后,等待'group_interval'时间来发送新的一组报警信息。 group_interval: 5m # 如果一个报警信息已经发送成功了,等待'repeat_interval'时间来重新发送他们 repeat_interval: 5m # 默认的receiver:如果一个报警没有被一个route匹配,则发送给默认的接收器 receiver: default # 上面所有的属性都由所有子路由继承,并且可以在每个子路由上进行覆盖。 routes: - receiver: email group_wait: 10s match: team: node receivers: - name: 'default' email_configs: - to: 'xxx@xx.com' send_resolved: true - name: 'email' email_configs: - to: 'xxx@qq.com' send_resolved: true 2.2 alertmanager template文件alertmanager-template.yaml #自定义告警模板 apiVersion: v1 kind: ConfigMap metadata: name: alertmanager-template-volume namespace: ops data: email.tmpl: | {{ define "email.html" }} {{ range .Alerts }} <pre> ========start========== 告警程序: prometheus_alert_email 告警级别: {{ .Labels.severity }} 级别 告警类型: {{ .Labels.alertname }} 故障主机: {{ .Labels.instance }} 告警主题: {{ .Annotations.summary }} 告警详情: {{ .Annotations.description }} 处理方法: {{ .Annotations.console }} 触发时间: {{ .StartsAt.Format "2006-01-02 15:04:05" }} ========end========== </pre> {{ end }} {{ end }} 2.3alertmanager部署文件alertmanager-deploy.yaml apiVersion: apps/v1 kind: Deployment metadata: name: alertmanager namespace: ops spec: replicas: 1 selector: matchLabels: k8s-app: alertmanager version: v0.14.0 template: metadata: labels: k8s-app: alertmanager version: v0.14.0 spec: containers: - name: prometheus-alertmanager image: "prom/alertmanager:v0.14.0" imagePullPolicy: "IfNotPresent" args: - --config.file=/etc/config/alertmanager.yml - --storage.path=/data - --web.external-url=/ ports: - containerPort: 9093 readinessProbe: httpGet: path: /#/status port: 9093 initialDelaySeconds: 30 timeoutSeconds: 30 volumeMounts: - name: config-volume mountPath: /etc/config #自定义告警模板 - name: config-template-volume mountPath: /etc/config/template - name: storage-volume mountPath: "/data" subPath: "" - mountPath: /etc/localtime name: timezone resources: limits: cpu: 10m memory: 200Mi requests: cpu: 10m memory: 100Mi - name: prometheus-alertmanager-configmap-reload image: "jimmidyson/configmap-reload:v0.1" imagePullPolicy: "IfNotPresent" args: - --volume-dir=/etc/config - --webhook-url=http://localhost:9093/-/reload volumeMounts: - name: config-volume mountPath: /etc/config readOnly: true resources: limits: cpu: 10m memory: 200Mi requests: cpu: 10m memory: 100Mi volumes: - name: config-volume configMap: name: alertmanager-config - name: config-template-volume configMap: name: alertmanager-template-volume - name: storage-volume persistentVolumeClaim: claimName: alertmanager - name: timezone hostPath: path: /usr/share/zoneinfo/Asia/Shanghai --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: alertmanager namespace: ops spec: storageClassName: managed-nfs-storage accessModes: - ReadWriteOnce resources: requests: storage: "2Gi" --- apiVersion: v1 kind: Service metadata: name: alertmanager namespace: ops labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile kubernetes.io/name: "Alertmanager" spec: type: "NodePort" ports: - name: http port: 80 protocol: TCP targetPort: 9093 nodePort: 30093 selector: k8s-app: alertmanager 三 安装监控界面grafana 3.1 grafana部署文件 apiVersion: apps/v1 kind: Deployment metadata: name: grafana namespace: ops spec: replicas: 1 selector: matchLabels: app: grafana template: metadata: labels: app: grafana spec: containers: - name: grafana image: grafana/grafana:7.1.0 ports: - containerPort: 3000 protocol: TCP resources: limits: cpu: 100m memory: 256Mi requests: cpu: 100m memory: 256Mi volumeMounts: - name: grafana-data mountPath: /var/lib/grafana subPath: grafana - mountPath: /etc/localtime name: timezone securityContext: fsGroup: 472 runAsUser: 472 volumes: - name: grafana-data persistentVolumeClaim: claimName: grafana - name: timezone hostPath: path: /usr/share/zoneinfo/Asia/Shanghai --- apiVersion: v1 kind: PersistentVolumeClaim metadata: name: grafana namespace: ops spec: storageClassName: "managed-nfs-storage" accessModes: - ReadWriteMany resources: requests: storage: 5Gi --- apiVersion: v1 kind: Service metadata: name: grafana namespace: ops spec: type: NodePort ports: - port : 80 targetPort: 3000 nodePort: 30030 selector: app: grafana 3.2 数据源和监控模板 数据源填写配置prometheus.ops:9090 模板可以下载下面3个 k8s工作节点监控 k8s集群资源监控 k8s资源对象状态监控 k8s监控模板 提取码: aexi 操作结果展示 1.prometheus效果 4.2 alertmanager显示效果 4.3报警结果 4.4 grafana监控图部分图 文章参考了https://i4t.com/4197.html

优秀的个人博客,低调大师

sqltoy-orm-5.0.0 发版,分享给大家最睿智的 ORM 框架!

写在开头 sagacity-sqltoy是JPA+超强查询有机融合体,是个人长期项目实践的归纳总结,极为注重项目过程实践,尤其是项目痛点,如:sql注入、动态条件sql编写、树形结构查询、sql跨数据库、查询性能极致优化、极致的分页查询、涉及统计分析的行列转换、分组汇总计算等等,都有极为独特的解决策略! 感谢广大网络用户的支持和反馈,sagacity-sqltoy5.0 在拥有良好特性的基础上进一步完善了代码结构,必将更好的为大家的选择提供坚实的支撑! 开源地址: github:https://github.com/sagframe/sagacity-sqltoy gitee:https://gitee.com/sagacity/sagacity-sqltoy idea 插件(可直接在idea中检索安装):https://github.com/threefish/sqltoy-idea-plugins 更新内容 1. 规整4.x版本的代码目录,使其更加科学 去除executor目录,将QueryExecutor 对外的模型统一移入model目录下面 将非对外的内部模型移入到model.inner 包下面,将一些配置化的模型移入到config.model下面 2. 将PaginationModel 改为Page,并将PageNo 由Long改为long,避免需要写1L,简化书写 3. 优化support下面的LinkSupport,BaseSupport 剔除掉LinkSupport和BaseSupport,合并到SqlToyDaoSupport 4. 去除一些根本用不到的方法,避免产生疑问和混淆,使得SqlToyDao更加清晰 去除updateFetchTop、updateFetchRandom 去除:public Long executeSql(String sqlOrNamedSql, Serializable entity, ReflectPropsHandler reflectPropertyHandler)带有reflectPropertyHandler 的开放方法 5. 去除@ListSql @PageSql @LoadSql 这些注解,尽量让使用方法归一 6. 去除ObtainDataSource,避免跟DataSourceSelector产生功能重叠 7. 将ConnectonFactory移入org.sagacity.sqltoy.plugins.datasource包下 8. 剔除findAll方法,用findEntity(Class voClass,null) 代替findAll方法属于极小众方法 9. 并行查询设置分页模型方法:pageMode(Pagination pageModel)改为page(Page page) 10. 增加loadEntity方法,通过EntityQuery获得单条记录: public <T extends Serializable> T loadEntity(Class<T> entityClass, EntityQuery entityQuery); 11. 增加numFmt(numberFormat) 对英文金额转大写的支持 <number-format columns="total_amt" format="capital-en"/> 12. 删除对SybaseIQ数据库的支持 13. 优化部分不使用的代码和注释 4.x 升级5.0 修改点 分页查询PaginationModel 类改为Page org.sagacity.sqltoy.executor.QueryExecutor 改为 org.sagacity.sqltoy.model.QueryExecutor 拥有JPA模式的对象CRUD 对象式CRUD是ORM框架的基本共识,这里不做更多介绍。 超强查询:最理想的状态就是:第一在数据库客户端调试好的sql 最直观高效的移入项目工程中;第二、在需求变化时最简单快速的可以从工程中放入数据库客户端中进行调试。也就是说要最大限度的保持sql的原始面貌; 用ORM我们真真正正的痛点是什么? 1、sql的编写和后期维护,上面的图例已经说明问题。 2、执行效率:当同样功能效率有几倍差距时其实就是天地之别了,带来的直接效果就是:一边是用户的高度夸赞、一边是用户的鄙视,您能理解这是什么差距吗? sqltoy的缓存翻译,大幅减少表关联简化sql,让你的查询性能成几何级提升 极致的分页,同样帮助你实现查询的性能大幅提升 快速分页:@fast() 实现先取单页数据然后再关联查询,极大提升速度 分页优化器:page-optimize 让分页查询由两次变成1.3~1.5次(用缓存实现相同查询条件的总记录数量在一定周期内无需重复查询 sqltoy的分页取总记录的过程不是简单的select count(1) from (原始sql);而是智能判断是否变成:select count(1) from 'from后语句', 并自动剔除最外层的order by sqltoy支持并行查询:parallel="true",同时查询总记录数和单页数据,大幅提升性能 在极特殊情况下sqltoy分页考虑是最优化的,如:with t1 as (),t2 as @fast(select * from table1) select * from xxx 这种复杂查询的分页的处理,sqltoy的count查询会是:with t1 as () select count(1) from table1, 如果是:with t1 as @fast(select * from table1) select * from t1 ,count sql 就是:select count(1) from table1 做过统计分析的您,害怕数据旋转吗?害怕同比环比吗? 无限极分组统计(含汇总求平均),算法配置简单又跨数据库! 同比环比

优秀的个人博客,低调大师

Spring Cloud 2020.0.3 正式版发布,迈特云(MateCloud)同步完成升级

一、关于Spring Cloud Spring Cloud 为开发者提供了快速构建分布式系统中一些常用模式的工具(例如配置管理、服务发现、断路器、智能路由、微代理、控制总线)。分布式系统的协调导致了样板模式,使用 Spring Cloud 开发人员可以快速建立实现这些模式的服务和应用程序。它们将适用于任何分布式环境,包括开发人员自己的笔记本电脑、云数据中心和托管平台(如 Cloud Foundry)。 发布Train版本:2020.0.3 支持的Spring Boot版本:2.4.6 官方地址:https://spring.io/projects/spring-cloud 二、特征 Spring Cloud 专注于为典型用例和可扩展性机制提供良好的开箱即用体验以覆盖其他用例。 分布式/版本化配置 服务注册和发现 路由 服务到服务呼叫 负载均衡 断路器 分布式消息传递 三、更新内容 spring-cloud-build spring-cloud-build版本升级至 3.0.3 spring-cloud-bus spring-cloud-bus版本升级至 3.0.3 spring-cloud-circuitbreaker spring-cloud-circuitbreaker版本升级至 2.0.2 spring-cloud-cli spring-cloud-cli版本升级至 3.0.3 spring-cloud-cloudfoundry spring-cloud-cloudfoundry版本升级至 3.0.2 spring-cloud-commons spring-cloud-commons版本升级至 3.0.3 spring-cloud-config spring-cloud-config版本升级至 3.0.4 spring-cloud-consul spring-cloud-consul版本升级至 3.0.3 spring-cloud-contract spring-cloud-contract版本升级至 3.0.3 spring-cloud-function spring-cloud-function版本升级至 3.1.3 spring-cloud-gateway spring-cloud-gateway版本升级至 3.0.3 spring-cloud-kubernetes spring-cloud-kubernetes版本升级至 2.0.3 spring-cloud-netflix spring-cloud-netflix版本升级至 3.0.3 spring-cloud-openfeign spring-cloud-openfeign版本升级至 3.0.3 spring-cloud-sleuth spring-cloud-sleuth版本升级至 3.0.3 spring-cloud-stream spring-cloud-stream版本升级至 3.1.3 spring-cloud-task spring-cloud-task版本升级至 2.3.2 spring-cloud-vault spring-cloud-vault版本升级至 3.0.3 spring-cloud-zookeeper spring-cloud-zookeeper版本升级至 3.0.3 四、MateCloud升级 MateCloud是一款基于Spring Cloud Alibaba的微服务架构。目前已经整合Spring Cloud Gateway、Spring Security Oauth2、Feign、Dubbo、JetCache、RocketMQ等服务套件,为您的开发保驾护航!

优秀的个人博客,低调大师

python 开发的 windows版运维图形界面-信息管理系统

基于运维人员对windows/linux/网络设备系统管理比较分散,并且每个服务都要开启不同的监控和应用程序,浪费时间,浪费时间就是浪费金钱的道理没有人不会不懂这个道理,我查找了很多资源发现都是一些零散的监控工具,没有正真意思的统一监控管理(博主时间有限。目前只分享windows本地监控,后面继续更新远程监控),并且运维人员查看网络或者虚拟机信息都要远程登录,而本工具可以在本地直接写命令,获取远程配置信息,极大的提高运维人员的工作效率和节约成本时间。 1.登陆首页展示和代码分享 #登陆页面 deflog_in(self): """ 登录界面 :return: """ try: logging.info('***StsrtIMS***') var1=StringVar()#id框中的文字 var2=StringVar()#密码框中的文字 self.root.geometry('450x380'+self.winfo_landing_x+self.winfo_landing_y)#设置主界面大小 self.root.resizable(0,0)#禁止调整窗口大小 self.root.title("信息化管理系统") #登录主界面分成两行一列 logging.info('Startloadingbackgroundimage') #================背景图================== #组件.grid(row=x,column=y)将组件放入self.root中(x,y)位置 f=Frame(width=523,height=150,bg='green')#frame1 canvas=tk.Canvas(self.root,width=525,height=150,bg='yellow')#canvas1 self.img=itk.PhotoImage(file="img/win.png") canvas.create_image(209,75,image=self.img) canvas.grid(row=0,column=0,columnspan=2,padx=1,pady=3) #======================================= logging.info('Endloadingbackgroundimage') logging.info('Startloadingthegraybox') #================下灰框================== f=Frame(width=520,height=220,bg='#DCDCDC')#frame2 f_head=Frame(width=80,height=80,bg='green')#frame3 #======================================= logging.info('Endloadingthegraybox') logging.info('Startloadingavatar') #=================头像=================== self.canvas2=tk.Canvas(self.root,width=80,height=80,bg='red') self.img2=Img.open("img/TX.png") self.img2=itk.PhotoImage(self.img2) self.canvas2.create_image(40,40,image=self.img2) self.canvas2.place(in_=f_head,anchor=NW)#canvas2放入frame3中,位置是偏西北 f_head.place(relx=0.10,rely=0.56)#frame3放入root的绝对位置上 #======================================= logging.info('Endloadingavatar') logging.info('Startloadinguseraccounts') #===============用户账号==================Entry1直接放入self.root的绝对位置上,也可以尝试放入frame2中 self.usr=Entry(self.root,textvariable=var1,bg='#F5F5F5',highlightcolor='#1E90FF') self.usr.place(relx=0.35,rely=0.56) #======================================= logging.info('Endloadinguseraccounts') logging.info('Startloadingthepasswordbox') #===============密码框====================Entry2直接放入self.root的绝对位置上 self.pwd=Entry(self.root,textvariable=var2,bg='#F5F5F5',highlightcolor='#1E90FF') self.pwd['show']='*' self.pwd.place(relx=0.35,rely=0.65) #======================================= logging.info('Endloadingthepasswordbox') logging.info('Startloadingautomaticlogin') #自动登录 #checkbutton放入绝对位置 rem_pwd=Checkbutton(self.root,foreground='#1E90FF').place(relx=0.34,rely=0.72)#选择框 #设置颜色,字体,宽,长compound=LEFT,foreground='#808080',bg='#DCDCDC' rem_pwd_lab=Label(self.root,width=6,height=1,text='自动登录', foreground='#808080') rem_pwd_lab.place(relx=0.39,rely=0.72) #======================================= logging.info('Endloadingautomaticlogin') logging.info('Startloadingtherememberpassword') #==============记住密码=================== rem_pwd=Checkbutton(self.root,foreground='#1E90FF').place(relx=0.51,rely=0.72)#选择框 rem_pwd_lab=Label(self.root,width=6,height=1,text='记住密码', foreground='#808080')#设置颜色,字体,宽,长compound=LEFT,foreground='#808080',bg='#DCDCDC' rem_pwd_lab.place(relx=0.56,rely=0.72)#设计找回密码字体大小 #======================================= logging.info('Endloadingtherememberpassword') #=============登录按钮==================== login_btn=Button(self.root,text='登陆',bg='#1E90FF')#按钮,字体颜色,按钮背景色:bg='#1E90FF' login_btn.place(relx=0.36,rely=0.8)#设置登录坐标位置X,Y login_btn.bind("<Button-1>",self.load)#触发函数执行 #======================================= #===============注册用户================== fgt_usr_btn=Button(self.root,text='注册账号',foreground='#1E90FF',command=self.regiser)#灰色:bg='#DCDCDC' fgt_usr_btn.place(relx=0.7,rely=0.54) #fgt_usr_btn.bind("<Button-1>",self.regiser) #======================================= #===============找回密码================= fgt_pwd_btn=Button(self.root,text='找回密码',foreground='#1E90FF',command=self.fg_pwd)#灰色:bg='#DCDCDC' fgt_pwd_btn.place(relx=0.7,rely=0.64) #fgt_pwd_btn.bind("<Button-1>",self.fg_pwd)#模拟enter按钮 #fgt_pwd_btn.flash() #======================================= exceptExceptionasloginerror: logging.info(str(loginerror)) print(str(loginerror)) #登陆认证 defload(self,*args): """ 登录事件 :paramargs: :return: """ try: logging.info('Startrunningtheloginevent') user=self.usr.get() pwd=self.pwd.get() License_p=time.strftime('%Y%m%d%H%M%S',time.localtime(time.time())) hl=hashlib.md5() hl.update(pwd.encode(encoding='utf8')) pwd_md5_jm=hl.hexdigest() print('加密前为:'+pwd) print('加密后为:'+hl.hexdigest()) ifLicense_p<=self.LICENSE_TIMES: withopen(r'db\imsap.txt','r',encoding='utf8')asf: foriinf: user1=i.strip().split(':')[2] pwd2=i.strip().split(':')[3] ifuser==user1andpwd2==pwd_md5_jm: #ifself.username==userandself.password==pwd_md5_jm: logging.info('loginsuccessful') print('登录成功') self.root.quit()#关闭登录窗口 self.root.destroy()#destroy()销毁一个小部件,quit()退出mainloop。 print('已关闭登陆界面。。') print('开始加载主页面。。') logging.info('Startloadingpage') #self.cs1() t1=threading.Thread(target=self.cs1()) t1.start() t1.join() logging.info('Endloadingpage') print('主页面加载结束。。') else: print('登录失败') lbtime2=tk.Label(self.root,fg='red',anchor='w') lbtime2.place(x=156,y=180,width=150) lbtime2['text']='请输入正确的用户名或密码' #messagebox.showinfo(title='登陆日志',message='用户名或密码错误,请重新登录') else: lbtime2=tk.Label(self.root,fg='red',anchor='w') lbtime2.place(x=149,y=180,width=155) lbtime2['text']='License已过期,请联系管理员授权!' logging.info('Endrunningtheloginevent') exceptExceptionasruuingerror: print(str(ruuingerror)) #账号注册页面 defregiser(self,*args): """ 登录账号注册 :paramevent: :return: """ self.ycsy=tk.Tk() self.ycsy.title('登录账号注册')#设置窗口标题 self.ycsy.geometry("580x265+460+300")#设置窗口大小宽,高 self.ycsy.resizable(width=False,height=False)#宽不可变,高可变,默认为True name=tk.StringVar() ttk.Label(self.ycsy,text="").grid(row=0,column=1,columnspan=1) tk.Label(self.ycsy,text="用户ID*",font=("黑体",10,"bold"),width=40,height=3,wraplength=80,anchor='w').grid( row=1,column=1,columnspan=1) tk.Label(self.ycsy,text="用户名*",font=("黑体",10,"bold"),width=40,height=3,wraplength=80,anchor='w').grid( row=1,column=2,columnspan=1) self.name_id=tk.StringVar() self.name_id_sr=ttk.Entry(self.ycsy,width=20,textvariable=self.name_id) self.name_id_sr.grid(row=1,column=1) self.name_id_sr.focus() self.name_zc=tk.StringVar() self.name_zc_sr=ttk.Entry(self.ycsy,width=20,textvariable=self.name_zc) self.name_zc_sr.grid(row=1,column=2) self.name_zc_sr.focus() tk.Label(self.ycsy,text=u"账号状态",font=("黑体",10,"bold"),width=40,height=3,wraplength=80,anchor='w').grid( row=2,column=1) tk.Label(self.ycsy,text=u"密码*",font=("黑体",10,"bold"),width=40,height=3,wraplength=80,anchor='w').grid( row=2,column=2) self.account_zc=tk.StringVar() self.account_zc_sr=ttk.Combobox(self.ycsy,width=18,textvariable=self.account_zc, state='readonly')#下拉框字体,内容为weather,宽度,state='editable'表示内容可编辑 self.account_zc_sr['values']=('可用','禁用')#设置下拉列表的值 self.account_zc_sr.grid(column=1,row=2)#设置其在界面中出现的位置column代表列row代表行 self.account_zc_sr.current(0) self.pwd_zc=tk.StringVar() self.pwd_zc_sr=ttk.Entry(self.ycsy,width=20,textvariable=self.pwd_zc,show='*') self.pwd_zc_sr.grid(row=2,column=2) self.pwd_zc_sr.focus() tk.Label(self.ycsy,text=u"邮箱*", font=("黑体",10,"bold"), width=40,height=3,wraplength=80,anchor='w').grid(row=3,column=1) tk.Label(self.ycsy,text=u"确认密码*",font=("黑体",10,"bold"), width=40,height=3,wraplength=80, anchor='w').grid(row=3,column=2) self.email_zc=tk.StringVar() self.email_zc_sr=ttk.Entry(self.ycsy,width=20,textvariable=self.email_zc) self.email_zc_sr.grid(row=3,column=1) self.email_zc_sr.focus() self.pwd_qr_zc=tk.StringVar() self.pwd_qr_zc_sr=ttk.Entry(self.ycsy,width=20,textvariable=self.pwd_qr_zc,show='*') self.pwd_qr_zc_sr.grid(row=3,column=2) self.pwd_qr_zc_sr.focus() tk.Label(self.ycsy,text=u"手机号码*", font=("黑体",10,"bold"), width=40,height=3,wraplength=80, anchor='w').grid(row=4,column=1) tk.Label(self.ycsy,text=u"信息安全", font=("黑体",10,"bold"), width=40,height=3,wraplength=80,anchor='w').grid(row=4,column=2) self.phone_zc=tk.StringVar() self.phone_zc_sr=ttk.Entry(self.ycsy,width=20,textvariable=self.phone_zc) self.phone_zc_sr.grid(row=4,column=1) self.phone_zc_sr.focus() self.ifm_zc=tk.StringVar() self.ifm_zc_sr=ttk.Combobox(self.ycsy,width=18,textvariable=self.ifm_zc,state='readonly') self.ifm_zc_sr['values']=('不加密','加密')#设置下拉列表的值 self.ifm_zc_sr.grid(column=2,row=4)#设置其在界面中出现的位置column代表列row代表行 self.ifm_zc_sr.current(0) #=============注册确定按钮==================== #button3放入绝对位置 login_btn=Button(self.ycsy,text='确定',bg='#1E90FF',command=self.regiser_file) login_btn.place(relx=0.38,rely=0.8) #login_btn.bind("<Button-1>",'执行函数') #======================================= #=============注册取消按钮====================button3放入绝对位置 login_btn=Button(self.ycsy,text='关闭',bg='#1E90FF',command=self.regiser_cancel) login_btn.place(relx=0.49,rely=0.8) #login_btn.bind("<Button-1>",self.regiser_cancel) #======================================= #账号注册确定 defregiser_file(self,*args): """ 注册确定事件 :return: """ self.id_file_p=self.name_id_sr.get()#用户ID self.name_file_p=self.name_zc_sr.get()#用户名 self.accout_file_p=self.account_zc_sr.get()#账号状态 self.pwd_file_p=self.pwd_zc_sr.get()#密码 #密码加密----------------------------------- hl=hashlib.md5() hl.update(self.pwd_file_p.encode(encoding='utf8')) self.pwd_file_p=hl.hexdigest() #密码加密----------------------------------- self.email_file_p=self.email_zc_sr.get()#邮箱 self.pwd_qr_file_p=self.pwd_qr_zc_sr.get()#确认密码 self.phone_file_p=self.phone_zc_sr.get()#手机号码 self.ifm_file_p=self.ifm_zc_sr.get()#信息安全 ifself.name_file_porself.pwd_file_porself.pwd_qr_file_p!=''andself.pwd_file_p!=self.pwd_qr_file_p: #[IMSAP]:用户ID:用户名,密码,邮箱,手机号码,账号状态,信息安全 file_imsap='[IMSAP]:{0}:{1}:{2}:{3}:{4}:{5}:{6}'.format( self.id_file_p, self.name_file_p, self.pwd_file_p, self.email_file_p, self.phone_file_p, self.accout_file_p, self.ifm_file_p, self.ifm_file_p ).replace('','') withopen(r'report\imsap.txt','a',encoding='utf8')asf: f.writelines(file_imsap+'\n') f.close() lbtime2=tk.Label(self.ycsy,fg='red',anchor='w') lbtime2.place(x=205,y=2,width=160) lbtime2['text']='提示:已注册成功请登录' else: lbtime2=tk.Label(self.ycsy,fg='red',anchor='w') lbtime2.place(x=210,y=2,width=160) lbtime2['text']='提示:带“*”为必填项!!' ##密码 ifself.pwd_file_p!=self.pwd_qr_file_p: lbtime2=tk.Label(self.ycsy,fg='red',anchor='w') lbtime2.place(x=205,y=2,width=160) lbtime2['text']='提示:密码不一致!!' #账号注册取消 defregiser_cancel(self): """ 注册取消事件 :return: """ self.ycsy.destroy() #找回密码 deffg_pwd(self,*args): """ 找回密码事件 :paramevent: :return: """ messagebox.showinfo(title='找回密码',message='程序正在更新中......') 1.1 代码执行效果图 2.代码监控部分逻辑代码 deffbytes(B): 'ReturnthegivenbytesasahumanfriendlyKB,MB,GB,orTBstring' B=float(B) KB=float(1024) MB=float(KB**2)#1,048,576 GB=float(KB**3)#1,073,741,824 TB=float(KB**4)#1,099,511,627,776 ifB<KB: return'{0}{1}'.format(B,'Bytes'if0==B>1else'Byte') elifKB<=B<MB: return'{0:.2f}KB'.format(B/KB) elifMB<=B<GB: return'{0:.2f}MB'.format(B/MB) elifGB<=B<TB: return'{0:.2f}GB'.format(B/GB) elifTB<=B: return'{0:.2f}TB'.format(B/TB) classHandler(http.server.BaseHTTPRequestHandler): """SimpleHTTPrequesthandlerwithGET/HEAD/POSTcommands. Thisservesfilesfromthecurrentdirectoryandanyofits subdirectories.TheMIMEtypeforfilesisdeterminedby callingthe.guess_type()method.Andcanreveivefileuploaded byclient. TheGET/HEAD/POSTrequestsareidenticalexceptthattheHEAD requestomitstheactualcontentsofthefile. """ defdo_GET(self): """ServeaGETrequest.""" f=self.send_head() iff: self.copyfile(f,self.wfile) f.close() defdo_HEAD(self): """ServeaHEADrequest.""" f=self.send_head() iff: f.close() defdo_POST(self): """ServeaPOSTrequest.""" r,info=self.deal_post_data() print((r,info,"by:",self.client_address)) f=BytesIO() f.write(b'<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML3.2Final//EN">') f.write(b"<html>\n<title>UploadResultPage</title>\n") f.write(b'<styletype="text/css">\n') f.write(b'*{font-family:Helvetica;font-size:16px;}\n') f.write(b'a{text-decoration:none;}\n') f.write(b'</style>\n') f.write(b"<body>\n<h2>UploadResultPage</h2>\n") f.write(b"<hr>\n") ifr: f.write(b"<strong>Success!</strong>") else: f.write(b"<strong>Failed!</strong>") f.write(info.encode()) f.write(("<br><br><ahref=\"%s\">"%self.headers['referer']).encode()) f.write(b"<button>Back</button></a>\n") f.write(b"<hr><small>PoweredBy:bones7456<br>Checknewversion") f.write(b"<ahref=\"https://gist.github.com/UniIsland/3346170\"target=\"_blank\">") f.write(b"here</a>.</small></body>\n</html>\n") length=f.tell() f.seek(0) self.send_response(200) self.send_header("Content-type","text/html") self.send_header("Content-Length",str(length)) self.end_headers() iff: self.copyfile(f,self.wfile) f.close() defdeal_post_data(self): uploaded_files=[] content_type=self.headers['content-type'] ifnotcontent_type: return(False,"Content-Typeheaderdoesn'tcontainboundary") boundary=content_type.split("=")[1].encode() remainbytes=int(self.headers['content-length']) line=self.rfile.readline() remainbytes-=len(line) ifnotboundaryinline: return(False,"ContentNOTbeginwithboundary") whileremainbytes>0: line=self.rfile.readline() remainbytes-=len(line) fn=re.findall(r'Content-Disposition.*name="file";filename="(.*)"',line.decode()) ifnotfn: return(False,"Can'tfindoutfilename...") path=self.translate_path(self.path) fn=os.path.join(path,fn[0]) line=self.rfile.readline() remainbytes-=len(line) line=self.rfile.readline() remainbytes-=len(line) try: out=open(fn,'wb') exceptIOError: return(False,"<br><br>Can'tcreatefiletowrite.<br>Doyouhavepermissiontowrite?") else: without: preline=self.rfile.readline() remainbytes-=len(preline) whileremainbytes>0: line=self.rfile.readline() remainbytes-=len(line) ifboundaryinline: preline=preline[0:-1] ifpreline.endswith(b'\r'): preline=preline[0:-1] out.write(preline) uploaded_files.append(fn) break else: out.write(preline) preline=line return(True,"<br><br>'%s'"%"'<br>'".join(uploaded_files)) defsend_head(self): """CommoncodeforGETandHEADcommands. ThissendstheresponsecodeandMIMEheaders. Returnvalueiseitherafileobject(whichhastobecopied totheoutputfilebythecallerunlessthecommandwasHEAD, andmustbeclosedbythecallerunderallcircumstances),or None,inwhichcasethecallerhasnothingfurthertodo. """ path=self.translate_path(self.path) f=None ifos.path.isdir(path): ifnotself.path.endswith('/'): #redirectbrowser-doingbasicallywhatapachedoes self.send_response(301) self.send_header("Location",self.path+"/") self.end_headers() returnNone forindexin"index.html","index.htm": index=os.path.join(path,index) ifos.path.exists(index): path=index break else: returnself.list_directory(path) ctype=self.guess_type(path) try: #Alwaysreadinbinarymode.Openingfilesintextmodemaycause #newlinetranslations,makingtheactualsizeofthecontent #transmitted*less*thanthecontent-length! f=open(path,'rb') exceptIOError: self.send_error(404,"Filenotfound") returnNone self.send_response(200) self.send_header("Content-type",ctype) fs=os.fstat(f.fileno()) self.send_header("Content-Length",str(fs[6])) self.send_header("Last-Modified",self.date_time_string(fs.st_mtime)) self.end_headers() returnf deflist_directory(self,path): """Helpertoproduceadirectorylisting(absentindex.html). Returnvalueiseitherafileobject,orNone(indicatingan error).Ineithercase,theheadersaresent,makingthe interfacethesameasforsend_head(). """ try: list=os.listdir(path) exceptos.error: self.send_error(404,"Nopermissiontolistdirectory") returnNone enc=sys.getfilesystemencoding() list.sort(key=lambdaa:a.lower()) f=BytesIO() displaypath=html.escape(urllib.parse.unquote(self.path)) f.write(b'<!DOCTYPEhtmlPUBLIC"-//W3C//DTDHTML3.2Final//EN">') f.write(b'<html>\n') f.write(('<metahttp-equiv="Content-Type"' 'content="text/html;charset=%s">'%enc).encode(enc)) f.write(("<title>Directorylistingfor%s</title>\n"%displaypath).encode(enc)) f.write(b'<styletype="text/css">\n') f.write(b'*{font-family:Helvetica;font-size:16px;}\n') f.write(b'a{text-decoration:none;}\n') f.write(b'a:link{text-decoration:none;font-weight:bold;color:#0000ff;}\n') f.write(b'a:visited{text-decoration:none;font-weight:bold;color:#0000ff;}\n') f.write(b'a:active{text-decoration:none;font-weight:bold;color:#0000ff;}\n') f.write(b'a:hover{text-decoration:none;font-weight:bold;color:#ff0000;}\n') f.write(b'table{\nborder-collapse:separate;\n}\n') classVrvAgent(): """主逻辑""" def__init__(self): self.app=wx.App()#创建应用程序对象 self.win=wx.Frame(None,-1, title='设备配置管理系统', size=(710,620), pos=(500,100), style=wx.SYSTEM_MENU|wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX)#创建窗体 self.taskBarIcon=TaskBarIcon(frame=self.win) self.agent_menu()#菜单栏 self.agent_box()#页面 defagent_menu(self): """ 总菜单栏 :return: """ self.memBar=wx.MenuBar()#初始化菜单栏 self.agent_fileMenu_f()#文件 self.agent_deitMenu_e()#编辑 self.agent_helpMenu_h()#帮助 self.win.SetMenuBar(self.memBar)#启动菜单栏 defagent_fileMenu_f(self): """ 菜单栏-文件 :return: """ #------------------------------文件 file_menu=wx.Menu()#二级 newItem=wx.MenuItem(file_menu,id=wx.ID_NEW,text="新建(N)\tCtrl+N",kind=wx.ITEM_NORMAL) openItem=wx.MenuItem(file_menu,id=wx.ID_OPEN,text="打开(O)...\tCtrl+O",kind=wx.ITEM_NORMAL) saveItem=wx.MenuItem(file_menu,id=wx.ID_SAVE,text="保存(S)\tCtrl+S",kind=wx.ITEM_NORMAL) #saveItem.SetBitmap(wx.Bitmap("exit.png"))#添加保存图标 saveasItem=wx.MenuItem(file_menu,id=wx.ID_SAVEAS,text="另存为(A)...",kind=wx.ITEM_NORMAL) exitItem=wx.MenuItem(file_menu,id=20,text="退出(X)",kind=wx.ITEM_NORMAL) file_menu.Append(newItem)#newItem此属性添加带菜单栏 file_menu.Append(openItem) file_menu.Append(saveItem) file_menu.Append(saveasItem) file_menu.AppendSeparator()#选项之间添加一行线 file_menu.Append(exitItem) self.win.Bind(wx.EVT_MENU,self.OnExit,saveasItem)#执行另存为函数 self.win.Bind(wx.EVT_MENU,self.OnExit,exitItem)#执行退出函数 self.memBar.Append(file_menu,title="文件(F)")#一级 #------------------------------文件 defagent_deitMenu_e(self): """ 菜单栏-编辑 :return: """ deitMenu=wx.Menu() ftpclient=wx.MenuItem(id=21,text="FTP客户端\tCtrl+W",kind=wx.ITEM_NORMAL) ftpserver=wx.MenuItem(id=21,text="FTP服务端\tCtrl+Q",kind=wx.ITEM_NORMAL) #deitMenu.Append(id=21,item="FTP服务端\tCtrl+Q",kind=wx.ITEM_NORMAL) self.memBar.Append(deitMenu,title="工具(E)") deitMenu.Append(ftpclient) deitMenu.Append(ftpserver) self.win.Bind(wx.EVT_MENU,self.ftpclient,ftpclient)#执行退出函数 self.win.Bind(wx.EVT_MENU,self.ftpserver,ftpserver)#执行退出函数 defftpclient(self,event): """ ftp客户端 """ print('ccc') defftpserver(self,event): """ ftp服务端 """ FTP_files().ftp_files() defagent_helpMenu_h(self): """ 菜单栏-帮助 :return: """ helpMenu=wx.Menu() editMenu=wx.Menu()#初始化三级 cutItem=wx.MenuItem(editMenu,id=122,text="Cut",kind=wx.ITEM_NORMAL)#三级 editMenu.Append(cutItem)#添加三级 helpMenu.Append(wx.ID_ANY,"Edit",editMenu)#二级 self.memBar.Append(helpMenu,title="帮助(H)")#一级 2.1代码结果图示列

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册
修改密码
忘记密码