monitorizarea activitatii Oscam-ului folosind iptraf si munin:
succesuri!Code:#!/bin/sh # oscam_traffic v0.22 # # special thanx to: cyres # # Monitoring LOCAL running OScam's traffic using iptraf # # HowTo: # apt-get install iptraf # run ' iptraf ' as root and go to Configure... Timers... # change Logging interval... to your Munin-update-interval (default: 5min) # go to Additional ports... and add your OScam-Server-Port # Exit iptraf and start it into background: # iptraf -s eth0 -B # by default eth0 is the first network device of your server (check with: ifconfig) # ### CONFIG - START # SERVER PORT of your OScam-Server for iptraf (default: 33000) OSCAMPORT="33000" # Network Device on which your OScam-Server runs on (default: eth0) NETDEVICE="eth0" # Directory where iptraf saves the logfiles (default: /var/log/iptraf) IPTRAFlogdir="/var/log/iptraf" # Display also Total Traffic? (yes/no) WITHtotal="yes" # If we'r displaying Total Traffic should it draw the complete # AREA or only a simple LINE1 like it does with traffic IN and OUT? (LINE1/AREA) # (area looks better) TOTALdraw="AREA" ### CONFIG - END # -------------------------------------------------------------- # # >>> >> > DO NOT MESS WiTH ANYTHiNG BELOW THiS LiNE! < << <<< # # -------------------------------------------------------------- # if [ "$TOTALdraw" != "AREA" ] && [ "$TOTALdraw" != "LINE1" ]; then TOTALdraw="AREA" fi if [ -z "$OSCAMPORT" ]; then OSCAMPORT="33000" elif [ -z "$NETDEVICE" ]; then NETDEVICE="eth0" elif [ -z "$IPTRAFlogdir" ]; then IPTRAFlogdir="/var/log/iptraf" fi if [ "$1" = "config" ]; then echo "graph_info This graph shows the OScam traffic on the $NETDEVICE network interface." echo 'graph_title OScam Traffic' echo 'graph_category OScam' echo 'graph_args --base 1024 -l 0' echo 'graph_vlabel Bytes/sec' if [ "$WITHtotal" = "yes" ]; then echo 'graph_order traffictotal trafficin trafficout' echo 'traffictotal.label Total traffic' echo 'traffictotal.type DERIVE' echo 'traffictotal.draw '$TOTALdraw'' echo 'traffictotal.min 0' echo 'traffictotal.cdef traffictotal,8,*' else echo 'graph_order trafficin trafficout' fi echo 'trafficin.label traffic IN' echo 'trafficin.type DERIVE' echo 'trafficin.draw LINE1' echo 'trafficin.min 0' echo 'trafficin.cdef trafficin,8,*' echo 'trafficout.label traffic OUT' echo 'trafficout.type DERIVE' echo 'trafficout.draw LINE1' echo 'trafficout.min 0' echo 'trafficout.cdef trafficout,8,*' exit 0 fi LOG="$IPTRAFlogdir/tcp_udp_services-${NETDEVICE}.log" TRAFFIC=$(grep "TCP/$OSCAMPORT" $LOG | tail -n1 | cut -f1 -d";" | cut -f4 -d" ") TRAFFICIN=$(grep "TCP/$OSCAMPORT" $LOG | tail -n1 | cut -f2 -d";" | cut -f4 -d" ") TRAFFICOUT=$(grep "TCP/$OSCAMPORT" $LOG | tail -n1 | cut -f3 -d";" | cut -f4 -d" ") if [ -z "$TRAFFIC" ]; then TRAFFIC=0 elif [ -z "$TRAFFICIN" ]; then TRAFFICIN=0 elif [ -z "$TRAFFICOUT" ]; then TRAFFICOUT=0 fi if [ "$WITHtotal" = "yes" ]; then echo "traffictotal.value ${TRAFFIC}" fi echo "trafficin.value ${TRAFFICIN}" echo "trafficout.value ${TRAFFICOUT}"![]()


Thanks:
Likes:
Dislikes: 

Reply With Quote