KevinKrumbiegel / check_gitlab

Nagios plugin for doing a GitLab health check
GNU General Public License v3.0
6 stars 5 forks source link

No Output. Status=unknown, Message= #2

Open nieldejonghe opened 3 years ago

nieldejonghe commented 3 years ago

Hello Kevin,

I've struggled with whitelisting my nagios servers IP in the monitoring whitelist IP in gitlab, maybe it could be good if you put that in your doc as prereq?

I've tried out your plugin in our nagios configuration but i'm not receiving any output. If I run a curl to my gitlab url I do receive output.

root@:/srv/nagios/libexec# curl -k https:///-/readiness?all=1 {"db_check":{"status":"ok"},"redis_check":{"status":"ok"},"cache_check":{"status":"ok"},"queues_check":{"status":"ok"},"shared_state_check":{"status":"ok"},"gitaly_check":{"status":"ok","labels":{"shard":"default"}}}

Output from check_gitlab root@:/srv/nagios/libexec# ./check_gitlab -s https:/// --check-all Cache check: Status=unknown, Message= Database check: Status=unknown, Message= Gitaly check: Status=unknown, Message= Queues check: Status=unknown, Message= Redis check: Status=unknown, Message= Shared state check: Status=unknown, Message= 6 checks done.

Any Idea in how to troubleshoot this? Kind Regards, Niel

nieldejonghe commented 3 years ago

Hello Kevin,

I've struggled with whitelisting my nagios servers IP in the monitoring whitelist IP in gitlab, maybe it could be good if you put that in your doc as prereq?

I've tried out your plugin in our nagios configuration but i'm not receiving any output. If I run a curl to my gitlab url I do receive output.

root@:/srv/nagios/libexec# curl -k https:///-/readiness?all=1 {"db_check":{"status":"ok"},"redis_check":{"status":"ok"},"cache_check":{"status":"ok"},"queues_check":{"status":"ok"},"shared_state_check":{"status":"ok"},"gitaly_check":{"status":"ok","labels":{"shard":"default"}}}

Output from check_gitlab root@:/srv/nagios/libexec# ./check_gitlab -s https:/// --check-all Cache check: Status=unknown, Message= Database check: Status=unknown, Message= Gitaly check: Status=unknown, Message= Queues check: Status=unknown, Message= Redis check: Status=unknown, Message= Shared state check: Status=unknown, Message= 6 checks done.

Any Idea in how to troubleshoot this? Kind Regards, Niel

I was able to fix it by removing the [0] option in the "check_module" function

def check_module(readiness_json, module):
    try:
        status = readiness_json[module]["status"]
    except:
        status = "unknown"
    try:
        message = readiness_json[module]["message"]
    except:
        message = ""
    return status, message
KevinKrumbiegel commented 3 years ago

Hi Niel! Thank you for the helpful issue. Indeed, something is broken there and I'm just fixing it right now.

I will also edit the README to accept your proposal. :)

KevinKrumbiegel commented 3 years ago

Hi @nieldejonghe ,

I just found out that my GitLab Server responds differently than yours.

On my GitLab Server the response is: {"status":"ok","master_check":[{"status":"ok"}],"db_check":[{"status":"ok"}],"redis_check":[{"status":"ok"}],"cache_check":[{"status":"ok"}],"queues_check":[{"status":"ok"}],"shared_state_check":[{"status":"ok"}],"gitaly_check":[{"status":"ok","labels":{"shard":"default"}}]}

I currently use GitLab Enterprise Edition 13.9.1-ee. May I ask you what version you are using? (Just check your server's help page at gitlab.example.org/help). As you fixed this issue for yourself right now, the overall fix in this repo will come during the next week. I will do some further refactorings that will take some time.

However, thank you very much for bringing up this issue!

nieldejonghe commented 3 years ago

Hello @KevinKrumbiegel,

I just checked my gitlab server today, current version is pretty old 'GitLab Enterprise Edition 12.2.4-ee ' I guess I should update asap! :)

Kind Regards, Niel Dejonghe

kfiresmith commented 1 year ago

Hi Folks, In case it helps, there are different health checks in GitLab 15x. I'm on 15.7.5 for example:

curl http://localhost/-/readiness?all=1 | jq

{
  "status": "ok",
  "master_check": [
    {
      "status": "ok"
    }
  ],
  "db_check": [
    {
      "status": "ok"
    }
  ],
  "cache_check": [
    {
      "status": "ok"
    }
  ],
  "queues_check": [
    {
      "status": "ok"
    }
  ],
  "rate_limiting_check": [
    {
      "status": "ok"
    }
  ],
  "sessions_check": [
    {
      "status": "ok"
    }
  ],
  "shared_state_check": [
    {
      "status": "ok"
    }
  ],
  "trace_chunks_check": [
    {
      "status": "ok"
    }
  ],
  "gitaly_check": [
    {
      "status": "ok",
      "labels": {
        "shard": "default"
      }
    }
  ]
}