Current time: 05-03-2024, 05:16 PM Hello There, Guest! (LoginRegister)


Post Reply 
proftpd munin telepítési probléma
Author Message
romantik Offline
Junior Member
*

Posts: 54
Joined: Mar 2009
Reputation: 0
Post: #1
proftpd munin telepítési probléma
Feltettem a közösbe, de hátha itt van nagyobb agy Wink

Az alap probléma: munint használok, és feltettem két plugint hozzá:
proftpd_count
proftpd_bytes

A probléma az, hogy semmit nem rajzol az istenátka... Valakinek van ötlete mit kéne módosítani a konfigján?

Én már oda-vissza mókoltam, de semmi eredménye...

Mielőtt kérdeznétek: ez az eredeti script, de az xferlog elérését módosítottam erre:
Code:
/var/log/proftpd/xferlog

proftpd_count:
Code:
#!/bin/bash
#
# Plugin to monitor FTP files.
# based on previous work by jintxo
#
# Parameters understood:
#
#     config   (required)
#     autoconf (optional)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf

MAXLABEL=20

mktempfile () {
mktemp -t $1
}      

LOGFILE=${logfile:-/var/log/xferlog}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/xferlog-count.offset

if [ "$1" = "autoconf" ]; then
        if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
        echo yes
        exit 0
    else
        echo no
        exit 1
    fi
fi

if [ "$1" = "config" ]; then
        echo 'graph_title FTP Server Transfers'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel FTP Server Transfers'
    echo 'graph_category FTP'
        echo 'ftp_get.label Files GET'
        echo 'ftp_put.label Files PUT'
        exit 0
fi


ftp_get=U
ftp_put=U

TEMP_FILE=`mktempfile munin-xferlog-count.XXXXXX`

if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
    $LOGTAIL ${LOGFILE} $STATEFILE | grep "[[:space:]][oi][[:space:]]" > ${TEMP_FILE}
    ftp_get=`grep "[[:space:]]o[[:space:]]" ${TEMP_FILE} | wc -l`
    ftp_put=`grep "[[:space:]]i[[:space:]]" ${TEMP_FILE} | wc -l`

    /bin/rm -f $TEMP_FILE
fi

echo "ftp_get.value ${ftp_get}"
echo "ftp_put.value ${ftp_put}"


proftpd_bytes:
Code:
#!/bin/bash
#
# Plugin to monitor FTP bytes.
# based on previous work by jintxo
#
# Parameters understood:
#
#     config   (required)
#     autoconf (optional)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf

MAXLABEL=20

mktempfile () {
mktemp -t $1
}      

LOGFILE=${logfile:-/var/log/xferlog}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/xferlog-bytes.offset

if [ "$1" = "autoconf" ]; then
        if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
        echo yes
        exit 0
    else
        echo no
        exit 1
    fi
fi

if [ "$1" = "config" ]; then
        echo 'graph_title FTP Server Bytes'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel FTP Server Bytes'
    echo 'graph_category FTP'
        echo 'ftp_get.label Bytes GET'
        echo 'ftp_put.label Bytes PUT'
        exit 0
fi


ftp_get=U
ftp_put=U

TEMP_FILE=`mktempfile munin-xferlog-bytes.XXXXXX`

if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
    $LOGTAIL ${LOGFILE} $STATEFILE | grep "[[:space:]][oi][[:space:]]" > ${TEMP_FILE}
    ftp_get=`grep "[[:space:]]o[[:space:]]" ${TEMP_FILE} | awk '{s += $8} END { if ( s ) print s ; else print "0" }'`
    ftp_put=`grep "[[:space:]]i[[:space:]]" ${TEMP_FILE} | awk '{s += $8} END { if ( s ) print s ; else print "0" }'`

    /bin/rm -f $TEMP_FILE
fi

echo "ftp_get.value ${ftp_get}"
echo "ftp_put.value ${ftp_put}"


Ötlet?
11-25-2010 06:30 PM
Find all posts by this user Quote this message in a reply
Dylan Offline
Junior Member
*

Posts: 100
Joined: Mar 2010
Reputation: 1
Post: #2
RE: proftpd munin telepítési probléma
Sajnos ötletem nincs, viszont engem is érdekelne, mert akkor énis beletenném a muninba. Smile
11-25-2010 11:39 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dylan Offline
Junior Member
*

Posts: 100
Joined: Mar 2010
Reputation: 1
Post: #3
RE: proftpd munin telepítési probléma
Na feltettem most én is, hamarosan kiderül, hogy nálam működik e.
03-09-2011 10:49 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dylan Offline
Junior Member
*

Posts: 100
Joined: Mar 2010
Reputation: 1
Post: #4
RE: proftpd munin telepítési probléma
Hát nem müxik. Sad De ahogy nézem google találatok alapján, sehol se müxik, mindenhol 0-án húzza a csíkot. Gyanítom, hogy a log fájl szerkezete változhatott, nyomozom a dolgot.
03-10-2011 12:02 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Mono Offline
Junior Member
*

Posts: 58
Joined: Aug 2009
Reputation: 0
Post: #5
RE: proftpd munin telepítési probléma
Na hát ez engem is érdekelne!
03-10-2011 04:35 AM
Find all posts by this user Quote this message in a reply
romantik Offline
Junior Member
*

Posts: 54
Joined: Mar 2009
Reputation: 0
Post: #6
RE: proftpd munin telepítési probléma
(03-10-2011 12:02 AM)Dylan Wrote:  Hát nem müxik. Sad De ahogy nézem google találatok alapján, sehol se müxik, mindenhol 0-án húzza a csíkot. Gyanítom, hogy a log fájl szerkezete változhatott, nyomozom a dolgot.


nézegettem én is, remélem te nagyobb sikerrel jársz!
03-10-2011 04:35 AM
Find all posts by this user Quote this message in a reply
Dylan Offline
Junior Member
*

Posts: 100
Joined: Mar 2010
Reputation: 1
Post: #7
RE: proftpd munin telepítési probléma
Hát.. kezdtem feladni. Mikor shellben lefuttattam a plugint, akkor kaptam egy hibaüzenetet, hogy permission denied. Nem tudta olvasni az xferlog fájlt.
Aztán az mktempfile függvénnyel volt valami gáz, kivettem belőle.
Végre elkezdte beolvasni a fájlt, de folyton értelmezni és futtatni akarja a logfájl tartalmát, azt írja, hogy rossz parancs...
Namost a tesztelés közben valami változott, mert most meg "Text file busy" üzenetet kapok, tehát megint nem tudja olvasni a xferlog tartalmát...

Kezdem elveszíteni a türelmemet. Amúgy gyanítom, hogy az awk résznél van valami hiba, csak nem ismerem ezt, hogy mi alapján parseolja a sor tartalmát. Elvileg a 8. oszlopban van a feltöltött fájl mérete, de valamiért ez az egész sort beolvassa és hozzáadja az "s" értékéhez...
Ha van itt hozzáértő bash script író, megköszönném a segítségét. Smile
Na mire megírtam a hozzászólást, megint le tudom futtatni.
Szóval ennyit ír most:
"/var/log/proftpd/xferlog: line 1: Web: command not found"

Ebből nekem az jön le, hogy valamiért futtatni akarja a sorban levő értéket éshát ugye nincs olyan parancs, hogy Wed. Ötlet?
(This post was last modified: 03-10-2011 07:26 AM by Dylan.)
03-10-2011 07:22 AM
Visit this user's website Find all posts by this user Quote this message in a reply
romantik Offline
Junior Member
*

Posts: 54
Joined: Mar 2009
Reputation: 0
Post: #8
RE: proftpd munin telepítési probléma
én ott feladtam, hogy futtatni akarta...
03-10-2011 08:06 AM
Find all posts by this user Quote this message in a reply
Dylan Offline
Junior Member
*

Posts: 100
Joined: Mar 2010
Reputation: 1
Post: #9
RE: proftpd munin telepítési probléma
Na ugy néz ki, hogy sikerül, legalábbis most sikerült shell-ben a várt eredményt visszaadnia. Pár órán át tesztelem, aztán ha jól működik akkor felteszem a megoldást.
03-10-2011 05:18 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Dylan Offline
Junior Member
*

Posts: 100
Joined: Mar 2010
Reputation: 1
Post: #10
RE: proftpd munin telepítési probléma
Siker! Smile
   
   

A logtail sort vettem ki. (ftp_get=... felett)
A teljes script:
proftpd_bytes-v1
Code:
#!/bin/bash
#
# Plugin to monitor FTP bytes.
# based on previous work by jintxo
#
# Parameters understood:
#
#     config   (required)
#     autoconf (optional)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf

MAXLABEL=20

mktempfile () {
mktemp -t $1
}      

LOGFILE=${logfile:-/var/log/proftpd/xferlog}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE='/var/lib/munin/plugin-state/xferlog-bytes.offset'

if [ "$1" = "autoconf" ]; then
        if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
        echo yes
        exit 0
    else
        echo no
        exit 1
    fi
fi

if [ "$1" = "config" ]; then
        echo 'graph_title FTP Server Bytes'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel FTP Server Bytes'
    echo 'graph_category FTP'
        echo 'ftp_get.label Bytes GET'
        echo 'ftp_put.label Bytes PUT'
        exit 0
fi


ftp_get=U
ftp_put=U

TEMP_FILE=`mktempfile munin-xferlog-bytes.XXXXXX`

if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
    grep "[[:space:]][oi][[:space:]]" > ${TEMP_FILE} ${LOGFILE}
    ftp_get=`grep "[[:space:]]o[[:space:]]" ${TEMP_FILE} | awk '{s += $8} END { if ( s ) print s ; else print "0" }'`
    ftp_put=`grep "[[:space:]]i[[:space:]]" ${TEMP_FILE} | awk '{s += $8} END { if ( s ) print s ; else print "0" }'`

    /bin/rm -f $TEMP_FILE
fi

echo "ftp_get.value ${ftp_get}"
echo "ftp_put.value ${ftp_put}"

proftpd_count-v1
Code:
#!/bin/bash
#
# Plugin to monitor FTP files.
# based on previous work by jintxo
#
# Parameters understood:
#
#     config   (required)
#     autoconf (optional)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf

MAXLABEL=20

mktempfile () {
mktemp -t $1
}      

LOGFILE=${logfile:-/var/log/proftpd/xferlog}
LOGTAIL=${logtail:-`which logtail`}
STATEFILE=/var/lib/munin/plugin-state/xferlog-count.offset

if [ "$1" = "autoconf" ]; then
        if [ -f "${LOGFILE}" -a -n "${LOGTAIL}" -a -x "${LOGTAIL}" ] ; then
        echo yes
        exit 0
    else
        echo no
        exit 1
    fi
fi

if [ "$1" = "config" ]; then
        echo 'graph_title FTP Server Transfers'
        echo 'graph_args --base 1000 -l 0'
        echo 'graph_vlabel FTP Server Transfers'
    echo 'graph_category FTP'
        echo 'ftp_get.label Files GET'
        echo 'ftp_put.label Files PUT'
        exit 0
fi


ftp_get=U
ftp_put=U

TEMP_FILE=`mktempfile munin-xferlog-count.XXXXXX`

if [ -n "$TEMP_FILE" -a -f "$TEMP_FILE" ]
then
    grep "[[:space:]][oi][[:space:]]" > ${TEMP_FILE} ${LOGFILE}
    ftp_get=`grep "[[:space:]]o[[:space:]]" ${TEMP_FILE} | wc -l`
    ftp_put=`grep "[[:space:]]i[[:space:]]" ${TEMP_FILE} | wc -l`

    /bin/rm -f $TEMP_FILE
fi

echo "ftp_get.value ${ftp_get}"
echo "ftp_put.value ${ftp_put}"
(This post was last modified: 03-10-2011 07:06 PM by Dylan.)
03-10-2011 07:04 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: