Ad Widget

Collapse

Zabbix Monitoring

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dperfeito
    Junior Member
    • Aug 2012
    • 1

    #1

    Zabbix Monitoring

    Important: My English is google translator
    Hi, I'm trying to monitor the Zimbra server, but am having some problems. See my backup script:

    #!/bin/bash

    check=$1
    maxage=59
    file='/tmp/zimbra_status'
    filef='/tmp/f_zimbra_status'
    zab='/usr/sbin/zabbix_agentd -t '
    #check if file exists
    if [[ -e $filef ]]
    then

    OLD=`stat -c %Z $filef`
    NOW=`date +%s`
    # if older then maxage, update file
    if [[ `expr $NOW - $OLD` -gt $maxage ]]
    then
    sudo -u zimbra date > /tmp/f_zimbra_status
    sudo -u zimbra /opt/zimbra/bin/zmcontrol status >> $filef
    sudo -u zabbix cat $filef > $file

    sudo -u zabbix date >> /home/tools/zmlog_escrito.log
    sudo -u zabbix cat $filef >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,antispam Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,antivirus Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,ldap Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,logger Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,mailbox Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,mta Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,snmp Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,spell Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,stats Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zabbix $zab "vfs.file.regmatch[/tmp/f_zimbra_status,zmconfigd Running]" >> /home/tools/zmlog_escrito.log
    sudo -u zimbra echo "---------------" >> /home/tools/zmlog_escrito.log

    fi
    fi
    This script parses the run time was greater than 59 seconds (to control the amount of scans). He plays the return status of zimbra to a file. This file after I complete game to another file for the status of zimbra vai recording slowly and this could cause problems when reading the file for zabbix.
    I put some lines to test the error happens.
    The file return:

    Fri Aug 24 16:38:01 BRT 2012
    Host mail.dperfeito.com.br
    antispam Running
    antivirus Running
    ldap Running
    logger Running
    mailbox Running
    mta Running
    snmp Running
    spell Running
    stats Running
    zmconfigd Running
    But the vfs.file.regmatch is returning 0 for the zabbix server. Running the test script locally on the command always returns 1 as it should.
    Is there any other command that could read the file?
    Had some other solution to monitor the services of zimbra?
Working...