romankuchin / ica0002-2024

16 stars 5 forks source link

08-logging: unnecessary HTTP traffic because of empty VM name #18

Open ukusormus opened 2 weeks ago

ukusormus commented 2 weeks ago

tldr: because nginx runs on both VM-s and some people haven't blocked the / path for the non-webserver VM, there will be "welcome to nginx" page that returns HTTP response status 200 - that signals to the agama-client script that it's ok to continue, and it tries to get the VM name from the page (ends up with empty string) and send that to influxdb. influxdb doesn't like that, returns 400 (my influxdb logs had relatively many of these failed requests). (+ extra POST to non-existent agama)

possible fix something like this:

        # Getting where it's hosted
        vm_name=$(echo "$content" | grep "running on" | awk '{print $5}')
        if [ -z "$vm_name" ]; then
            # probably not agama running, going to next student
            continue
        fi

also a typo at # Write stats to inflixdb

romankuchin commented 2 weeks ago

can you create a PR? Good check.

ukusormus commented 1 week ago

I can see it's already covered by @hudolejev in PR https://github.com/romankuchin/ica0002-2024/pull/16 (with a bunch of other changes)

romankuchin commented 1 week ago

there are breaking changes, that we agreed not to apply this year. So, feel free to propose your solution