CN111273996A - 一种OpenStack环境下检测虚拟机端口状态的方法 - Google Patents

一种OpenStack环境下检测虚拟机端口状态的方法 Download PDF

Info

Publication number
CN111273996A
CN111273996A CN202010045354.3A CN202010045354A CN111273996A CN 111273996 A CN111273996 A CN 111273996A CN 202010045354 A CN202010045354 A CN 202010045354A CN 111273996 A CN111273996 A CN 111273996A
Authority
CN
China
Prior art keywords
virtual machine
port
openstack
detecting
port state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010045354.3A
Other languages
English (en)
Inventor
谢涛涛
蔡卫卫
宋伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Huimao Electronic Port Co Ltd
Original Assignee
Shandong Huimao Electronic Port Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Huimao Electronic Port Co Ltd filed Critical Shandong Huimao Electronic Port Co Ltd
Priority to CN202010045354.3A priority Critical patent/CN111273996A/zh
Publication of CN111273996A publication Critical patent/CN111273996A/zh
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Environmental & Geological Engineering (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开了一种OpenStack环境下检测虚拟机端口状态的方法,属于云计算技术领域。本发明的OpenStack环境下检测虚拟机端口状态的方法,调用OpenStack的RESTful API获取集群已运行的虚拟机及其使用的网络资源,在网络节点的Linux命名空间内对本网络中已分配的IP进行常用端口状态进行扫描,对扫描结果解析后作为监控指标存储到Prometheus,若端口状态出现异常,触发告警发送给运维人员。该发明的OpenStack环境下检测虚拟机端口状态的方法操作简单,运维人员先于客户发现问题,并提前进行解决,保证了云平台的稳定性,具有很好的推广应用价值。

Description

一种OpenStack环境下检测虚拟机端口状态的方法
技术领域
本发明涉及云计算技术领域,具体提供一种OpenStack环境下检测虚拟机端口状态的方法。
背景技术
云计算领域中,OpenStack在私有云和公有云多有建树,并已成为一种云计算的标准。随着OpenStack被各厂商越来越多地采纳,生产案例越来越多,随之带来的是其运维问题。在很多应用场景特别是政府客户的环境下,处于安全的考虑,不允许在虚拟机内部驻留agent,这样基于agent的运维方式不可行。
OpenStack支持多租户隔离,用户虚拟机运行各自的VPC网络,运维人员只能从管理层面看到虚拟机状态是运行的,无法感知到虚拟机内部运行情况。当客户发现连接不上虚拟机进行保障后,运维人员才能知晓虚拟机出现了异常,这样的话,运维工作处于被动,无法做到自主感知和解决。而客户一般通过远程登录的方式连接到各自的虚拟机,如Windows的虚拟机使用远程桌面,Linux的虚拟机使用ssh远程登录,而这些登录都是借助常见的端口,远程桌面默认使用3389或33899,ssh远程登录默认使用22端口等。通过检测这些常用端口的状态达到主动地判断虚拟机是否异常,具有重要的意义。
发明内容
本发明的技术任务是针对上述存在的问题,提供一种操作简单,运维人员先于客户发现问题,并提前进行解决,保证了云平台的稳定性,从客户使用层面,增加了对云平台的信心,对客户无侵入性的OpenStack环境下检测虚拟机端口状态的方法。
为实现上述目的,本发明提供了如下技术方案:
一种OpenStack环境下检测虚拟机端口状态的方法,该方法调用OpenStack的RESTful API获取集群已运行的虚拟机及其使用的网络资源,在网络节点的Linux命名空间内对本网络中已分配的IP进行常用端口状态进行扫描,对扫描结果解析后作为监控指标存储到Prometheus,若端口状态出现异常,触发告警发送给运维人员。
作为优选,该OpenStack环境下检测虚拟机端口状态的方法包括以下步骤:
S1、在配置文件中配置常见端口;
S2、使用管理员权限的用户调用OpenStack neutron的RESTful API获取所有端口的信息;
S3、根据端口信息的设备ID调用OpenStack nova的RESTful API获取虚拟机信息,若虚拟机状态不为AVTIVE,则跳过,若虚拟机状态为ACTIVE,则加入到需要检测虚拟机列表中,此时若列表中已存在对应记录,则跳过,不存在,则记录;
S4、判断步骤S3中所述虚拟机信息的image字段是否为空;
S5、组合步骤S2、步骤S3和步骤S4中的信息,组合成6元组的虚拟机列表;
S6、通过SSH协议远程访问OpenStack的网络节点,遍历6元组列表;
S7、判断端口状态的探测结果,如探测结果异常通过push gate way发送到Prometheus server端,并发送告警到运维人员。
作为优选,使用ini格式作为配置文件。包含Linux常用端口、Windows常用端口和Prometheus server段地址、OpenStack集群认证信息(管理员权限用户)等,使用OpenStack的python SDK实现RESTful API的调用和结果解析,使用paramiko模块实现网络节点SSH协议的远程访问,使用pyroute2库中的NetNS模块实现命名空间内部操作,使用socket模块实现端口状态的检测。
作为优选,所述端口区别于虚拟机操作***类型,Linux***配置22端口,Windows配置3389端口,将常见端口记录到内存中。
作为优选,步骤S4中,若image字段不为空,虚拟机是从镜像启动的,调用OpenStack glance的RESTful API获取镜像信息,根据镜像属性的os_type获取虚拟机操作***类型;如image字段为空,虚拟机是从volume启动的,根据volumes_attached字段中volume id调用OpenStack cinder的RESTful API获取volume信息,根据volume属性的os_type获取虚拟机操作***类型。
作为优选,步骤S5中,元素列表中的元素包括instance_id、project_id、user_id、instance_os、network_id、IP,分别代表虚拟机名、项目名、用户名、虚拟机操作***网络ID和IP地址。
作为优选,步骤S6中,根据instance_os获取需要探测的端口,通过network_id按照命名规则拼出命名空间名,在此命名空间下完成端口的探测。
作为优选,步骤S7中,发送告警到运维人员时,发送告警到alertmanager,再通过微信、邮件方式通知到运维人员。
与现有技术相比,本发明的OpenStack环境下检测虚拟机端口状态的方法具有以下突出的有益效果:所述OpenStack环境下检测虚拟机端口状态的方法操作简易、自动告警、对客户无侵入性等特点,使得运维人员先于客户发现问题,并提前进行解决,从运维和管理层面,从被动改为主动,保证了云平台的稳定性,从客户使用层面,增加了对云平台的信心,具有良好的推广应用价值。
附图说明
图1是本发明所述OpenStack环境下检测虚拟机端口状态的方法的流程图。
具体实施方式
下面将结合附图和实施例,对本发明的OpenStack环境下检测虚拟机端口状态的方法作进一步详细说明。
实施例
本发明的OpenStack环境下检测虚拟机端口状态的方法,调用OpenStack的RESTful API获取集群已运行的虚拟机及其使用的网络资源,在网络节点的Linux命名空间内对本网络中已分配的IP进行常用端口状态进行扫描,对扫描结果解析后作为监控指标存储到Prometheus,若端口状态出现异常,触发告警发送给运维人员。
如图1所示,该OpenStack环境下检测虚拟机端口状态的方法具体包括以下步骤:
S1、在配置文件中配置常见端口。
使用ini格式作为配置文件。包含Linux常用端口、Windows常用端口和Prometheusserver段地址、OpenStack集群认证信息(管理员权限用户)等,使用OpenStack的pythonSDK实现RESTful API的调用和结果解析,使用paramiko模块实现网络节点SSH协议的远程访问,使用pyroute2库中的NetNS模块实现命名空间内部操作,使用socket模块实现端口状态的检测。
所述端口区别于虚拟机操作***类型,Linux***配置22端口,Windows配置3389端口,将常见端口记录到内存中。
S2、使用管理员权限的用户调用OpenStack neutron的RESTful API获取所有端口的信息。
S3、根据端口信息的设备ID调用OpenStack nova的RESTful API获取虚拟机信息,若虚拟机状态不为AVTIVE,则跳过,若虚拟机状态为ACTIVE,则加入到需要检测虚拟机列表中,此时若列表中已存在对应记录,则跳过,不存在,则记录。
S4、判断步骤S3中所述虚拟机信息的image字段是否为空。
若image字段不为空,虚拟机是从镜像启动的,调用OpenStack glance的RESTfulAPI获取镜像信息,根据镜像属性的os_type获取虚拟机操作***类型;如image字段为空,虚拟机是从volume启动的,根据volumes_attached字段中volume id调用OpenStackcinder的RESTful API获取volume信息,根据volume属性的os_type获取虚拟机操作***类型。
S5、组合步骤S2、步骤S3和步骤S4中的信息,组合成6元组的虚拟机列表。
元素列表中的元素包括instance_id、project_id、user_id、instance_os、network_id、IP,分别代表虚拟机名、项目名、用户名、虚拟机操作***网络ID和IP地址。
S6、通过SSH协议远程访问OpenStack的网络节点,遍历6元组列表。
根据instance_os获取需要探测的端口,通过network_id按照命名规则拼出命名空间名,在此命名空间下完成端口的探测。
S7、判断端口状态的探测结果,如探测结果异常通过push gate way发送到Prometheus server端,并发送告警到运维人员。
发送告警到运维人员时,发送告警到alertmanager,再通过微信、邮件方式通知到运维人员。
该方法通过crontab实现定期执行,当需要增删常用端口时,可将定时任务暂时关闭,修改配置文件,再使用crontab启动任务。
本发明中推送到Prometheus server端的监控指标格式为status{instance_id=<instance_id>,project_id=<project_id>,user_id=<user_id>,instance_os=<instance_os>,network_id=<network_id>,IP=<IP>},0为正常,1为异常。
以上所述的实施例,只是本发明较优选的具体实施方式,本领域的技术人员在本发明技术方案范围内进行的通常变化和替换都应包含在本发明的保护范围内。

Claims (8)

1.一种OpenStack环境下检测虚拟机端口状态的方法,其特征在于:该方法调用OpenStack的RESTful API获取集群已运行的虚拟机及其使用的网络资源,在网络节点的Linux命名空间内对本网络中已分配的IP进行常用端口状态进行扫描,对扫描结果解析后作为监控指标存储到Prometheus,若端口状态出现异常,触发告警发送给运维人员。
2.根据权利要求1所述的OpenStack环境下检测虚拟机端口状态的方法,其特征在于:该方法包括以下步骤:
S1、在配置文件中配置常见端口;
S2、使用管理员权限的用户调用OpenStack neutron的RESTfulAPI获取所有端口的信息;
S3、根据端口信息的设备ID调用OpenStack nova的RESTfulAPI获取虚拟机信息,若虚拟机状态不为AVTIVE,则跳过,若虚拟机状态为ACTIVE,则加入到需要检测虚拟机列表中,此时若列表中已存在对应记录,则跳过,不存在,则记录;
S4、判断步骤S3中所述虚拟机信息的image字段是否为空;
S5、组合步骤S2、步骤S3和步骤S4中的信息,组合成6元组的虚拟机列表;
S6、通过SSH协议远程访问OpenStack的网络节点,遍历6元组列表;
S7、判断端口状态的探测结果,如探测结果异常通过push gate way发送到Prometheusserver端,并发送告警到运维人员。
3.根据权利要求2所述的OpenStack环境下检测虚拟机端口状态的方法,其特征在于:使用ini格式作为配置文件。
4.根据权利要求3所述的OpenStack环境下检测虚拟机端口状态的方法,其特征在于:所述端口区别于虚拟机操作***类型,Linux***配置22端口,Windows配置3389端口,将常见端口记录到内存中。
5.根据权利要求4所述的OpenStack环境下检测虚拟机端口状态的方法,其特征在于:步骤S4中,若image字段不为空,虚拟机是从镜像启动的,调用OpenStack glance的RESTfulAPI获取镜像信息,根据镜像属性的os_type获取虚拟机操作***类型;如image字段为空,虚拟机是从volume启动的,根据volumes_attached字段中volume id调用OpenStackcinder的RESTful API获取volume信息,根据volume属性的os_type获取虚拟机操作***类型。
6.根据权利要求5所述的OpenStack环境下检测虚拟机端口状态的方法,其特征在于:步骤S5中,元素列表中的元素包括instance_id、project_id、user_id、instance_os、network_id、IP,分别代表虚拟机名、项目名、用户名、虚拟机操作***网络ID和IP地址。
7.根据权利要求6所述的OpenStack环境下检测虚拟机端口状态的方法,其特征在于:步骤S6中,根据instance_os获取需要探测的端口,通过network_id按照命名规则拼出命名空间名,在此命名空间下完成端口的探测。
8.根据权利要求7所述的OpenStack环境下检测虚拟机端口状态的方法,其特征在于:步骤S7中,发送告警到运维人员时,发送告警到alertmanager,再通过微信、邮件方式通知到运维人员。
CN202010045354.3A 2020-01-16 2020-01-16 一种OpenStack环境下检测虚拟机端口状态的方法 Pending CN111273996A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010045354.3A CN111273996A (zh) 2020-01-16 2020-01-16 一种OpenStack环境下检测虚拟机端口状态的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010045354.3A CN111273996A (zh) 2020-01-16 2020-01-16 一种OpenStack环境下检测虚拟机端口状态的方法

Publications (1)

Publication Number Publication Date
CN111273996A true CN111273996A (zh) 2020-06-12

Family

ID=70997131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010045354.3A Pending CN111273996A (zh) 2020-01-16 2020-01-16 一种OpenStack环境下检测虚拟机端口状态的方法

Country Status (1)

Country Link
CN (1) CN111273996A (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347519A (zh) * 2020-10-28 2021-02-09 河南信大网御科技有限公司 一种拟态OpenStack组件和拟态OpenStack云平台

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106789407A (zh) * 2016-12-05 2017-05-31 国云科技股份有限公司 一种云平台检查虚拟机连接状态的方法
CN108009428A (zh) * 2017-11-30 2018-05-08 郑州云海信息技术有限公司 一种针对openstack的安全配置检测方法
CN109412831A (zh) * 2018-08-29 2019-03-01 无锡华云数据技术服务有限公司 一种基于fsm管理虚拟端口的方法及云平台
CN110659109A (zh) * 2019-09-26 2020-01-07 上海仪电(集团)有限公司中央研究院 一种openstack集群虚拟机监控***及方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106789407A (zh) * 2016-12-05 2017-05-31 国云科技股份有限公司 一种云平台检查虚拟机连接状态的方法
CN108009428A (zh) * 2017-11-30 2018-05-08 郑州云海信息技术有限公司 一种针对openstack的安全配置检测方法
CN109412831A (zh) * 2018-08-29 2019-03-01 无锡华云数据技术服务有限公司 一种基于fsm管理虚拟端口的方法及云平台
CN110659109A (zh) * 2019-09-26 2020-01-07 上海仪电(集团)有限公司中央研究院 一种openstack集群虚拟机监控***及方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347519A (zh) * 2020-10-28 2021-02-09 河南信大网御科技有限公司 一种拟态OpenStack组件和拟态OpenStack云平台

Similar Documents

Publication Publication Date Title
US11909598B2 (en) Component detection and management using relationships
CN104125197B (zh) 一种安全基线***及其实现安全检查的方法
US6052724A (en) Method and system for managing a directory service
US7401338B1 (en) System and method for an access layer application programming interface for managing heterogeneous components of a storage area network
US6253243B1 (en) Automated trap control for a distributed network management system
US8510446B1 (en) Dynamically populating an identity-correlation data store
US20150370848A1 (en) System and method for managing data integrity in electronic data storage
US11647027B2 (en) Method for verifying security technology deployment efficacy across a computer network
CN113424157A (zh) IoT设备行为的多维周期性检测
US20020178243A1 (en) Apparatus and method for centrally managing network devices
US20140337471A1 (en) Migration assist system and migration assist method
CN112804377B (zh) 数据查询方法、电子设备、服务器、存储设备和网关设备
CN111273996A (zh) 一种OpenStack环境下检测虚拟机端口状态的方法
US7502847B2 (en) Method of providing views of a managed network that uses network address translation
US20220014415A1 (en) Deriving network device and host connection
WO2023207175A1 (zh) 混合云环境下的扫描探测方法、装置、***、设备和介质
CN116016197A (zh) 网络拓扑结构的发现方法、装置、存储介质及电子设备
Jukić et al. Fault management API for SNMP agents
US11238020B2 (en) Maintaining temporal associations for event data in an event database
Cisco The Polling Agent Database
Cisco The Polling Agent Database
Cisco The Polling Agent Database
Cisco The Polling Agent Database
Cisco The Polling Agent Database
CN112187737A (zh) 一种PaaS容器云平台环境下的结合WAF的防护方法

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200612

RJ01 Rejection of invention patent application after publication