lorf / zapache

Zabbix Apache Monitoring Script (from https://www.zabbix.org/wiki/Docs/howto/apache_monitoring_script#Method_3, originally from https://www.zabbix.com/forum/showthread.php?p=62457)
85 stars 44 forks source link

.../externalscripts/zapache ZBX_NOTSUPPORTED #13

Closed angpa closed 7 years ago

angpa commented 8 years ago

Is working for me in the Zabbix server but I can't make it work on an apache server.

Any suggestions? Thank you

[root@server02 conf.d]# zabbix_get -s 192.168.4.7 -k zapache[Uptime]

[root@server02 conf.d]# /var/lib/zabbixsrv/externalscripts/zapache Uptime ZBX_NOTSUPPORTED

[root@server02 conf.d]#

lorf commented 8 years ago

Hi! Can You please show the out put of

bash -x /var/lib/zabbixsrv/externalscripts/zapache Uptime
angpa commented 8 years ago

Hi! Thank you for your answer :) Here is the output you requested:

bash -x /var/lib/zabbixsrv/externalscripts/zapache Uptime 
+ zapachever=1.5
+ rval=0 
+ value= 
+ cache_seconds=60
+ '[' '' ']' 
+ TMPDIR=/tmp 
+ [[ 1 == 1 ]]
+ STATUS_URL='http://localhost/server-status?auto' 
+ CASE_VALUE=Uptime 
+ case "$CASE_VALUE" in
+ umask 077 
+ cache_prefix=zapache-0-http___localhost_server-status_auto 
+ cache=/tmp/zapache-0-http___localhost_server-status_auto.cache
+ cache_timestamp_check=/tmp/zapache-0-http___localhost_server-status_auto.ts 
++ date +%s 
+ touch -d @1473869517 /tmp/zapache-0-http___localhost_server-status_auto.ts
+ '[' /tmp/zapache-0-http___localhost_server-status_auto.cache -ot 
/tmp/zapache-0-http___localhost_server-status_auto.ts ']' 
++ which curl 
+ curl=/usr/bin/curl
+ '[' /usr/bin/curl ']' 
+ fetch_url 'http://localhost/server-status?auto' 
+ /usr/bin/curl --insecure --silent --location -H 'Cache-Control: no-cache' 
'http://localhost/server-status?auto'
+ rval=0 
+ '[' 0 '!=' 0 ']' 
+ case "$CASE_VALUE" in
+ '[' -s /tmp/zapache-0-http___localhost_server-status_auto.cache ']' 
+ case "$CASE_VALUE" in 
++ awk '/^Uptime:/ {print $2}'
+ value= 
+ rval=0 
+ '[' 0 -eq 0 -a -z '' ']'
+ case "$CASE_VALUE" in 
+ rval=1 
+ '[' 1 -ne 0 ']'
+ echo ZBX_NOTSUPPORTED 
ZBX_NOTSUPPORTED 
+ echo ''

+ exit 1
lorf commented 8 years ago

Also, please show the output of

cat /tmp/zapache-0-http___localhost_server-status_auto.cache
angpa commented 8 years ago

Thanks! Below is the output

[root@server02 ~]# cat /tmp/zapache-0-http___localhost_server-status_auto.cache
<html>
<head>
<title>
    El servicio esta temporariamente interrumpido
</title>

<style type="text/css">
</style>

<script type="text/javascript">
</script>

</head>

<body style="background: #000;">

<table style="text-align: center; width: 100%;"><tr><td style="text-align: center; width; 100%;">

<div style="text-align: center; width: 100%; margin: 20px;">
<img src="/error/PO_LogoLogin.gif" border="0">
</div>

<table style="width: 80%; border: #D0B0B0 10px solid;" align="center">
    <tr>
        <td style="text-align: center; width; 100%; padding: 50px; color: #FFF; font: 16px verdana;">

            <div style="width: 80%; border: #FF8080 5px solid; margin: 0 auto 30 auto; padding: 5px; background: #604040;">
                El servicio esta temporariamente interrumpido
            </div>
            En este momento estamos realizando tareas de mantenimiento.<br>
            Disculpe las molestias ocasionadas.<br>
            Reanudaremos el servicio a la brevedad posible.<br>
            <br>
            <div style="width: 80%; font: bold 12px verdana; margin: auto; border-top: #FFF 1px solid; padding-top: 10px;">
            Error 503 - El servicio se reestablecera en breve
            </div>

        </td>
    </tr>
</table>

</td></tr></table>

</body>

</html>
lorf commented 8 years ago

Looks like your apache server gives HTTP 503 error (service unavailable) while requesting http://localhost/server-status?auto. You need to check apache's logs and configuration.