Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate monitor.sh #42

Open
bennlich opened this issue Jan 18, 2019 · 5 comments
Open

deprecate monitor.sh #42

bennlich opened this issue Jan 18, 2019 · 5 comments
Labels
good first issue Good for newcomers technical debt The sooner we fix this the better

Comments

@bennlich
Copy link
Collaborator

bennlich commented Jan 18, 2019

monitor.sh is a simple and lovely script that reduces the output of ip route into two numbers: a count of unique routes and a count of unique gateways, and POSTs this info to the monitor server. Exitnodes run this script periodically in a cron job.

Ever since we started publishing entire routing tables with the post-routing-table.sh script, monitor.sh became redundant. With access to the entire list of routes, the server can calculate the two counts on its own.

This work overlaps #41 a bit--getMonitorUpdates() can be modified to fetch the most recent logs from mongo (instead of fetching the memcache key).

cc @thedig -- might be a good issue for you if you're interested cause it touches the exitnode repo too.

@ghost
Copy link

ghost commented Jun 11, 2019

https://github.com/sudomesh/monitor/blob/master/post-routing-table.sh is a regular post request.
https://github.com/sudomesh/monitor/blob/master/monitor.sh is a json request.

The json request is incompatible with the regular post request. https://github.com/sudomesh/monitor/blob/master/src/app.js needs to be changed so the same post url can be accepted, the same content header text/plain or application/json, and the post data needs to be by parameters or a new key/value pair inside app.js.

@bennlich
Copy link
Collaborator Author

@jnull I was thinking we should just obliterate https://github.com/sudomesh/monitor/blob/master/monitor.sh altogether.

The current situation in app.js looks something like this in pseudocode:

function receiveCounts(numGatewaysAndRoutes) {
  saveNumGatewaysAndRoutes(numGatewaysAndRoutes);
}

function receiveRouteTable(routes) {
  saveRoutes(routes);
}

monitor.sh hits receiveCounts and post-routing-table.sh hits receiveRouteTable. (Note that these are not the real names in the code. In app.js, receiveCounts is https://github.com/sudomesh/monitor/blob/master/src/app.js#L122-L137 and receiveRoutes is https://github.com/sudomesh/monitor/blob/master/src/app.js#L144-L216.)

I'm thinking we should simplify the exitnodes and stop sending counts. We only need to send routes. We would change the monitor logic to something like:

function receiveRouteTable(routes) {
  numGatewaysAndRoutes = countGatewaysAndRoutes(routes);
  saveNumGatewaysAndRoutes(numGatewaysAndRoutes);
  saveRoutes(routes);
}

How's that?

@ghost
Copy link

ghost commented Jun 12, 2019

So i understand, you don't think we need these two fields for each exit node: `Screen Shot 2019-06-12 at 16 15 35

@eenblam
Copy link
Contributor

eenblam commented Jun 13, 2019 via email

@ghost
Copy link

ghost commented Jun 13, 2019

i ran $DATA from https://github.com/sudomesh/monitor/blob/master/post-routing-table.sh:

root@hurricane:/home/null# (ip route | grep via | grep -v default | awk '{print $1 "," $3 }' | sort | uniq | tr '\n' '|')
100.65.0.0/26,100.65.0.1|100.65.0.64/26,100.65.0.65|100.65.127.128/26,100.65.127.129|100.65.127.130,100.65.127.129|100.65.127.131,100.65.127.129|100.65.127.192/26,100.65.127.193|100.65.131.192/26,100.65.131.193|100.65.132.64/26,100.65.132.65|100.65.134.192/26,100.65.134.193|100.65.137.192/26,100.65.137.193|100.65.139.128/26,100.65.132.65|100.65.142.0/26,100.65.142.1|100.65.142.192/26,100.65.142.1|100.65.143.0/26,100.65.143.1|100.65.144.64/26,100.65.143.1|100.65.145.128/26,100.65.145.129|100.65.146.128/26,100.65.146.129|100.65.146.131,100.65.146.129|100.65.146.64/26,100.65.146.65|100.65.146.66,100.65.146.65|100.65.148.0/26,100.65.148.1|100.65.148.64/26,100.65.148.65|100.65.17.192/26,100.65.17.193|100.65.24.0/26,100.65.24.1|100.65.91.64/26,100.65.91.65|100.65.95.64/26,100.65.95.65|100.65.96.64/26,100.65.96.65|100.65.98.0/26,100.65.98.1|100.65.98.2,100.65.98.1|100.65.99.64/26,100.65.99.65|100.65.99.66,100.65.99.65|

I'm guessing gateways are all ending octect is .1 and everything else between | is a node? and comma separates routes?

@bennlich bennlich added the technical debt The sooner we fix this the better label Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers technical debt The sooner we fix this the better
Projects
None yet
Development

No branches or pull requests

2 participants