Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zmops-test
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sanshi
zmops-test
Commits
8e4c184d
Commit
8e4c184d
authored
Dec 17, 2019
by
sanshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动发现
parent
589bd25a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
186 additions
and
0 deletions
+186
-0
__init__.py
WorkApi/APP/HostsDiscovery/__init__.py
+0
-0
hostsdiscovery_create.py
WorkApi/APP/HostsDiscovery/hostsdiscovery_create.py
+90
-0
hostsdiscovery_get.py
WorkApi/APP/HostsDiscovery/hostsdiscovery_get.py
+53
-0
hostsdiscovery_ignore.py
WorkApi/APP/HostsDiscovery/hostsdiscovery_ignore.py
+43
-0
No files found.
WorkApi/APP/HostsDiscovery/__init__.py
0 → 100644
View file @
8e4c184d
WorkApi/APP/HostsDiscovery/hostsdiscovery_create.py
0 → 100644
View file @
8e4c184d
# -*- coding: utf-8 -*-
# 自动发现资产确认
# 作者: 陈磊
# 时间: 2019-12-11
from
WorkUtils.UtilsRequest
import
UtilsRequest
from
WorkUtils.UtilsLog
import
UtilsLog
from
WorkApi.ApiBase
import
ApiBase
,
GetBase
class
HostsDiscoveryCreate
(
object
):
def
__init__
(
self
,
_host
):
"""
:param _host: 域名
:return:
"""
self
.
log
=
UtilsLog
()
self
.
log
.
info
(
"调用自动发现资产确认"
)
self
.
log
.
info
(
self
.
__class__
)
self
.
_host
=
_host
self
.
_headers
=
{}
self
.
_path
=
"/hostdiscovery/create"
self
.
_url
=
self
.
_host
+
self
.
_path
self
.
_params
=
{}
self
.
_json
=
{}
self
.
_data
=
{}
self
.
response
=
""
self
.
token
=
{}
self
.
hostid
=
None
self
.
hostName
=
None
self
.
hostType
=
None
self
.
manageLevel
=
None
self
.
iplist
=
None
self
.
port
=
None
self
.
dns
=
None
self
.
monitorInterface
=
None
self
.
monitorType
=
None
self
.
parentHost
=
None
self
.
businessIds
=
None
self
.
businessTree
=
None
self
.
opsPerson
=
None
self
.
snmpCommunity
=
None
self
.
ipmiAuthtype
=
None
self
.
ipmiPrivilege
=
None
self
.
ipmiUsername
=
None
self
.
ipmiPassword
=
None
self
.
factoryId
=
None
self
.
model
=
None
self
.
version
=
None
self
.
serialnumber
=
None
self
.
description
=
None
self
.
monitorStatus
=
None
self
.
api
=
UtilsRequest
()
def
get_response
(
self
):
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"token"
,
value
=
self
.
token
)
self
.
_headers
=
base
.
_json
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"hostid"
,
value
=
self
.
hostid
)
base
.
dict_add_key
(
_key
=
"hostName"
,
value
=
self
.
hostName
)
base
.
dict_add_key
(
_key
=
"hostType"
,
value
=
self
.
hostType
)
base
.
dict_add_key
(
_key
=
"manageLevel"
,
value
=
self
.
manageLevel
)
base
.
dict_add_key
(
_key
=
"iplist"
,
value
=
self
.
iplist
)
base
.
dict_add_key
(
_key
=
"port"
,
value
=
self
.
port
)
base
.
dict_add_key
(
_key
=
"dns"
,
value
=
self
.
dns
)
base
.
dict_add_key
(
_key
=
"monitorInterface"
,
value
=
self
.
monitorInterface
)
base
.
dict_add_key
(
_key
=
"monitorType"
,
value
=
self
.
monitorType
)
base
.
dict_add_key
(
_key
=
"parentHost"
,
value
=
self
.
parentHost
)
base
.
dict_add_key
(
_key
=
"businessIds"
,
value
=
self
.
businessIds
)
base
.
dict_add_key
(
_key
=
"businessTree"
,
value
=
self
.
businessTree
)
base
.
dict_add_key
(
_key
=
"opsPerson"
,
value
=
self
.
opsPerson
)
base
.
dict_add_key
(
_key
=
"snmpCommunity"
,
value
=
self
.
snmpCommunity
)
base
.
dict_add_key
(
_key
=
"ipmiAuthtype"
,
value
=
self
.
ipmiAuthtype
)
base
.
dict_add_key
(
_key
=
"ipmiPrivilege"
,
value
=
self
.
ipmiPrivilege
)
base
.
dict_add_key
(
_key
=
"ipmiUsername"
,
value
=
self
.
ipmiUsername
)
base
.
dict_add_key
(
_key
=
"ipmiPassword"
,
value
=
self
.
ipmiPassword
)
base
.
dict_add_key
(
_key
=
"factoryId"
,
value
=
self
.
factoryId
)
base
.
dict_add_key
(
_key
=
"model"
,
value
=
self
.
model
)
base
.
dict_add_key
(
_key
=
"version"
,
value
=
self
.
version
)
base
.
dict_add_key
(
_key
=
"serialnumber"
,
value
=
self
.
serialnumber
)
base
.
dict_add_key
(
_key
=
"description"
,
value
=
self
.
description
)
base
.
dict_add_key
(
_key
=
"monitorStatus"
,
value
=
self
.
monitorStatus
)
self
.
_json
=
base
.
_json
self
.
response
=
self
.
api
.
post
(
url
=
self
.
_url
,
headers
=
self
.
_headers
,
json
=
self
.
_json
)
WorkApi/APP/HostsDiscovery/hostsdiscovery_get.py
0 → 100644
View file @
8e4c184d
# -*- coding: utf-8 -*-
# 查询自动发现列表
# 作者: 陈磊
# 时间: 2019-12-11
from
WorkUtils.UtilsRequest
import
UtilsRequest
from
WorkUtils.UtilsLog
import
UtilsLog
from
WorkApi.ApiBase
import
ApiBase
,
GetBase
class
HostsDiscoveryGet
(
object
):
def
__init__
(
self
,
_host
):
"""
:param _host: 域名
:return:
"""
self
.
log
=
UtilsLog
()
self
.
log
.
info
(
"调用查询自动发现列表"
)
self
.
log
.
info
(
self
.
__class__
)
self
.
_host
=
_host
self
.
_headers
=
{}
self
.
_path
=
"/hostdiscovery/get"
self
.
_url
=
self
.
_host
+
self
.
_path
self
.
_params
=
{}
self
.
_json
=
{}
self
.
_data
=
{}
self
.
response
=
""
self
.
token
=
{}
self
.
name
=
None
self
.
status
=
None
self
.
available
=
None
self
.
manageIp
=
None
self
.
beginTime
=
None
self
.
endTime
=
None
self
.
api
=
UtilsRequest
()
def
get_response
(
self
):
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"token"
,
value
=
self
.
token
)
self
.
_headers
=
base
.
_json
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"name"
,
value
=
self
.
name
)
base
.
dict_add_key
(
_key
=
"status"
,
value
=
self
.
status
)
base
.
dict_add_key
(
_key
=
"available"
,
value
=
self
.
available
)
base
.
dict_add_key
(
_key
=
"manageIp"
,
value
=
self
.
manageIp
)
base
.
dict_add_key
(
_key
=
"beginTime"
,
value
=
self
.
beginTime
)
base
.
dict_add_key
(
_key
=
"endTime"
,
value
=
self
.
endTime
)
self
.
_params
=
base
.
_json
self
.
response
=
self
.
api
.
get
(
url
=
self
.
_url
,
headers
=
self
.
_headers
,
params
=
self
.
_params
)
WorkApi/APP/HostsDiscovery/hostsdiscovery_ignore.py
0 → 100644
View file @
8e4c184d
# -*- coding: utf-8 -*-
# 查询自动发现批量忽略
# 作者: 陈磊
# 时间: 2019-12-11
from
WorkUtils.UtilsRequest
import
UtilsRequest
from
WorkUtils.UtilsLog
import
UtilsLog
from
WorkApi.ApiBase
import
ApiBase
,
GetBase
class
HostsDiscoveryIgnore
(
object
):
def
__init__
(
self
,
_host
):
"""
:param _host: 域名
:return:
"""
self
.
log
=
UtilsLog
()
self
.
log
.
info
(
"调用查询自动发现批量忽略"
)
self
.
log
.
info
(
self
.
__class__
)
self
.
_host
=
_host
self
.
_headers
=
{}
self
.
_path
=
"/hostdiscovery/ignore"
self
.
_url
=
self
.
_host
+
self
.
_path
self
.
_params
=
{}
self
.
_json
=
{}
self
.
_data
=
{}
self
.
response
=
""
self
.
token
=
{}
self
.
hostids
=
None
self
.
api
=
UtilsRequest
()
def
get_response
(
self
):
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"token"
,
value
=
self
.
token
)
self
.
_headers
=
base
.
_json
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"hostids"
,
value
=
self
.
hostids
)
self
.
_json
=
base
.
_json
self
.
response
=
self
.
api
.
post
(
url
=
self
.
_url
,
headers
=
self
.
_headers
,
json
=
self
.
_json
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment