summaryrefslogtreecommitdiff
path: root/monitor.sh
blob: 39d9b6ed4a7a4a32ab5c6c979ed9b0413182fbfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 #!/bin/bash

links=("https://poc.sigsum.org/crocodile-icefish/sigsum/v0/get-tree-head-cosigned" "https://poc.sigsum.org/crocodile-icefish/sigsum/v0/get-tree-head-to-cosign" "https://poc.sigsum.org/crocodile-icefish/sigsum/v0/get-leaves/0/1" "https://poc.sigsum.org/crocodile-icefish/sigsum/v0/get-consistency-proof/1/3")

for url in ${links[@]};
do
echo $url #this is for testing purpose. To be removed in thhe final code.
  response=$(curl -s -w "%{http_code}" $url)
  http_code=$(tail -n1 <<< "$response")
  if [[ "$http_code" != 200 ]]; then
    echo Fatal. $url is down. status_code $http_code
    domain_name=$(echo $url | awk -F[/:] '{print $4}')
    echo domain=$domain_name
    dig_response=$(dig $domain_name)
    echo $dig_response #this is for testing purpose. To be removed in thhe final code.
  else
    echo $url is working.  status_code $http_code
   fi
done