Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, Being newbie to this forum I may have placed this in wrong category, or the discussion has already been completed, if so please forgive my ignorance From time to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2013
    Posts
    3

    Detection script for dhcp clients gone 'nuts'


    Hi,
    Being newbie to this forum I may have placed this in wrong category, or the discussion has already been completed, if so please forgive my ignorance

    From time to time, say 2-3 times per year, I've seen voip phones going nuts sending hundreds of DHCPREQUEST per second to all voip dhcp servers.
    Logs are filled with lots of unnecessary data and should it go on to long without us detecting it the files do tend to grow quite large, particularly if it goes on over an entire weekend.

    Long explanation, but finally my question:
    How would I go about making a script to monitor this and sends a report, sendmail should be fine, once/if the issue reappears?

    I've found no options in dhcpd to perform what I would like to do, but perhaps I'm missing something


    Thanks for your time,
    Mr_Bob

  2. #2
    Just Joined!
    Join Date
    Sep 2008
    Location
    Earth
    Posts
    51
    Are there any strings in the log file which are unique to this situation. In an enterprise environment using nagios or other enterprise tools to monitor the log size or contents would be preferred, but if you dont have access to that you can use grep to find string and pending result send email, or monitor filesize with ls and trigger alert when that condition is met.

    Let me know log file and condition and I'll help you write something for it.

  3. #3
    Just Joined!
    Join Date
    Apr 2013
    Posts
    3
    Doh! Thanks!
    Of course, that's why I find getting another set of eyes on the issue helps
    I've been so focused on the MAC I haven't seen that there could be a much easier way to get it

    A script I call from crontab seeing if size between two times has grown unexpectedly, if so triggering an alert

    Nagios.. yea, we're moving away from group monitoring tools in favor of a corp one for all servers
    If I could show the usefulness of that size monitoring, with a help of a script, it would be easier getting it in from corp side

  4. #4
    Just Joined!
    Join Date
    Sep 2008
    Location
    Earth
    Posts
    51
    something quick and dirty.
    #!/bin/bash -x
    FILE="apple.log"
    STATE=".apple.log"
    COMMAND="ls -s apple.log"
    CURRENT=`$COMMAND | awk '{print $1}'` # Current Size in kb

    DIFFERENCE=4 # Difference in kb
    if [ $CURRENT -gt "$DIFFERENCE" ];then
    $COMMAND | awk '{print $1}' > $STATE

    echo "ALERT" | mail -s "ALERT" root@localhost
    $COMMAND | awk '{print $1}' > $STATE

    else
    $COMMAND | awk '{print $1}' > $STATE
    fi

  5. #5
    Just Joined!
    Join Date
    Apr 2013
    Posts
    3
    Quote Originally Posted by Pimpntel View Post
    something quick and dirty.
    #!/bin/bash -x
    FILE="apple.log"
    STATE=".apple.log"
    COMMAND="ls -s apple.log"
    CURRENT=`$COMMAND | awk '{print $1}'` # Current Size in kb

    DIFFERENCE=4 # Difference in kb
    if [ $CURRENT -gt "$DIFFERENCE" ];then
    $COMMAND | awk '{print $1}' > $STATE

    echo "ALERT" | mail -s "ALERT" root@localhost
    $COMMAND | awk '{print $1}' > $STATE

    else
    $COMMAND | awk '{print $1}' > $STATE
    fi
    Apologies for the late reply, had a nuts beginning of the week..

    Thanks! I'll give it a go and see how it works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •