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
8b5df667
Commit
8b5df667
authored
Dec 19, 2019
by
sanshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
最新告警
parent
95905957
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
163 additions
and
39 deletions
+163
-39
__init__.py
WorkApi/APP/LatestWarning/__init__.py
+0
-0
latestWarning_acknowledge_eventid.py
...pi/APP/LatestWarning/latestWarning_acknowledge_eventid.py
+41
-0
latestWarning_get.py
WorkApi/APP/LatestWarning/latestWarning_get.py
+60
-0
latestWarning_ignore_eventid.py
WorkApi/APP/LatestWarning/latestWarning_ignore_eventid.py
+41
-0
__init__.py
WorkCase/__init__.py
+18
-38
problem.py
WorkData/Argus/problem.py
+3
-1
No files found.
Work
Case/API/HostInterface
/__init__.py
→
Work
Api/APP/LatestWarning
/__init__.py
View file @
8b5df667
File moved
WorkApi/APP/LatestWarning/latestWarning_acknowledge_eventid.py
0 → 100644
View file @
8b5df667
# -*- coding: utf-8 -*-
# 确认告警
# 作者: 陈磊
# 时间: 2019-12-10
from
WorkUtils.UtilsRequest
import
UtilsRequest
from
WorkUtils.UtilsLog
import
UtilsLog
from
WorkApi.ApiBase
import
ApiBase
,
GetBase
class
LatestWarningAcknowledgeEventid
(
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
=
"/latestWarning/acknowledge/"
self
.
_url
=
self
.
_host
+
self
.
_path
self
.
_params
=
{}
self
.
_json
=
{}
self
.
_data
=
{}
self
.
response
=
""
self
.
token
=
{}
self
.
eventid
=
None
self
.
api
=
UtilsRequest
()
def
get_response
(
self
):
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"token"
,
value
=
self
.
token
)
self
.
_headers
=
base
.
_json
self
.
_url
=
self
.
_url
+
str
(
self
.
eventid
)
self
.
response
=
self
.
api
.
get
(
url
=
self
.
_url
,
headers
=
self
.
_headers
)
WorkApi/APP/LatestWarning/latestWarning_get.py
0 → 100644
View file @
8b5df667
# -*- coding: utf-8 -*-
# 查询最新告警列表
# 作者: 陈磊
# 时间: 2019-12-10
from
WorkUtils.UtilsRequest
import
UtilsRequest
from
WorkUtils.UtilsLog
import
UtilsLog
from
WorkApi.ApiBase
import
ApiBase
,
GetBase
class
LatestWarningGet
(
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
=
"/latestWarning/get"
self
.
_url
=
self
.
_host
+
self
.
_path
self
.
_params
=
{}
self
.
_json
=
{}
self
.
_data
=
{}
self
.
response
=
""
self
.
token
=
None
self
.
severity
=
None
self
.
manageLevel
=
None
self
.
acknowledged
=
None
self
.
dateFrom
=
None
self
.
dateTo
=
None
self
.
hostType
=
None
self
.
hostName
=
None
self
.
alarmRuleid
=
None
self
.
experienceid
=
None
self
.
businessid
=
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
=
"severity"
,
value
=
self
.
severity
)
base
.
dict_add_key
(
_key
=
"manageLevel"
,
value
=
self
.
manageLevel
)
base
.
dict_add_key
(
_key
=
"acknowledged"
,
value
=
self
.
acknowledged
)
base
.
dict_add_key
(
_key
=
"dateFrom"
,
value
=
self
.
dateFrom
)
base
.
dict_add_key
(
_key
=
"dateTo"
,
value
=
self
.
dateTo
)
base
.
dict_add_key
(
_key
=
"hostType"
,
value
=
self
.
hostType
)
base
.
dict_add_key
(
_key
=
"hostName"
,
value
=
self
.
hostName
)
base
.
dict_add_key
(
_key
=
"alarmRuleid"
,
value
=
self
.
alarmRuleid
)
base
.
dict_add_key
(
_key
=
"experienceid"
,
value
=
self
.
experienceid
)
base
.
dict_add_key
(
_key
=
"businessid"
,
value
=
self
.
businessid
)
self
.
_params
=
base
.
_json
self
.
response
=
self
.
api
.
get
(
url
=
self
.
_url
,
headers
=
self
.
_headers
,
params
=
self
.
_params
)
WorkApi/APP/LatestWarning/latestWarning_ignore_eventid.py
0 → 100644
View file @
8b5df667
# -*- coding: utf-8 -*-
# 忽略告警
# 作者: 陈磊
# 时间: 2019-12-10
from
WorkUtils.UtilsRequest
import
UtilsRequest
from
WorkUtils.UtilsLog
import
UtilsLog
from
WorkApi.ApiBase
import
ApiBase
,
GetBase
class
LatestWarningIgnoreEventid
(
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
=
"/latestWarning/ignore/"
self
.
_url
=
self
.
_host
+
self
.
_path
self
.
_params
=
{}
self
.
_json
=
{}
self
.
_data
=
{}
self
.
response
=
""
self
.
token
=
{}
self
.
eventid
=
None
self
.
api
=
UtilsRequest
()
def
get_response
(
self
):
base
=
ApiBase
()
base
.
dict_add_key
(
_key
=
"token"
,
value
=
self
.
token
)
self
.
_headers
=
base
.
_json
self
.
_url
=
self
.
_url
+
str
(
self
.
eventid
)
self
.
response
=
self
.
api
.
get
(
url
=
self
.
_url
,
headers
=
self
.
_headers
)
WorkCase/__init__.py
View file @
8b5df667
...
@@ -7,26 +7,11 @@
...
@@ -7,26 +7,11 @@
class
CaseBase
:
class
CaseBase
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
environment
=
{
# "host": "http://10.0.0.12:7070",
"db_url"
:
"172.16.2.153"
,
"db_port"
:
3306
,
"db_user"
:
"zmops"
,
"db_pw"
:
"0VMoH
%
W7|h"
,
"db_base"
:
"zabbix"
,
"host"
:
"http://172.16.3.197:7070"
,
# "db_url": "172.16.2.155",
# "db_port": 3306,
# "db_user": "root",
# "db_pw": "123456",
# "db_base": "zabbix"
}
self
.
app_environment
=
{
self
.
app_environment
=
{
# 阿蒙
# 阿蒙
# "host": "http://172.16.3.25:3334
",
"host"
:
"http://172.16.3.25:3334/api
"
,
# 东方
# 东方
"host"
:
"http://172.16.3.78:3334/api"
,
#
"host": "http://172.16.3.78:3334/api",
"db_url"
:
"172.16.2.155"
,
"db_url"
:
"172.16.2.155"
,
"db_port"
:
3306
,
"db_port"
:
3306
,
"db_user"
:
"root"
,
"db_user"
:
"root"
,
...
@@ -46,13 +31,20 @@ class CaseBase:
...
@@ -46,13 +31,20 @@ class CaseBase:
# "db_base": "zabbix",
# "db_base": "zabbix",
}
}
self
.
app_environment_ho
st
=
{
self
.
environment_te
st
=
{
"host"
:
"http://
172.16.3.78:3334
"
,
"host"
:
"http://
client.argus.zmops.cn/api
"
,
"db_url"
:
"
172.16.2.155
"
,
"db_url"
:
"
47.110.118.218
"
,
"db_port"
:
3306
,
"db_port"
:
2
3306
,
"db_user"
:
"
root
"
,
"db_user"
:
"
argus
"
,
"db_pw"
:
"
123456
"
,
"db_pw"
:
"
Argus@2019
"
,
"db_base"
:
"argus"
,
"db_base"
:
"argus"
,
"host_zabbix"
:
"http://api.argus.zmops.cn"
,
# "host_zabbix": "http://172.16.3.197:7070",
"db_url_zabbix"
:
"172.16.2.153"
,
"db_port_zabbix"
:
3306
,
"db_user_zabbix"
:
"zmops"
,
"db_pw_zabbix"
:
"0VMoH
%
W7|h"
,
"db_base_zabbix"
:
"zabbix"
"db_base_zabbix"
:
"zabbix"
}
}
...
@@ -71,19 +63,7 @@ class CaseBase:
...
@@ -71,19 +63,7 @@ class CaseBase:
"OFF"
:
1
"OFF"
:
1
}
}
self
.
environment_test
=
{
self
.
acknowledged
=
{
"host"
:
"http://client.argus.zmops.cn/api"
,
"ON"
:
1
,
"db_url"
:
"47.110.118.218"
,
"OFF"
:
0
"db_port"
:
23306
,
"db_user"
:
"argus"
,
"db_pw"
:
"Argus@2019"
,
"db_base"
:
"argus"
,
"host_zabbix"
:
"http://api.argus.zmops.cn"
,
# "host_zabbix": "http://172.16.3.197:7070",
"db_url_zabbix"
:
"172.16.2.153"
,
"db_port_zabbix"
:
3306
,
"db_user_zabbix"
:
"zmops"
,
"db_pw_zabbix"
:
"0VMoH
%
W7|h"
,
"db_base_zabbix"
:
"zabbix"
}
}
WorkData/Argus/problem.py
View file @
8b5df667
...
@@ -51,9 +51,10 @@ class DataProblem(object):
...
@@ -51,9 +51,10 @@ class DataProblem(object):
self
.
table
=
Problem
self
.
table
=
Problem
def
select_all_from_allKeys
(
self
,
session
,
hostid
=
None
,
host_name
=
None
,
available
=
None
,
monitor_status
=
None
):
def
select_all_from_allKeys
(
self
,
session
,
eventid
=
None
,
hostid
=
None
,
host_name
=
None
,
available
=
None
,
monitor_status
=
None
):
"""
"""
:param session: 指针
:param session: 指针
:param eventid:
:param hostid:
:param hostid:
:param host_name:
:param host_name:
:param available:
:param available:
...
@@ -63,6 +64,7 @@ class DataProblem(object):
...
@@ -63,6 +64,7 @@ class DataProblem(object):
self
.
log
.
debug
(
"查询数据库:"
)
self
.
log
.
debug
(
"查询数据库:"
)
try
:
try
:
base
=
UtilsDataBase
()
base
=
UtilsDataBase
()
base
.
add_param
(
_key
=
"eventid"
,
value
=
eventid
)
base
.
add_param
(
_key
=
"hostid"
,
value
=
hostid
)
base
.
add_param
(
_key
=
"hostid"
,
value
=
hostid
)
base
.
add_param
(
_key
=
"host_name"
,
value
=
host_name
)
base
.
add_param
(
_key
=
"host_name"
,
value
=
host_name
)
base
.
add_param
(
_key
=
"available"
,
value
=
available
)
base
.
add_param
(
_key
=
"available"
,
value
=
available
)
...
...
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