Skip to content

Commit

Permalink
Cert monitor alert structure fix (#1847)
Browse files Browse the repository at this point in the history
* Github actions implementation (#1833)

* Services alerts fix (#1835)

* Key fix in config (#1837)

* Opensearch logs introduction (#1839)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* Datetime fix (#1840)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* datetime fix

---------

Co-authored-by: Valery Geraskin <vgeraskin@naint.ru>

* Changes to alert message structure (#1842)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* datetime fix

* Changes to alert message structure

---------

Co-authored-by: Valery Geraskin <vgeraskin@naint.ru>

* Org id added to the logs (#1844)

* Opensearch introduction

* Add endpoint information to logs

* Opensearch package added

* datetime fix

* Changes to alert message structure

* Org id added to the logs

---------

Co-authored-by: Valery Geraskin <vgeraskin@naint.ru>

* Cert monitor alert structure fix (#1846)

* Cert monitor alert structure fix

* Remove endpoint

* Unit test changes

---------

Co-authored-by: Valery Geraskin <vgeraskin@naint.ru>
  • Loading branch information
Deralden and Valery Geraskin authored Aug 22, 2024
1 parent e37ed06 commit 4410757
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions service_status/monitor_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
"Team</p></div></body></html>"
CERT_EXP_EMAIL_NOTIFICATION_SUBJ = "Certificates are about to expire for service %s for %s network."
CERT_EXP_SLACK_NOTIFICATION_MSG = \
"```Alert!\n\nCertificates for service %s under organization %s for the %s network are about to expire in %s days.\n" \
"Endpoint: %s \n\nFor any queries please email at cs-marketplace@singularitynet.io. \n\nWarmest regards, " \
"\nSingularityNET Marketplace Team```"
"Certificates for service %s under organization %s for the %s network are about to expire in %s days."
NO_OF_ENDPOINT_TO_TEST_LIMIT = 5


Expand Down Expand Up @@ -160,7 +158,7 @@ def _get_certificate_expiration_email_notification_message(org_id, service_id, e

@staticmethod
def _get_certificate_expiration_slack_notification_message(org_id, service_id, endpoint, days_left_for_expiration):
return CERT_EXP_SLACK_NOTIFICATION_MSG % (service_id, org_id, NETWORK_NAME, days_left_for_expiration, endpoint)
return CERT_EXP_SLACK_NOTIFICATION_MSG % (service_id, org_id, NETWORK_NAME, days_left_for_expiration)


class MonitorServiceHealth(MonitorService):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ def test_get_certificate_expiration_slack_notification_message(self):
days_left_for_expiration = 10
response = self.monitor_service_certificate._get_certificate_expiration_slack_notification_message(
org_id=org_id, service_id=service_id, endpoint=endpoint, days_left_for_expiration=days_left_for_expiration)
assert (response == "```Alert!\n\nCertificates for service test_service_id under organization test_org_id for "
"the TEST network are about to expire in 10 days.\nEndpoint: https://dummyendpoint.com \n\n"
"For any queries please email at cs-marketplace@singularitynet.io. \n\nWarmest regards, \n"
"SingularityNET Marketplace Team```")
assert (response == "Certificates for service test_service_id under organization test_org_id for "
"the TEST network are about to expire in 10 days.")

def test_get_certificate_expiration_email_notification_message(self):
org_id = "test_org_id"
Expand Down

0 comments on commit 4410757

Please sign in to comment.