From edddcbc5da586350ece7897c6397daacff08a89f Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Fri, 17 Feb 2023 10:28:18 +0100 Subject: [PATCH] Use node1 everywhere for statistics --- templates/script/aggregate.sh | 8 ++++---- templates/script/makebuckets.erb.sh | 2 +- templates/script/rclone.conf.erb | 2 +- templates/script/usage.erb.sh | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/script/aggregate.sh b/templates/script/aggregate.sh index 0087b92..6459fcf 100644 --- a/templates/script/aggregate.sh +++ b/templates/script/aggregate.sh @@ -27,21 +27,21 @@ Customer;Total GB;Users;Product" for customer in $(${yq} -r '.fullnodes | .[]' ${commonyaml}); do product=1 # Prisplan 1 csv="${csv} -$(rclone cat "${billingbucket}/${customer}-usage/${customer}-latest.csv" | +$(rclone cat --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${billingbucket}/${customer}-usage/${customer}-latest.csv" | grep -E -v '^DATE|^Customer' | sed 's/$/;1/')" done for customer in $(${yq} -r '.singlenodes | .[]' ${commonyaml}); do product=2 # Prisplan 2 csv="${csv} -$(rclone cat "${billingbucket}/${customer}-usage/${customer}-latest.csv" | +$(rclone --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies cat "${billingbucket}/${customer}-usage/${customer}-latest.csv" | grep -E -v '^DATE|^Customer' | sed 's/$/;'${product}'/')" done echo "${csv}" >"${aggregatefile}" -rclone copy "${aggregatefile}" "${aggregatedir}/" +rclone copy --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${aggregatefile}" "${aggregatedir}/" mv "${aggregatefile}" "latest.csv" -rclone move "latest.csv" "${latestdir}/" +rclone move --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "latest.csv" "${latestdir}/" cd "${olddir}" || (echo "Could not switch back to old dir" && exit 1) rmdir "${tempdir}" diff --git a/templates/script/makebuckets.erb.sh b/templates/script/makebuckets.erb.sh index 0e1e4d7..657761b 100755 --- a/templates/script/makebuckets.erb.sh +++ b/templates/script/makebuckets.erb.sh @@ -38,7 +38,7 @@ rclone="rclone --config /root/.rclone.conf" # These are dynamic buckets="$(${rclone} lsd "${rcp}:" | awk '{print $NF}')" -users=$(${rclone} cat "statistics:drive-server-coms/${rcp}/users.json" | jq '. | with_entries( select(.key | match("@") ) )') +users=$(${rclone} cat --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "statistics:drive-server-coms/${rcp}/users.json" | jq '. | with_entries( select(.key | match("@") ) )') for eppn in $(echo "${users}" | jq -r keys[]); do user=${eppn%@*} diff --git a/templates/script/rclone.conf.erb b/templates/script/rclone.conf.erb index 980cacc..e77212d 100644 --- a/templates/script/rclone.conf.erb +++ b/templates/script/rclone.conf.erb @@ -14,7 +14,7 @@ endpoint = <%= @s3_host_mirror %> acl = private [statistics] type = webdav -url = https://sunet.drive.sunet.se/remote.php/dav/files/_script/ +url = https://89.46.20.42/remote.php/dav/files/_script/ vendor = nextcloud user = _script pass = <%= @statistics_secret %> diff --git a/templates/script/usage.erb.sh b/templates/script/usage.erb.sh index f358a2b..9f2c0c2 100644 --- a/templates/script/usage.erb.sh +++ b/templates/script/usage.erb.sh @@ -13,7 +13,7 @@ else customer="<%= @customer %>" allowmixedcustomers=no fi -userjson=$(rclone cat "statistics:drive-server-coms/${location}/users.json") +userjson=$(rclone cat --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "statistics:drive-server-coms/${location}/users.json") users=$(echo ${userjson} | jq -r '.| keys | .[] | test("^((?!(^admin|^[_])).)*$")' | grep true | wc -l) outfile1="${customer}-${date}-detailed.csv" outfile2="${customer}-${date}.csv" @@ -59,11 +59,11 @@ rclone mkdir "${location}:drive-${location}-share" echo -n "${result1}" >"${outfile1}" echo -n "${result2}" >"${outfile2}" -rclone copyto --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile1}" -rclone copyto --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile2}" +rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile1}" +rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/daily/${outfile2}" -rclone copyto --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest-detailed.csv" -rclone copyto --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest.csv" +rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile1}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest-detailed.csv" +rclone copyto --no-check-certificate --webdav-headers "Host,sunet.drive.sunet.se" --use-cookies "${outfile2}" "statistics:drive-storage-report/${customer}-usage/${customer}-latest.csv" rm "${outfile1}" rm "${outfile2}"