Ad Widget

Collapse

Zabbix + kubernetes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gofree
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2017
    • 400

    #31
    seems that we're looking forward to version 5 next year

    Comment


    • doctorbal82
      doctorbal82 commented
      Editing a comment
      That's awesome! But the wait isn't the most fun... I guess I'll move ahead with a hacked up solution using the scripts provided. Will see what the Summit has to offer regarding that.
  • doctorbal82
    Member
    • Oct 2016
    • 39

    #32
    At the Zabbix Summit in Riga, Latvia (2019) I spoke directly with CEO Alexei Vladishev and he mentioned that Kubernetes monitoring is a tricky one given the dynamics of the environment. He mentioned that they are aiming to fully support this in Zabbix version 5.0 LTS via templates to be released in March 2020.

    Andrew Nelson gave a talk about monitoring container in Zabbix Summit 2018 (https://www.zabbix.com/zabbix_summit...enda#day1_1145). I did ask him briefly this year about this and he mentioned the Performance Co-Pilot would be a sound solution. In the summit link above there are notes around getting started. I have not explored that yet.

    Another option is to use the Prometheus checks with the HTTP master item starting with Zabbix 4.2.

    I'll go ahead and look back into using the scripts in this thread to get the information needed from kubernetes and if there is a simpler and more robust solution in the future will look into that.

    Comment

    • gofree
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2017
      • 400

      #33
      Thanks doc for the info, hope you had a good time

      Fingers crossed to get in version 5, really this would help zabbix a lot as well. I guess prometheus with http agent will not be that easy as it looks like - see ZBXNEXT-5398 ,LLD prometheus to json needs to be tuned. I'm curious to hear about your results - i think what we have now is the best solution at the moment.

      Comment


      • doctorbal82
        doctorbal82 commented
        Editing a comment
        I agree. Currently this is the simplest solution I have found, thanks to you guys. I'll upgrade to Zabbix 4.2 in the future to also explore the prometheus Zabbix feature (when I have time). Currently for dashboards I use prometheus + grafana kubernetes deployment and it works quite well. The alert manager though is something I'd like to avoid as I want to get the data into Zabbix and use that exclusively. I'll continue to see how it turns out.
    • gofree
      Senior Member
      Zabbix Certified SpecialistZabbix Certified Professional
      • Dec 2017
      • 400

      #34
      vote for it https://support.zabbix.com/browse/ZBXNEXT-4635

      Comment

      • gabo
        Junior Member
        • Mar 2019
        • 11

        #35

        Hello gofree , I am trying to monitor my kubernete with the same template that you used, but I have a problem and I hope you can help me, I am already a bit desperate, I followed the steps indicated in the gitub, but when trying to monitor it gives me the following error:

        Zabbix API HTTP Connection Error at ./k8s_collect.pl line 67.
        I do a curl from my server to check the API authentication and I think it works for me, it gives me an auth

        HTML Code:
        [root@zbbx001vx externalscripts]# curl -i -X POST -H 'Content-Type: application/json-rpc' -d '{"params": {"password": "xxxxxx", "user": "Admin"}, "jsonrpc": "2.0", "method": "user.login", "id":0, "auth":null}' http://xxxxxx/zabbix/api_jsonrpc.php
        HTTP/1.1 200 OK
        Date: Fri, 10 Apr 2020 01:15:23 GMT
        Server: Apache/2.4.6 (Red Hat Enterprise Linux) PHP/5.4.16
        X-Powered-By: PHP/5.4.16
        Access-Control-Allow-Origin: *
        Access-Control-Allow-Headers: Content-Type
        Access-Control-Allow-Methods: POST
        Access-Control-Max-Age: 1000
        Content-Length: 68
        Content-Type: application/json
        
        {"jsonrpc":"2.0","result":"189d33b897adad788ef7b6c1b8c27982","id":0}
        In the file k8s_collect.pl modify the CONFIG, but I don't know what may be failing

        HTML Code:
        # CONFIG ################################################
        my $APIURL = 'http://xxxxxxx/zabbix/api_jsonrpc.php';
        my $APIUSER = 'Admin';
        my $APIPASS = 'xxxxxxx';
        my $ZABBIX_SENDER = '/usr/bin/zabbix_sender';
        my $ZABBIX_SERVER = 'xxxxxxxx';
        my $ZABBIX_PORT = '10051';
        my $KUBECTL = '/usr/bin/kubectl';
        my $TMP_FILE_PATH = '/tmp/send_to_zabbix_'. int(rand(1000000000)) .'.data';
        
        #############################################
        # Request to Zabbix API for data to collect #
        #############################################
        my $ID = 0;
        my $AUTH = '';
        my @ITEMS;
        my %COLLECTED_DATA;
        my %TO_ZABBIX;
        my %NAMESPACES_HASH = map {$_ => 1} @NAMESPACES;
        my %JSON_PATHS_W_POSSIBLE_EMPTY_VALUES = map {$_ => 1} @JSON_PATHS_W_POSSIBLE_EMPTY_VALUES;
        my $ua = LWP::UserAgent->new();
        $ua-> default_header('Content-Type' => 'application/json');
        # Auth ######################################
        my $authRequest = {
            jsonrpc => '2.0',
            method  => 'user.login',
            params  => {
                user        => $APIUSER,
                password    => $APIPASS,
            },
            id      => ++$ID,
        };
        my $authRequestJson = encode_json $authRequest;
        
        my $respAuth = $ua->post($APIURL, Content => $authRequestJson);
        if ($respAuth->is_success) {
            my $responseJson = decode_json $respAuth->content;
            $AUTH = $responseJson->{result};
            die "Zabbix API Authentication Error" if length $AUTH == 0;
        } else {
            die "Zabbix API HTTP Connection Error";
        }

        any ideas? Thanks so much!
        Last edited by gabo; 10-04-2020, 03:17.

        Comment

        • karan123
          Junior Member
          • Aug 2020
          • 1

          #36
          Howdy, I'll see tomorrow ane give criticism - the connection you posted is likewise working with metric ( just like my understanding you can get the CPU, mem just by means of a metric worker )

          As a rule, as I'm profound jumping somewhat all the checking arrangements are working with Kube-state-measurements, metric-worker, Kubernetes API, and comparative. Try to get it, find it appropriately because of a toddler the changing idea of k8s and present it. securitas talx paperless pay
          Last edited by karan123; 23-11-2020, 08:55.

          Comment

          Working...