Announcement

Collapse
No announcement yet.

WhoIs triggers don't fire

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    WhoIs triggers don't fire

    Jon, recently installed your excellent "plug-in" for tracking visitors. No problems with the installation, ASP shows the correct log entries, and the device strings and last change values of the Failed and Guest devices are correctly updated almost immediately after the respective login attempts. However I can't seem to get my Failed and Guest events to fire. I have tried both 'DeviceStatus changed to *ANY*' and 'DeviceValue Set to Any' without success. The events Last Run values remain 'Unknown'. Any thoughts?

    Michael

    #2
    Bump!

    Comment


      #3
      Michael,

      Sorry, totally missed this post.

      The devicestatus etc is not explicitly set in the script. The best thing would be to add a few lines of code to assist you.

      Open up Jon00Whois.vb in a text editor.

      Find the line:

      hs.setdevicestring (UDevCode,"<img src='" & ImagePath & "/whois.gif' height='16'> " & DT & " IP : " & IP & " Country: " & Country,True)

      Immediately after this line add the following code and then save:

      IP = Trim(Replace(IP,".",""))
      If IsNumeric(IP) then hs.setdevicevalue (UDevCode,IP)
      hs.setdevicelastchange(UDevCode,Now())

      You should now be able to trigger on devicevalue change etc
      Jon

      Comment


        #4
        Thanks. That's what I was looking for and I didn't want to open up your code to find it. How did you intend the triggers to be used? Did I miss something in my set up?

        Michael

        Comment


          #5
          I've never used it for triggers (and it looks like no-one else has too!). The virtual devices were just to display the last person for guest/failed/authorised.
          Jon

          Comment


            #6
            I added the code you provided and let things run. Didn't have time to pick it up again until this week. I've never been able to get my events to fire, using DeviceValue - Set Any, or any other trigger.

            I looked into the code and did some debugging. It seems that the DeviceValues are not being set, though the script sets them. I put log entries around the SetDeviceValue instruction, created a separate IP2 var to acquire the DeviceValue after it is supposed to be set, and find that it never changes. Even though the DeviceString is being properly set the DeviceValue has not changed through 10 -15 attempts at each of the log types. I also made sure that the IsNumeric test is not failing and we're missing the error - no help. Now I understand why the trigger doesn't fire. But, what could be causing the DeviceValue to remain unchanged?

            Don't spend a lot of time on this, but if you're curious I'm interested in what you find.

            Thanks,
            Michael

            Comment


              #7
              What value does it stay at? Do you by chance have another script/plugin on the same housecode?

              I'll put it on the list to look at.
              Jon

              Comment


                #8
                I checked my device codes and found none on "Q" nor do I have any events using that code. Here's the log set:

                12/21/2008 8:50:43 AM | Whois_Debug | Writing data for authorised login
                12/21/2008 8:50:43 AM | Whois_Debug | Time difference between log entries for IP: 68.193.127.177 is 0 Minutes
                12/21/2008 8:50:43 AM | Whois_Debug | Authorised login detected
                12/21/2008 8:50:43 AM | Jon00_Whois | IP parsed and device value q1 set to 68193127177
                12/21/2008 8:50:43 AM | Jon00_Whois | Confirmed value management for 0 stored in DevCode q1
                12/21/2008 8:50:43 AM | Jon00_Whois | IP parsed and device value q2 set to 68193127177
                12/21/2008 8:50:43 AM | Jon00_Whois | Confirmed value management for 249886211 stored in DevCode q2
                12/21/2008 8:50:43 AM | Jon00_Whois | IP parsed and device value q3 set to 68193127177
                12/21/2008 8:50:43 AM | Jon00_Whois | Confirmed value management for 207591630 stored in DevCode q3

                The code wrote the IP value to the log right after the set UDevCode action ("IP parsed"), then a get retrieved the code for UDevCode and stored it in a new var IP2, then the last line wrote the value retrieved (Confirmed). I've tried other structures around this function and get the same result. Through all this the string is correctly changed.

                Michael
                Last edited by michael.davis; December 21, 2008, 05:57 PM. Reason: Remove HTML tags

                Comment


                  #9
                  Here's the code, including your addition:

                  hs.setdevicestring (UDevCode,"<img src='" & ImagePath & "/whois.gif' height='16'> " & DT & " IP : " & IP & " Country: " & Country,True)
                  '*** Added to set trigger value
                  IP = Trim(Replace(IP,".",""))
                  If IsNumeric(IP) then
                  hs.SetDeviceValue (UDevCode,IP)
                  hs.SetDeviceLastChange(UDevCode,Now())
                  hs.writelog ("Jon00_Whois", "IP parsed and device value " &UDevCode &" set to " &IP)
                  Else
                  hs.SetDeviceValue (UDevCode,"999999999")
                  hs.writelog ("Jon00_Whois", "IP non-numeric and device value " &UDevCode &" set to placeholder")
                  End if
                  IP2 = hs.DeviceValue (UDevCode)
                  hs.writelog ("Jon00_Whois", "Confirmed value management for " &IP2 &" stored in DevCode " &UDevCode)
                  '*** End added code
                  If Err.number <> 0 then hs.writelog ("Jon00_Whois", "Error C: " & Err.Number & " " & Err.Description)

                  Michael

                  Comment

                  Working...
                  X