vatheck has asked for the wisdom of the Perl Monks concerning the following question:

I have flat log files if the form "unixtime,pcnumber,status". there are only entries for status changes. possible status would be reachable, unreachable, reachable but offline, and for each of those it could be standby or live. each pc could be in a different room. they are named something like room01pc01, and each room could have one or more pcs, usually 2 or 3.

I put something together that gives the pcnumber, the time it went down, the time it came up, and what the status was while it was down. I am trying to figure out a way to automatically figure out when every pc in one room is down. I can't seem to figure out a way to make this work, any one here at the monastery care to get me pointed in the right direction.

Replies are listed 'Best First'.
Re: trouble with where to start
by GrandFather (Saint) on Oct 10, 2008 at 04:50 UTC

    Build a data structure that contains an entry for each room. For each room maintain a count of the PCs in each state. Parse through the log file and update the counts. When you decrement the "up" count for a room to zero you have an "all down start" event. When you increment the "up" count in a room from zero you have an "all down end" event.


    Perl reduces RSI - it saves typing
Re: trouble with where to start
by dHarry (Abbot) on Oct 10, 2008 at 08:03 UTC

    I put something together that gives...

    Why don't you show some code so we can have a go at it?