Skip to content

Commit

Permalink
Merge pull request #356 from spiderxm/sentry-monitoring
Browse files Browse the repository at this point in the history
add sentry monitoring
  • Loading branch information
spiderxm authored Sep 17, 2022
2 parents 0d78036 + a113c3c commit 96ff6ea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
21 changes: 21 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,24 @@ def user_configuration():
"default_selected_modules": "all", # or select one or multiple (e.g. ftp/strong_password,ssh/strong_password)
"default_excluded_modules": None # or any module name separated with comma
}


def sentry_configuration() -> dict:
"""
sentry configuration
Returns:
JSON/Dict sentry configuration
"""
return {
"sentry_monitoring": False,
# Enter your Sentry Project URL here.
"sentry_dsn_url": "",
# Enter Trace Rate Here.
"sentry_trace_rate": 1
# Set sentry_trace_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# sentry_trace_rate is ratio of errors being
# reported to the number of issues which arise.

}
9 changes: 9 additions & 0 deletions ohp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
# -*- coding: utf-8 -*-

import sys

from config import sentry_configuration
from core.load import load_honeypot_engine
import sentry_sdk

if __name__ == "__main__":
config = sentry_configuration()
if config["sentry_monitoring"]:
sentry_sdk.init(
dsn=config["sentry_dsn_url"],
traces_sample_rate=config["sentry_trace_rate"],
)
sys.exit(0 if load_honeypot_engine() is True else 1)
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ oschmod==0.3.12
argparse==1.4.0
PyYAML==5.4.1 # library_name=yaml
flask-swagger==0.2.14 # library_name=flask_swagger
flask-swagger-ui==3.36.0 # library_name=flask_swagger_ui
flask-swagger-ui==3.36.0 # library_name=flask_swagger_ui
sentry-sdk==1.6.0 # library_name=sentry_sdk

0 comments on commit 96ff6ea

Please sign in to comment.