Skip to content

Commit 96ff6ea

Browse files
authored
Merge pull request #356 from spiderxm/sentry-monitoring
add sentry monitoring
2 parents 0d78036 + a113c3c commit 96ff6ea

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

config.py

+21
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,24 @@ def user_configuration():
105105
"default_selected_modules": "all", # or select one or multiple (e.g. ftp/strong_password,ssh/strong_password)
106106
"default_excluded_modules": None # or any module name separated with comma
107107
}
108+
109+
110+
def sentry_configuration() -> dict:
111+
"""
112+
sentry configuration
113+
114+
Returns:
115+
JSON/Dict sentry configuration
116+
"""
117+
return {
118+
"sentry_monitoring": False,
119+
# Enter your Sentry Project URL here.
120+
"sentry_dsn_url": "",
121+
# Enter Trace Rate Here.
122+
"sentry_trace_rate": 1
123+
# Set sentry_trace_rate to 1.0 to capture 100%
124+
# of transactions for performance monitoring.
125+
# sentry_trace_rate is ratio of errors being
126+
# reported to the number of issues which arise.
127+
128+
}

ohp.py

+9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22
# -*- coding: utf-8 -*-
33

44
import sys
5+
6+
from config import sentry_configuration
57
from core.load import load_honeypot_engine
8+
import sentry_sdk
69

710
if __name__ == "__main__":
11+
config = sentry_configuration()
12+
if config["sentry_monitoring"]:
13+
sentry_sdk.init(
14+
dsn=config["sentry_dsn_url"],
15+
traces_sample_rate=config["sentry_trace_rate"],
16+
)
817
sys.exit(0 if load_honeypot_engine() is True else 1)

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ oschmod==0.3.12
99
argparse==1.4.0
1010
PyYAML==5.4.1 # library_name=yaml
1111
flask-swagger==0.2.14 # library_name=flask_swagger
12-
flask-swagger-ui==3.36.0 # library_name=flask_swagger_ui
12+
flask-swagger-ui==3.36.0 # library_name=flask_swagger_ui
13+
sentry-sdk==1.6.0 # library_name=sentry_sdk

0 commit comments

Comments
 (0)