Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-02-2009, 03:20 PM
Intermediate Member
 
Posts: 19
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..
Reply With Quote
  #2 (permalink)  
Old 04-02-2009, 03:29 PM
raj raj is offline
Moderator
 
Posts: 768
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
Reply With Quote
  #3 (permalink)  
Old 04-02-2009, 03:37 PM
Intermediate Member
 
Posts: 19
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..
Reply With Quote
  #4 (permalink)  
Old 04-02-2009, 03:53 PM
raj raj is offline
Moderator
 
Posts: 768
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
__________________
i2k2 Networks
Dedicated & Shared Zimbra Hosting Provider

Last edited by raj; 04-02-2009 at 03:58 PM..
Reply With Quote
  #5 (permalink)  
Old 04-02-2009, 03:54 PM
Intermediate Member
 
Posts: 19
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..
Reply With Quote
  #6 (permalink)  
Old 04-02-2009, 04:00 PM
Intermediate Member
 
Posts: 19
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..
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.