Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hey all

Hoping that someone can give me a hand with this one...

A while back now I created a script which queries a MySQL database with the goal being to send email notifications to the proper tech support staff. It's pretty basic stuff,

If SlotA = Value AND SlotB = Value AND SlotN = value then notify GroupA

So if all the Slots and values in the event match what we have in the DB, then we know who or what group to send the event to. The issue is that it's based completely on AND statements.

The problem that I have found with this method is that I have to create/maintain a ton of filters since all the slots/values have to match.

What I would like to do is something like the following,

If SlotA = Value and SlotB = Value and (SlotC = value OR SlotC = value) then notify GroupA

Anyone have any tips on how to tackle this?

Without getting into too much detail about the DB structure I have one table which holds all my filter information. Here's it structure,

id int(3)
fgid int(3)
slot varchar(20)
value varchar(55)

So an example of a filter might look something like this,

1 - 1 - slotA - value
2 - 1 - slotB - value
3 - 1 - slotC - value
4 - 1 - slotC - value

I am hung up on how to construct the logic in situations where a single slot can have multiple values...the original method with to simply dump all the values from the DB into a Hash and then check that slot/value combos against what was being received from the monitoring system...I am hung up on how to do the "OR" statements...

Any suggestions would be appreciated...

In reply to Building a notification system based on MySQL by shank098

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-05-26 20:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found