Ad Widget

Collapse

More Apache Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mimosinnet
    Junior Member
    • Apr 2010
    • 3

    #46
    Originally posted by gpmidi
    The key in the template is "apache[localhost,BusyWorkers]" and the template is sending it as "apache[TS,BusyWorkers]". TS is the hostname of the Apache instance that is being monitored.

    This raises the question about how to fix this. This leaves up with a couple of options:
    1. Alter the script so that items are sent up like "apache[BusyWorkers]". This would remove the ability to monitor multiple Apache instances with a single Zabbix host.
    2. Alter the script so that (by default) items are sent up like "apache[,BusyWorkers]" but there is a flag that will cause it to send up with the hostname of the Apache server it's checking (ie "apache[somehostname,BusyWorkers]"
    3. Use host level macros to do something like "apache[{$APACHEHOST},BusyWorkers]". This should work in theory but am having problems getting this working.
    4. Use something like "apache[{HOSTNAME},BusyWorkers]". I'm not even sure if this will work. FireMail's testing indicates that it doesn't. This method would be the ideal solution as it will always work but allow users to override the checked host.
    Thanks for the script and for the thread, it has been really useful. I was having the same issues than FireMail. This was because I was using a vhost setting, redirected the domain to another host, and has configured the server status in a virtual host:

    Code:
    Redirect permanent / http://www.generatech.org
    Server-status was configured in the admin.generatech.org vhost. I was getting the following:
    Code:
    ZabbixApacheUpdater.py -o admin.generatech.org -c generatech -z generatech
    zabbix_sender [11830]: DEBUG: Answer [{
            "response":"success",
            "info":"Processed 0 Failed 20 Total 20 Seconds spent 0.000170"}]
    Info from server: "Processed 0 Failed 20 Total 20 Seconds spent 0.000170"
    sent: 20; skipped: 0; total: 20
    The script worked perfectly when redirecting /server-status to the virtual host:
    Code:
    Redirect permanent /server-status http://admin.generatech.org/server-status
    Redirect permanent / http://www.generatech.org
    Now, I get:

    Code:
    ZabbixApacheUpdater.py -c generatech -z generatech
    zabbix_sender [15371]: DEBUG: Answer [{
            "response":"success",
            "info":"Processed 20 Failed 0 Total 20 Seconds spent 0.000188"}]
    Info from server: "Processed 20 Failed 0 Total 20 Seconds spent 0.000188"
    sent: 20; skipped: 0; total: 20
    Thanks!

    Comment

    • ittec
      Member
      • Mar 2008
      • 73

      #47
      All items Failed

      Hi

      Im trying to setup this Apache Monitoring to my Apaches. I have Apache with various Vhosts on httpd.conf. But it is very frustanting. Because it seems very easy and I have no success

      Zabbix Server: 1.8.3
      Zabbix Agentd: 1.8.3
      Apache/2.2.16

      When I run ZabbixApacheUpdater.py I obtain

      Code:
      zabbix_sender [17524]: DEBUG: Answer [{
              "response":"success",
              "info":"Processed 0 Failed 18 Total 18 Seconds spent 0.000208"}]
      Info from server: "Processed 0 Failed 18 Total 18 Seconds spent 0.000208"
      sent: 18; skipped: 0; total: 18
      I had to add zabbix_sender to PATH to py find properly zabbix_sender. If I run server-status from bash:

      Code:
      -bash-3.2# wget -O - http://localhost/server-status?auto?
      --2010-11-18 11:55:27--  http://localhost/server-status?auto?
      Resolving localhost... 127.0.0.1
      Connecting to localhost|127.0.0.1|:80... connected.
      HTTP request sent, awaiting response... 200 OK
      Length: 449 [text/plain]
      Saving to: `STDOUT'
      
       0% [                                                                                     ] 0           --.-K/s              Total Accesses: 5
      Total kBytes: 2
      Uptime: 245
      ReqPerSec: .0204082
      BytesPerSec: 8.35918
      BytesPerReq: 409.6
      Any ideas? Someone is using this template to monitoring apache or are there more templates? Thanks anyway

      Comment

      • mimosinnet
        Junior Member
        • Apr 2010
        • 3

        #48
        Originally posted by ittec
        When I run ZabbixApacheUpdater.py I obtain
        Ittec, have you given information about your host? For example, if I run:

        Code:
         # ./ZabbixApacheUpdater.py 
        zabbix_sender [6017]: DEBUG: Answer [{
                "response":"success",
                "info":"Processed 0 Failed 20 Total 20 Seconds spent 0.000169"}]
        Info from server: "Processed 0 Failed 20 Total 20 Seconds spent 0.000169"
        sent: 20; skipped: 0; total: 20
        But:

        Code:
        # ./ZabbixApacheUpdater.py -c generatech -z generatech
        zabbix_sender [6194]: DEBUG: Answer [{
                "response":"success",
                "info":"Processed 20 Failed 0 Total 20 Seconds spent 0.000238"}]
        Info from server: "Processed 20 Failed 0 Total 20 Seconds spent 0.000238"
        sent: 20; skipped: 0; total: 20
        Cheers!

        Comment

        • ittec
          Member
          • Mar 2008
          • 73

          #49
          :s

          Hi mimosinnet

          yes, actually I run

          -bash-3.2# /usr/bin/python /home/zabbix/ZabbixApacheUpdater.py -z IPOFZABBIXSERVER -o localhost
          zabbix_sender [28483]: DEBUG: Answer [{
          "response":"success",
          "info":"Processed 0 Failed 19 Total 19 Seconds spent 0.000179"}]
          Info from server: "Processed 0 Failed 19 Total 19 Seconds spent 0.000179"
          sent: 19; skipped: 0; total: 19
          in -o parameter I have or localhost, or IP of host or 127.0.0.1, all with permissions on mod-status

          Im finding a simple way to monitoring Apache myself because there is no much info about this wiki. Thanks for your interest!

          Comment

          • mimosinnet
            Junior Member
            • Apr 2010
            • 3

            #50
            I had also some issues to get the script work correctly. For me it was helpful what gpmidi suggests in this thread:



            about changing the end of the script from "os.remove(tempfilepath)" to "print tempfilepath". If you look at the file, you will see the information given by the script. It may be helpful to debug it. This is what I get:

            /tmp/tmpixQKVS

            Code:
             # cat /tmp/tmpixQKVS 
            localhost apache[localhost,ReadingRequest] 0
            localhost apache[localhost,Uptime] 5087637
            localhost apache[localhost,Logging] 0
            localhost apache[localhost,TotalAccesses] 2810594
            localhost apache[localhost,SendingReply] 1
            localhost apache[localhost,Startingup] 0
            localhost apache[localhost,Idlecleanupofworker] 0
            localhost apache[localhost,Gracefullyfinishing] 0
            localhost apache[localhost,DNSLookup] 0
            localhost apache[localhost,BytesPerReq] 551001
            localhost apache[localhost,WaitingforConnection] 73
            localhost apache[localhost,CPULoad] .162484
            localhost apache[localhost,BytesPerSec] 304393
            localhost apache[localhost,Keepaliveread] 1
            localhost apache[localhost,ReqPerSec] .552436
            localhost apache[localhost,TotalkBytes] 1512343168
            localhost apache[localhost,IdleWorkers] 73
            localhost apache[localhost,BusyWorkers] 2
            localhost apache[localhost,Closingconnection] 0
            localhost apache[localhost,Openslotwithnocurrentprocess] 949
            Good luck!

            Comment

            • lgc78
              Member
              • Aug 2010
              • 35

              #51
              mimosinnet thanks for the tip. I'm monitoring a remote host from zabbix server and the temp file generated looks like this:

              server-test apache[server-test,ReadingRequest] 0
              server-test apache[server-test,Uptime] 314347
              server-test apache[server-test,IdleWorkers] 20
              server-test apache[server-test,TotalAccesses] 4967193
              server-test apache[server-test,SendingReply] 4
              server-test apache[server-test,Startingup] 0
              etc.

              Does this mean that i have to have a custom template for each apache server i monitor? A template that has the same key? The template i downloaded uses the key 'localhost.Uptime' and 'localhost,IdleWorkers' etc.

              I was expecting the generated temp file to look like this:
              server-test apache[localhost,ReadingRequest] 0
              server-test apache[localhost,Uptime] 314347
              server-test apache[localhost,IdleWorkers] 20
              server-test apache[localhost,TotalAccesses] 4967193
              server-test apache[localhost,SendingReply] 4
              server-test apache[localhost,Startingup] 0
              etc.

              Can someone clarify? Thanks!!

              Comment

              • lgc78
                Member
                • Aug 2010
                • 35

                #52
                One more question... early in this thread there were talks about adding instructions to the wiki about how to setup this script to run using the zabbix agent. It doesn't look like this ever happened. Can someone post instructions here - that would be great.

                Thanks again. And thanks for the script.

                Comment

                • frater
                  Senior Member
                  • Oct 2010
                  • 340

                  #53
                  Originally posted by lgc78
                  mimosinnet thanks for the tip. I'm monitoring a remote host from zabbix server and the temp file generated looks like this:

                  server-test apache[server-test,ReadingRequest] 0
                  server-test apache[server-test,Uptime] 314347
                  server-test apache[server-test,IdleWorkers] 20
                  server-test apache[server-test,TotalAccesses] 4967193
                  server-test apache[server-test,SendingReply] 4
                  server-test apache[server-test,Startingup] 0
                  etc.

                  Does this mean that i have to have a custom template for each apache server i monitor? A template that has the same key? The template i downloaded uses the key 'localhost.Uptime' and 'localhost,IdleWorkers' etc.

                  I was expecting the generated temp file to look like this:
                  server-test apache[localhost,ReadingRequest] 0
                  server-test apache[localhost,Uptime] 314347
                  server-test apache[localhost,IdleWorkers] 20
                  server-test apache[localhost,TotalAccesses] 4967193
                  server-test apache[localhost,SendingReply] 4
                  server-test apache[localhost,Startingup] 0
                  etc.

                  Can someone clarify? Thanks!!
                  I would expect this:

                  Code:
                  server-test apache[ReadingRequest] 0
                  server-test apache[Uptime] 314347
                  server-test apache[IdleWorkers] 20
                  server-test apache[TotalAccesses] 4967193
                  server-test apache[SendingReply] 4
                  server-test apache[Startingup] 0
                  etc.
                  I only spent very little time to check this script and I also didn't check this thread really. I've created several of these scripts with zabbix_sender myself, but I write them in bash. I always use zabbix_sender -c /etc/zabbix/zabbix_agentd.conf in my scripts so the settings are in a centralized place.

                  I was also amazed the template didn't contain "zabbix trapper" instead of "zabbix agent"
                  Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

                  Comment

                  • brynjellis
                    Junior Member
                    • May 2012
                    • 7

                    #54
                    I'm having the same problems with this script. I'm getting:

                    zabbix_sender [4439]: DEBUG: answer [{
                    "response":"success",
                    "info":"Processed 0 Failed 20 Total 20 Seconds spent 0.000375"}]
                    Info from server: "Processed 0 Failed 20 Total 20 Seconds spent 0.000375"
                    sent: 20; skipped: 0; total: 20
                    /tmp/tmplmfgSS

                    I'm testing the script from the command line with:
                    Code:
                    /usr/bin/python /etc/zabbix/ZabbixApacheUpdater.py -o 123.456.789.10 -c FCUATWEB1 -z 127.0.0.1
                    I'm using the zabbix virtual appliance. That's where I have the scripts installed. 123.456.789.10 is a server on a customer site accessed via a site-to-site VPN. I can run http://123.456.789.10/server-status and get a result.

                    The /tmp/tmplmfgSS looks like this:
                    Code:
                    FCUATWEB1 apache[123.456.789.10,ReadingRequest] 0
                    FCUATWEB1 apache[123.456.789.10,Uptime] 200688
                    FCUATWEB1 apache[123.456.789.10,Logging] 0
                    FCUATWEB1 apache[123.456.789.10,TotalAccesses] 36895
                    FCUATWEB1 apache[123.456.789.10,SendingReply] 1
                    FCUATWEB1 apache[123.456.789.10,Startingup] 0
                    FCUATWEB1 apache[123.456.789.10,Idlecleanupofworker] 0
                    FCUATWEB1 apache[123.456.789.10,Gracefullyfinishing] 0
                    FCUATWEB1 apache[123.456.789.10,DNSLookup] 0
                    FCUATWEB1 apache[123.456.789.10,BytesPerReq] 3749.79
                    FCUATWEB1 apache[123.456.789.10,WaitingforConnection] 49
                    FCUATWEB1 apache[123.456.789.10,CPULoad] .0473471
                    FCUATWEB1 apache[123.456.789.10,BytesPerSec] 689.371
                    FCUATWEB1 apache[123.456.789.10,Keepaliveread] 0
                    FCUATWEB1 apache[123.456.789.10,ReqPerSec] .183843
                    FCUATWEB1 apache[123.456.789.10,TotalkBytes] 135106
                    FCUATWEB1 apache[123.456.789.10,IdleWorkers] 49
                    FCUATWEB1 apache[123.456.789.10,BusyWorkers] 1
                    FCUATWEB1 apache[123.456.789.10,Closingconnection] 0
                    FCUATWEB1 apache[123.456.789.10,Openslotwithnocurrentprocess] 974
                    FCUATWEB1 is the name I've given to the host when creating it in zabbix web frontend but am accessing via it's IP 123.456.789.10.

                    Other than that my setup is pretty much out-of-the-box zabbix 1.8.13 virtual appliance.

                    I'd really like to get this working if anyone can help please?

                    Regards
                    Bryn

                    Comment

                    • DIoX|DaZ
                      Member
                      • Apr 2011
                      • 31

                      #55
                      I'm running Zabbix 2.0.3 on Ubuntu
                      And monitored host is Centos 6.3 with agent 2.0.3
                      Trying to test connection - this is what i get
                      P.S. ZBX_NOTSUPPORTED if i've tried setting crontab on zabbix_server
                      and add template to host that i want to monitor, tried changing data to Trapper etc...
                      Code:
                      root@zabbix:/usr/local/etc# ./ZabbixApacheUpdater.py -z 127.0.0.1 -o 46.255.209.183 -c 46.255.209.183 -q 10051
                      zabbix_sender [10964]: DEBUG: answer [{
                              "response":"success",
                              "info":"Processed 0 Failed 19 Total 19 Seconds spent 0.000138"}]
                      info from server: "Processed 0 Failed 19 Total 19 Seconds spent 0.000138"
                      sent: 19; skipped: 0; total: 19
                      if i've change file to print tempfilepath
                      Code:
                      zabbix_sender [11024]: DEBUG: answer [{
                              "response":"success",
                              "info":"Processed 0 Failed 20 Total 20 Seconds spent 0.000141"}]
                      info from server: "Processed 0 Failed 20 Total 20 Seconds spent 0.000141"
                      sent: 20; skipped: 0; total: 20
                      Code:
                      root@zabbix:/usr/local/etc# cat /tmp/tmpvKV_ze
                      46.255.209.183 apache[46.255.209.183,ReadingRequest] 0
                      46.255.209.183 apache[46.255.209.183,Uptime] 236
                      46.255.209.183 apache[46.255.209.183,Logging] 0
                      46.255.209.183 apache[46.255.209.183,TotalAccesses] 8
                      46.255.209.183 apache[46.255.209.183,SendingReply] 1
                      46.255.209.183 apache[46.255.209.183,Startingup] 0
                      46.255.209.183 apache[46.255.209.183,Idlecleanupofworker] 0
                      46.255.209.183 apache[46.255.209.183,Gracefullyfinishing] 0
                      46.255.209.183 apache[46.255.209.183,DNSLookup] 0
                      46.255.209.183 apache[46.255.209.183,BytesPerReq] 128
                      46.255.209.183 apache[46.255.209.183,WaitingforConnection] 7
                      46.255.209.183 apache[46.255.209.183,CPULoad] .00423729
                      46.255.209.183 apache[46.255.209.183,BytesPerSec] 4.33898
                      46.255.209.183 apache[46.255.209.183,Keepaliveread] 0
                      46.255.209.183 apache[46.255.209.183,ReqPerSec] .0338983
                      46.255.209.183 apache[46.255.209.183,TotalkBytes] 1
                      46.255.209.183 apache[46.255.209.183,IdleWorkers] 7
                      46.255.209.183 apache[46.255.209.183,BusyWorkers] 1
                      46.255.209.183 apache[46.255.209.183,Closingconnection] 0
                      46.255.209.183 apache[46.255.209.183,Openslotwithnocurrentprocess] 248
                      So i don't get it - that means that script gets data from apache?


                      Should this script run on Zabbix server, or on machine that i want to monitor?

                      If i've open page on lynx i can see the data.

                      Comment

                      • Blackerado
                        Junior Member
                        • Jun 2013
                        • 4

                        #56
                        Any solutions to this yet? Seems odd that it is still an issue here 2 years later. I am having the same problems as above. All manual testing indicates the satus properly but it wont process to the zabbix server. Is this script to be run on the zabbix server itself or the host that im trying to monitor in the first place?

                        Comment

                        Working...