Results 1 to 6 of 6

Thread: Zimba Server Status Script

  1. #1
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    6

    Default Zimba Server Status Script

    Hi all!
    I'm presently being helped with a problem, and after reviewing the forums for several hours, I decided to craft a script that gathers some common info that the admins seems to request oftenly, and dump that to a textfile for easy upload:

    #!/bin/bash
    echo "###DNS SETTINGS###" > zminfo
    cat /etc/hosts >> zminfo
    cat /etc/resolv.conf >> zminfo

    # Replace yourdomain with your FQDN of your mailserver
    dig yourdomain mx >> zminfo
    dig yourdomain any >> zminfo

    echo "###HOSTNAME SETTINGS###" >> zminfo
    host `hostname` >> zminfo

    echo "###LISTENING PORTS###" >> zminfo
    netstat -luntp >> zminfo

    echo "###ZIMBRA STATUS###" >> zminfo
    uname -a >> zminfo
    sudo -u zimbra /opt/zimbra/bin/zmcontrol status 2>&1 >> zminfo
    sudo -u zimbra /opt/zimbra/bin/zmcontrol -v status 2>&1 >> zminfo


    Just copy/paste this to a file locally, chmod +x it, and run it as the root user. Obviously, we can tweak this a little more until it meets everyone's approval, but I would like this be promoted to a sticky on the forums, I think it would make everyone's lives easier.
    Last edited by tempusfugit; 04-02-2009 at 04:06 PM.

  2. #2
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    10

    Default

    i think its a good idea as uxbod alsways ask for these helpful info commands and we can come up with a combined one as a script and all of us can use it as a link in the signature or sticky

    i suggest follwing few top of my head ...

    ### version ####
    zmcontrol -v

    ### HD Space ####
    df -h
    du -sh /opt/zimbra
    du -sh /opt/zimbra/logger
    du -sh /opt/zimbra/logs
    du -sh /opt/zimbra/store


    Raj
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  3. #3
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    6

    Default Rev .1

    #!/bin/bash
    echo "###DNS SETTINGS###" > zminfo
    cat /etc/hosts >> zminfo
    cat /etc/resolv.conf >> zminfo

    # Replace yourdomain with your FQDN of your mailserver
    dig yourdomain mx >> zminfo
    dig yourdomain any >> zminfo
    echo "###HOSTNAME SETTINGS###" >> zminfo
    host `hostname` >> zminfo
    uname -a >> zminfo
    echo "###LISTENING PORTS###" >> zminfo
    netstat -luntp >> zminfo

    echo "###ZIMBRA STATUS###" >> zminfo
    ps -u zimbra >> zminfo
    df -h >> zminfo
    du -sh /opt/zimbra >> zminfo
    du -sh /opt/zimbra/logger >> zminfo
    du -sh /opt/zimbra/log >> zminfo
    du -sh /opt/zimbra/store >> zminfo
    sudo -u zimbra /opt/zimbra/bin/zmcontrol status 2>&1 >> zminfo
    sudo -u zimbra /opt/zimbra/bin/zmcontrol -v status 2>&1 >> zminfo


    Integrated Raj's remarks. I saw that /opt/zimbra/log was the path that was available on my server, so I used that. I also added the ps -u zimbra line, I recall seeing that a few times.
    Last edited by tempusfugit; 04-02-2009 at 04:06 PM.

  4. #4
    Join Date
    Oct 2005
    Location
    USA, Canada and India
    Posts
    777
    Rep Power
    10

    Default

    ran this and found few things..

    1) you have mailserver name mail.extremexposures.net hardcoded.

    2) ###RECENT ZIMBRA LOG### this can reveal good EMAIL ID's and sensitive info about users system.. i dont know if its a good idea to have that without asking

    i guess the best script should assume user dont know much and also if no input was given script should run..
    so we need to make MAILSERVER_NAME optional which could be taken as pram to the script i.e: ./myinfoscript.sh MAILSERVER_NAME


    more contructive input will come as we keep it up
    Last edited by raj; 04-02-2009 at 03:58 PM.
    i2k2 Networks
    Dedicated & Shared Zimbra Hosting Provider

  5. #5
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    6

    Default v.3

    Better add some memory/CPU info to it as well:

    #!/bin/bash
    echo "###DNS SETTINGS###" > zminfo
    cat /etc/hosts >> zminfo
    cat /etc/resolv.conf >> zminfo

    # Replace yourdomain with your FQDN of your mailserver
    dig yourdomain mx >> zminfo
    dig yourdomain any >> zminfo
    echo "###HOSTNAME SETTINGS###" >> zminfo
    host `hostname` >> zminfo
    uname -a >> zminfo
    echo "###LISTENING PORTS###" >> zminfo
    netstat -luntp >> zminfo
    echo "###ZIMBRA STATUS###" >> zminfo
    free -m >> zminfo
    cat /proc/meminfo >> zminfo
    cat /proc/cpuinfo >> zminfo

    ps -u zimbra >> zminfo
    df -h >> zminfo
    du -sh /opt/zimbra >> zminfo
    du -sh /opt/zimbra/logger >> zminfo
    du -sh /opt/zimbra/log >> zminfo
    du -sh /opt/zimbra/store >> zminfo
    sudo -u zimbra /opt/zimbra/bin/zmcontrol status 2>&1 >> zminfo
    sudo -u zimbra /opt/zimbra/bin/zmcontrol -v status 2>&1 >> zminfo
    Last edited by tempusfugit; 04-02-2009 at 04:05 PM.

  6. #6
    Join Date
    Apr 2009
    Posts
    19
    Rep Power
    6

    Default Thoughts?

    I was thinking of doing a dump of "dmidecode" as it gives a quite relevant listing of the server/computer hardware, but that's quite a long dump, but may be useful in some instances. I also removed the dump of the log as per Raj's remarks. I guess if someone is a better script writer than I, they can consider log obfuscation.
    Last edited by tempusfugit; 04-02-2009 at 04:09 PM.

Similar Threads

  1. [SOLVED] mysql.server not running
    By king0770 in forum Administrators
    Replies: 23
    Last Post: 07-25-2009, 03:07 PM
  2. Corrupt User Account
    By FaithX in forum Administrators
    Replies: 4
    Last Post: 01-20-2009, 12:56 PM
  3. Zimbra fails after working for 2 weeks
    By Linsys in forum Administrators
    Replies: 10
    Last Post: 10-07-2008, 12:42 AM
  4. mysql.server is not running
    By Oswald-Kolle in forum Installation
    Replies: 27
    Last Post: 05-01-2007, 08:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •