Negotiation cycle statistics

If you have ever wondered how your Negotiator is doing, you may be interested in this AWK script. It summarizes negotiation cycles by reading NegotiatorLog output.

You can either pass it your NegotiatorLog or, if you want to only summarize recent cycles, combine tail -n and a pipe.

#!/usr/bin/awk -f

function parse_time(string) {
   return mktime(gensub(/([^/]*)\/([^ ]*) ([^:]*):([^:]*):([^ ]*) .*/,
                        "1984 \\1 \\2 \\3 \\4 \\5", "g"))
}

BEGIN { started = 0; finished = 0 }

/Started Negotiation Cycle/ {
   started = parse_time($0)
#   if (finished) print "Delay:", started - finished
   finished = 0; matched = 0; rejected = 0; submitters = 0; slots = 0
}

/Matched/ {
   matched += 1
}

/Rejected/ {
   rejected += 1
}

/Public ads include .* submitter, .* startd/ {
   submitters = $6
   slots = $8
}

/Finished Negotiation Cycle/ {
   finished = parse_time($0)
   if (!started) next #{ print "Skipping first cycle"; next }
#   if (!matched) next #{ print "Skipping cycle with no matches"; next }
   duration = finished - started
   if (!duration) next # { print "Skipping zero second cycle"; next }
   print strftime("%m/%d %T", started), "::",
       matched, "matches in",
       duration, "seconds",
       "(" matched / duration "/s) with",
       rejected, "rejections,",
       submitters, "submitters,",
       slots, "slots"
}

END {
   #if (!finished) print "Skipping last cycle"
}

Condor’s debug logs do not include a year or timezone in their timestamp, so cycles that span years or daylight savings periods will produce bogus results.

Tags: , ,

One Response to “Negotiation cycle statistics”

  1. No Name Says:

    Ths is very useful. Is it possible to do something simular for schedd? and the collector?

    I plan to write something which will put all 3 logs (schedd, Neg, collector) onto 1 screen…

Leave a comment