Ad Widget

Collapse

Zabbix Monitoring the packet size on a particular port.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GLSIIInj
    Junior Member
    • Nov 2020
    • 2

    #1

    Zabbix Monitoring the packet size on a particular port.

    First of all I'm a noob.. I've only been using Zabbix for little over a year now. My particular situation, and something I have been searching for, and haven't been able to find, ( I searched this forum and couldn't find it ). my lack of terminology might be the issue in my poor search results.
    In any case.

    I am currently monitoring a specific port using
    tcpdump -i any port 31983

    the output shows a "length" of either zero ( a valid keep alive signal ) and 495 the proper size of the actual data being sent from a client. ( that number changes on the client being served ).

    I would love to be able to allow zabbix to monitor that length and if there is any variation from those two lengths for a given period of time trigger an alert.

    Have any ideas??


  • GLSIIInj
    Junior Member
    • Nov 2020
    • 2

    #2
    I was able to write a script to gather that data and send it to zabbix..
    and created a trap within a zabbix template which captures the data when sent..

    now working on the triggers ( no data for so many minutes, and a check on the value of the item sent to the server) and the cleanup script to get rid of the zabbix data log


    #/bin/bash
    $ZABBIX_HOST=my-host
    $ZABBIX_SERVER=my-server
    $ZABBIX_LOG=/dev/null
    $TIMESTAMP= $(date "+%Y.%m.%d-%H.%M.%S")
    $ZABBIX_DATA=/tmp/zbxPortdata_$TIMESTAMP.log
    {
    port_a=tcpdump -c 1 -l dst port 31981 | awk {print $21}
    port_b=tcpdump -c 1 -l dst port 31982 | awk {print $21}
    } &> /dev/null

    echo "$ZABBIX_HOST" key.port.31981 $port_a >> $ZABBIX_DATA
    echo "$ZABBIX_HOST" key.port.31982 $port_b >> $ZABBIX_DATA

    zabbix_sender -z zabbix_server -i $ZABBIX_DATA

    Comment

    Working...