tcp response time graph

Tedman Eng teng at dataway.com
Sun Oct 26 00:23:29 CEST 2003


It would be useful to update the apan.sourceforge.net site with this info.



"Fredrik Wänglund" <fredrik.wanglund at datavis.se> wrote in message
news:3F99370B.5070208 at datavis.se...
Heres a new plugin for Apan that uses check_tcp

How to use it to check port 80 and 22 on a host:

- Replace the existing apan.sh with this one (make a backup first..)
- Save tcp.sh in apans plugs-directory
- Define a service in Nagios:

    define service {
    host_name                      bandit
    service_description            TCP
    check_command                  apan!tcp!1!2
    ...
    }

- Add the service to apan.cfg:
bandit;TCP;/usr/local/nagios/rrd/bandit_tcp.rrd;80|22;port-80:LINE2
port-22:LINE2;TCP responce-time;seconds

- Create the rrd:
rrdtool create bandit_tcp.rrd -s 60 DS:port-80:GAUGE:900:0:U
DS:port-22:GAUGE:900:0:U RRA:AVERAGE:0.5:1:50400 RRA:AVERAGE:0.5:60:43800


- Define extinfo in Nagios:
    define serviceextinfo{
    host_name               bandit
    service_description     TCP
    notes_url            /nagios/cgi-bin/apan.cgi?host=bandit&service=TCP
    icon_image              graph.png
    icon_image_alt          View graphs
    }

DONE!


/FredrikW



Jesús Oliván wrote:
> hi,
>
> i'm creating reports with apan about 50 hosts ping response. Now i need to
> create more graphs with an specific tcp port response time, for example:
if
> i got a service who make periodic check_tcp to some host's port 515 i'll
> receive this: TCP OK - 0.051 second response time on port 515.
>
> I want to receive a graph about this port's response times, like apan do
> with ping, disk_load, etc.
>
> Thx in advance.
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: The SF.net Donation Program.
> Do you like what SourceForge.net is doing for the Open
> Source Community?  Make a contribution, and help us add new
> features and functionality. Click here: http://sourceforge.net/donate/
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null



----------------------------------------------------------------------------
----


> #!/bin/bash
>
> # Change this if you are not installing apan in /usr/local/nagios/apan
> DEFSFILE=/usr/local/nagios/apan/apan.defs
> #
> # Don't change anything below...
> #
>
> # Source the configuration
> . $DEFSFILE
>
> #Source the plugin-functions
> for file in $PLUGSDIR/*.sh; do
> . $file
> done
>
> #debug "`date` Args: $*"
>
> #Read arguments from the command-line
> CHECK=$1
> HOST=$2
> SVCNAME=$3
> TIME=$4
> WARN=$5
> CRIT=$6
> XARGS=$7
>
> RETVAL=0
> RETSTR=""
>
> #Get configuration for this service
> CONF=`grep "^${HOST};${SVCNAME};" $CFGFILE`
> ARGS="`echo $CONF|cut -d ";" -f 4`"
> NAMES=`echo $CONF|cut -d ";" -f 5`
> RRDFILE=`echo $CONF|cut -d ";" -f 3`
>
> if [ "$CONF" = "" ]; then
> ERR=1
> RETVAL=3
> RETSTR="Apan could not find service."
> else
>
> N=0
> ERR=0
> DATA="$TIME"
> TEMPL=""
> # Make a array of DS-names
> for DS in $NAMES; do
> NAMELIST[N]=`echo $DS|cut -d ":" -f 1`
> N=`expr $N + 1`
> done
> N=0
>
> #debug "`date` $HOST: $CHECK"
> ################################################################3
> case $CHECK in
> disk) disk
> ;;
> nt-net) nt_net
> ;;
> nt_disk) nt_disk
> ;;
> nt_disk2) nt_disk2
> ;;
> nt_smtp) nt_smtp
> ;;
> nt_load) nt_load
> ;;
> load) load
> ;;
> ping) ping
> ;;
> ping_any) ping_any
> ;;
> lxk_pages) lxk_pages
> ;;
> snmpget) snmpget
> ;;
> disk_by_snmp) disk_by_snmp
> ;;
>         disk_by_snmp2) disk_by_snmp_test
>         ;;
> proc_by_snmp) proc_by_snmp
> ;;
> http) http
> ;;
> tcp) tcp
> ;;
> *)
> debug "`date` Unknown service $HOST:$CHECK"
> RETSTR="Unknown Apan-service: $CHECK"
> RETVAL=3
> ERR=1
> ;;
> esac
>
> fi
> if [ $ERR = 0 ]; then
> if [ `echo $TEMPL|cut -b 1-1` = ":" ]; then
> TEMPL=`echo $TEMPL|cut -b 2-`
> fi
> $RRDTOOL update $RRDFILE -t $TEMPL $DATA
> #debug "`date` Inserting '$TEMPL' , '$DATA' into $RRDFILE"
> else
> debug "`date` ${HOST}:${SVCNAME}, Could not insert '$TEMPL' , '$DATA' into
$RRDFILE"
> fi
>
> #debug "Returning '$RETSTR' , $RETVAL"
> echo $RETSTR
> exit $RETVAL
>


----------------------------------------------------------------------------
----


>
> tcp() {
> RETSTR=""
> #debug "TCP: $HOST, '$ARGS'"
> for PORT in `echo $ARGS|tr "|" " "`; do
> RES=`$PLUGINSDIR/check_tcp -H $HOST -p $PORT -w $WARN -c $CRIT`
> STATUS=$?
> if [ $STATUS -gt 2 ]; then
> RETVAL=3
> RETSTR="$RETSTR $RES"
> ERR=1
> break
> fi
> #RTT=`echo $RES|cut -d "," -f 2|cut -d "=" -f 2|tr  -d " [a-zA-Z]"`
>                 RT=`echo $RES|awk -F "|" '{print $NF}'|tr -d -c "0-9."`
>                 RES=`echo $RES|awk -F "|" '{print $1}'`
>
> #debug "`date` TCP: $HOST, $STATUS, '$RES', $RT"
>
> DSNAME=${NAMELIST[$N]}
> if [ $RETVAL -lt $STATUS ]; then
> RETVAL=$STATUS
> fi
> TEMPL=`echo "${TEMPL}:$DSNAME"`
> DATA=`echo "${DATA}:$RT"`
> N=`expr $N + 1`
> RETSTR="$RETSTR $RES"
> done
> }
>
>
>
>





-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list