Current time: 04-17-2024, 09:15 AM Hello There, Guest! (LoginRegister)


Post Reply 
[MUNIN Plugin] Mailadresses on Server
Author Message
Knut Offline
Member
***

Posts: 736
Joined: Nov 2006
Reputation: 10
Post: #1
[MUNIN Plugin] Mailadresses on Server
Moin,

ich persönlich schaue mir gerne die Entwicklung meines Servers via Munin grafisch an. Ob das nun die Anzahl der angelegten Sites oder Mailkonten ist.
Für letzteres möchte ich hier gerne das entsprechende Plugin zur Verfügung stellen. Vielleicht setzt jemand ebenfalls Munin ein und kann es gebrauchen.

Ich gehe dabei von einem fertig konfigurierten ispCP und Munin(-Node) aus. Mein verwendetes System ist ein Debian Etch.

1. Folgenden Code in /usr/share/munin/plugins/ispcp_mailuser speichern.

Code:
#!/bin/sh
#
# Autor : Knut Herter
# Datum : 26.12.2008
# Mail  : herter@systemtechnics.de
# Web   : www.systemtechnics.de
#
# Dies Plugin zeigt die Anzahl der angelegten Mailadresen in IspCP/vhcs2 an.
# Es wird dabei nicht zwischen einem Mailkonto oder Weiterleitung unterschieden!
#
# Wer mag kann dieses Plugin gerne lizenzfrei verwenden oder unveraendert weiter geben.
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf



# If run with the "autoconf"-parameter, give our opinion on wether we
# should be run on this system or not. This is optinal, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then

        echo 'graph_title Mailaddresses on Server'
        echo 'graph_args --upper-limit 1000 -l 0'
        echo 'graph_vlabel Mailaddresses on Server'
        echo 'graph_category postfix'
        echo 'mailbox.label Mailaddresses'
        exit 0
fi

# Verzeichnis der Mailkonten
VMAIL=/var/mail/virtual

# Zum testen. 1 = an , 0 = aus
DEBUG=0

#Domainliste
DOMAINLIST=`ls $VMAIL`

#Anzahl der Mailkonten zuruecksetzen
MAILANZ=0

for DOMAIN in $DOMAINLIST
do
    T=`ls $VMAIL/$DOMAIN |wc -l`
        if [ $DEBUG = "1" ]; then  
        echo $DOMAIN = $T Mailkonten
    fi
    MAILANZ=`expr $MAILANZ + $T`    
done

echo "mailbox.value $MAILANZ"

2. Ausführbar machen.
Code:
chmod +x /usr/share/munin/plugins/ispcp_mailuser

3. Logischen Link setzen.
Code:
cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/ispcp_mailuser

4. Die Konfiguration des Nodes editieren.
Code:
pico /etc/munin/plugin-conf.d/ munin-node
Folgendes einfügen:
Code:
[ispcp_mailuser]
user vmail

5. Munin-Node über das neue Plugin informieren. (Meine Erfahrung hat gezeigt, dass es nicht ausreicht das/die Node neu zu starten.
Code:
dpkg-reconfigure munin-node

Fertig.

Du findest die Grafik des Plugin unter dem Abschnitt Postfix. Anfangs wird sicherlich nicht viel zu sehen sein, über das Jahr gesehen erhoffe ich mir interessantere Grafiken :-)

Achja: Wem die Skalierung mit 1K (1000 Mailkonten) zu hoch ist braucht im Plugin einfach die Variable graph_args --upper-limit 1000 -l 0 ändern.

Download-Link vom Script : http://addons.isp-control.net/unofficial...net.tar.gz
(This post was last modified: 05-20-2009 01:55 AM by Knut.)
12-26-2008 05:35 PM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #2
RE: [MUNIN Plugin] Mailadresses on Server
Danke für deine Arbeit! Hab es nach SNIPPETS verschoben!
Thanks for your work. Moved it to SNIPPETS!

Greez BeNe
(This post was last modified: 12-31-2008 10:20 PM by BeNe.)
12-30-2008 10:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply
DiXeoN Offline
Member
***

Posts: 284
Joined: Feb 2008
Reputation: 2
Post: #3
RE: [MUNIN Plugin] Mailadresses on Server
Shouldn't this be in english? Smile

Just a though i got..
12-31-2008 01:20 AM
Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #4
RE: [MUNIN Plugin] Mailadresses on Server
Of course it should be in English. But it was posted in the German Thread and i moved it to here. Maybe someone could translate if for all ?

So many infos and small functions are in the (big) German Corner. And all get´s more and more lost for the rest of the Community here because they are all in german and not english Shy

Greez BeNe
12-31-2008 10:19 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ancdix Offline
Junior Member
*

Posts: 17
Joined: Mar 2008
Reputation: 0
Post: #5
RE: [MUNIN Plugin] Mailadresses on Server
little translation Big Grin
(12-26-2008 05:35 PM)Knut Wrote:  Hi,

i like using munin to monitor my server. munin should show me the amount of websites and emailadresses.
if someone else want to use munin to monitor his server here is the plugin.

The system requiers a complete installation of ispCP and Munin(-Node).
This plugin runs on Debian Etch.

1. Save this code over here -> /usr/share/munin/plugins/ispcp_mailuser

Code:
#!/bin/sh
#
# Autor : Knut Herter
# Datum : 26.12.2008
# Mail  : herter@systemtechnics.de
# Web   : www.systemtechnics.de
#
# Dies Plugin zeigt die Anzahl der angelegten Mailadresen in IspCP/vhcs2 an.
# Es wird dabei nicht zwischen einem Mailkonto oder Weiterleitung unterschieden!
#
# Wer mag kann dieses Plugin gerne lizenzfrei verwenden oder unveraendert weiter geben.
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf



# If run with the "autoconf"-parameter, give our opinion on wether we
# should be run on this system or not. This is optinal, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0
fi

if [ "$1" = "config" ]; then

        echo 'graph_title Mailaddresses on Server'
        echo 'graph_args --upper-limit 1000 -l 0'
        echo 'graph_vlabel Mailaddresses on Server'
        echo 'graph_category postfix'
        echo 'mailbox.label Mailaddresses'
        exit 0
fi

# Verzeichnis der Mailkonten
VMAIL=/var/mail/virtual

# Zum testen. 1 = an , 0 = aus
DEBUG=0

#Domainliste
DOMAINLIST=`ls $VMAIL`

#Anzahl der Mailkonten zuruecksetzen
MAILANZ=0

for DOMAIN in $DOMAINLIST
do
    T=`ls $VMAIL/$DOMAIN |wc -l`
        if [ $DEBUG = "1" ]; then  
        echo $DOMAIN = $T Mailkonten
    fi
    MAILANZ=`expr $MAILANZ + $T`    
done

echo "mailbox.value $MAILANZ"

2. make it executable.
Code:
chmod +x /usr/share/munin/plugins/ispcp_mailuser

3. Create the login link
Code:
cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/ispcp_mailuser

4. Edit the nodes config file.
Code:
pico /etc/munin/plugin-conf.d/ munin-node
Insert this:
Code:
[ispcp_mailuser]
user vmail

5. Reinitialise munin-non.
Code:
dpkg-reconfigure munin-node

Done

You'll find a graphic below the postfix stats.

PS: if the skale of the stats is to high (1000 Mailacounts) just change the Plugin variable graph_args --upper-limit 1000 -l 0


the translation is not perfect i know, but i think it's possible to understand Wink
(This post was last modified: 01-01-2009 11:54 PM by ancdix.)
12-31-2008 11:21 PM
Visit this user's website Find all posts by this user Quote this message in a reply
BeNe Offline
Moderator
*****
Moderators

Posts: 5,899
Joined: Jan 2007
Reputation: 68
Post: #6
RE: [MUNIN Plugin] Mailadresses on Server
Fine! Thanks man.

Greez BeNe
12-31-2008 11:52 PM
Visit this user's website Find all posts by this user Quote this message in a reply
DaSilva Offline
Member
***

Posts: 302
Joined: Dec 2007
Reputation: 0
Post: #7
RE: [MUNIN Plugin] Mailadresses on Server
Thanks for the handy plugins!
Can you make them dynamic like other plugins?
So that the graph always fits to the highest number?
Thanks.

And how can I add graphs for a month/year? Currently I can only see daily and weekly graphs...
02-16-2009 04:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Knut Offline
Member
***

Posts: 736
Joined: Nov 2006
Reputation: 10
Post: #8
RE: [MUNIN Plugin] Mailadresses on Server
(02-16-2009 04:13 AM)DaSilva Wrote:  Can you make them dynamic like other plugins?
So that the graph always fits to the highest number?
Thanks.

Remove this line
Code:
echo 'graph_args --upper-limit 1000 -l 0'
then
Code:
dpkg-reconfigure munin-node
wait a few minutes ...

(02-16-2009 04:13 AM)DaSilva Wrote:  And how can I add graphs for a month/year? Currently I can only see daily and weekly graphs...

Hmm... klick at the images ?

EDIT: I think for monthly images wait a week, for yearly images wait a month.


Knut
(This post was last modified: 02-16-2009 04:42 AM by Knut.)
02-16-2009 04:33 AM
Find all posts by this user Quote this message in a reply
DaSilva Offline
Member
***

Posts: 302
Joined: Dec 2007
Reputation: 0
Post: #9
RE: [MUNIN Plugin] Mailadresses on Server
Thanks Smile
02-16-2009 05:14 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Knut Offline
Member
***

Posts: 736
Joined: Nov 2006
Reputation: 10
Post: #10
RE: [MUNIN Plugin] Mailadresses on Server
Download Link for the Script : http://addons.isp-control.net/unofficial...net.tar.gz
05-20-2009 01:56 AM
Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)