ispCP - Board - Support
[MUNIN Plugin] Kunden und Websites auf dem Server - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Contributions Area (/forum-40.html)
+--- Forum: Snippets (/forum-42.html)
+--- Thread: [MUNIN Plugin] Kunden und Websites auf dem Server (/thread-5314.html)



[MUNIN Plugin] Kunden und Websites auf dem Server - Knut - 01-02-2009 04:28 PM

English (short Version) below

Um die Anzahl meiner Kunden und deren Domains im Auge zu behalten verwende ich gerne die grafischen Möglichkeiten von Munin.
Wie man anhand "meiner" beiden Plugin hier im Forum sehen kann ist es auch nicht schwer eigene interessante Scripte zu schreiben.

sample picture:
[Image: 02.0172lql6za0ul1lrx.png]

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_vsites speichern.

Code:
#!/bin/sh
#
# Autor : Knut Herter
# Datum : 28.3.2008
# Mail  : herter@systemtechnics.de
# Web   : www.systemtechnics.de
#
# Dies Plugin zeigt die Anzahl der Kundensites in IspCP/vhcs2 an.
#
# 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 Virtual Sites on Server'
        echo 'graph_args --upper-limit 100 -l 0'
        echo 'graph_vlabel Sites on Server'
        echo 'graph_category Disk'
        echo 'kunden.label Kunden'
    echo 'sites.label Domains'
        exit 0
fi


site=`ls /var/www/virtual |wc -l`
echo "kunden.value $site"
sites=`ls /var/mail/virtual |wc -l`
echo "sites.value $sites"

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

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

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

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 Grafiken bei Munin im Abschnitt DISK

Download Link für das Script : http://addons.isp-control.net/unofficial/ispcp_vsites_www.isp-control.net.tar.gz

---- ENGLISH VERSION ---

Hi,

i like using munin to monitor my server. munin should show me the amount of websites and domains.
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_vsites

Code:
#!/bin/sh
#
# Autor : Knut Herter
# Datum : 28.3.2008
# Mail  : herter@systemtechnics.de
# Web   : www.systemtechnics.de
#
# Dies Plugin zeigt die Anzahl der Kundensites in IspCP/vhcs2 an.
#
# 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 Virtual Sites on Server'
        echo 'graph_args --upper-limit 100 -l 0'
        echo 'graph_vlabel Sites on Server'
        echo 'graph_category Disk'
        echo 'customer.label Customer'
    echo 'sites.label Domains'
        exit 0
fi


site=`ls /var/www/virtual |wc -l`
echo "customer.value $site"
sites=`ls /var/mail/virtual |wc -l`
echo "sites.value $sites"

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

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

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

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

Done.

Download Link for the script : http://addons.isp-control.net/unofficial/ispcp_vsites_www.isp-control.net.tar.gz

You will find the graphic below the DISK stats


RE: [MUNIN Plugin] Kunden und Websites auf dem Server - mr.x - 01-03-2009 05:52 AM

Hi Knut,

Danke
Habe es eben mal ausprobiert. Geht super !

Jan


RE: [MUNIN Plugin] Kunden und Websites auf dem Server - DaSilva - 02-16-2009 04:02 AM

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...


RE: [MUNIN Plugin] Kunden und Websites auf dem Server - Knut - 02-16-2009 04:37 AM

(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 100 -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


RE: [MUNIN Plugin] Kunden und Websites auf dem Server - DaSilva - 02-16-2009 06:43 AM

Thanks Smile