hyperjumptech / monika

Monika is a command line application to monitor every part of your web app using a simple YAML configuration file. Get alert not only when your site is down but also when it's slow.
https://monika.hyperjump.tech
MIT License
605 stars 67 forks source link

Fix: Monika Multi Node #1233

Closed haricnugraha closed 9 months ago

haricnugraha commented 10 months ago

Monika Pull Request (PR)

What feature/issue does this PR add?

Implement a multi-node Monika with a probe changes mechanism to update the probe.

How did you implement / how did you fix it

The implementation checks for probe assignment data changes. If there are changes, Monika will re-fetch probe configuration data.

How to test

Run multiple instances of Monika in Symon mode. Run npm start -- --symonUrl=[symonUrl] --symonKey=[symonKey] --symonLocationId=[symonLocationId] --symon-api-version=v2 --symonGetProbesIntervalMs=5000.

Video

https://github.com/hyperjumptech/monika/assets/15191978/0ef55d5a-eb75-4472-9294-d2aeb5919f56

codecov[bot] commented 10 months ago

Codecov Report

Attention: 19 lines in your changes are missing coverage. Please review.

Comparison is base (3dc57cb) 63.71% compared to head (426bf67) 63.53%.

Files Patch % Lines
src/symon/index.ts 42.42% 16 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1233 +/- ## ========================================== - Coverage 63.71% 63.53% -0.18% ========================================== Files 111 111 Lines 3296 3302 +6 Branches 566 568 +2 ========================================== - Hits 2100 2098 -2 - Misses 1006 1015 +9 + Partials 190 189 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dennypradipta commented 10 months ago

I tried testing this PR, is it normal to have 3 locations have 3 exact probes?

image

As you can see from the terminal above, I have run each terminal with this command: npm start -- --symonUrl=http://localhost:3000 --symonKey=<key> --symonLocationId=<loc_id> --symon-api-version=v2 --symonGetProbesIntervalMs=5000

I got https://netflixtechblog.com in each instance. Symon is using feat/probe-assignment-last-updated-at branch

haricnugraha commented 10 months ago

I tried testing this PR, is it normal to have 3 locations have 3 exact probes?

image

As you can see from the terminal above, I have run each terminal with this command: npm start -- --symonUrl=http://localhost:3000 --symonKey=<key> --symonLocationId=<loc_id> --symon-api-version=v2 --symonGetProbesIntervalMs=5000

I got https://netflixtechblog.com in each instance. Symon is using feat/probe-assignment-last-updated-at branch

It looks like you are running three Monika on the same node. Symon will assume it's one Monika based on the MAC address. You can check this in the operator dashboard. This will work if you have a different node with a different MAC address or if you comment out the Symon code that separates the Monika based on their MAC addresses.