DX Unified Infrastructure Management

  • 1.  Perl-based Probes: Tips & Tricks

    Posted Nov 19, 2008 04:27 AM
    Logging Perl-probe Crashes
    So you've written your first probe, sent it out into the world and everything is wonderful. The next day, you discover the probe is restarting and it isn't clear why. What to do? Log the crash!

    sub run {
        eval { run_code(); };
        if ( $@ ) {
            nimLog( 0, "PROBE CRASHED: $@" );
            die;
        }
    }
    The idea is to run your actual probe code within an eval{}; call. This allows us to catch the exceptions/errors like "Can't call method "0" on unblessed reference at ./my_buggy_probe.pl line 229.".


    Still Experiencing Unknown Restarts?
    In certain cases, the controller will restart your probe. What I've been told is that it is after your probe fails to respond to 4 _status callback requests with each having a timeout of 15 seconds. I don't know if these are back to back requests or have some sort of retry function that backs off on failure. With the logging method above, you'll be able to determine if it is your code or something else causing the probe to restart.

    References:

    perlfunc/eval


  • 2.  Perl-based Probes: Tips & Tricks

    Posted Nov 19, 2008 04:30 AM
    Using "die" may not be the best choice. I noticed that this seems to confuse the controller -- the probe keeps trying to restart (after the timeout period) but the controller shows it as deactivated. If you activate it again, it does correctly stop the existing process and start a new one.


  • 3.  Perl-based Probes: Tips & Tricks

    Posted Mar 22, 2009 02:50 AM
    I was able to get the number of restarts by the controller of my probe down to 0-3 per day but that still annoyed me. I solved this "problem" by using a queue. The probe works for ~ 30 seconds, returns to non-working status (concedes control to the API portion of the code) for 2 x the update interval, and repeats until the work is finished. This probe finishes well under our 5 minute interval time so that is not an issue. There are no no unknown restarts per day.

    I would have tried threads but the pre-5.10 perl SDK for Linux from Nimsoft did not support threading. Maybe that is possible in the newest SDK.