3 Replies Latest reply on Feb 17, 2016 9:20 PM by gnmazero

    AF notifications in ready but not running state


      Every now and then our PI notifications enter a bad state. It says they are "ready but not running" and so if the trigger condition is met a notification is NOT sent out.



      This has caused some headaches over time... so to monitor the notifications I'm writing a small AFSDK application to check their status.






      AFNamedCollectionList<AFNotification> myNotifications = AFNotification.FindNotifications(targetAFDB, "*", 
      AFSearchField.Name, AFSortField.Name, AFSortOrder.Ascending, 1000);
      new List<string>();
      foreach (AFNotification afNote in myNotifications)
      if (!(afNote.Status == AFStatus.Enabled))


      Right now it checks whether the AF notifications' status is 'Enabled'. I assumed this correlated one-to-one with 'Running' when looking at the notification in AF client and that there was another status that correlated to 'Disabled' and another status that correlated to the status 'ReadyButNotRUnning'. This unfortunately is not the case. Right now my notifications are in the corrupt 'ReadyButNotRunning' state but my code still sees the notifications as 'Enabled'



      Is there a way through AFSDK to determine when the notifications are in this state?

        • Re: AF notifications in ready but not running state
          Mike Zboray

          "Ready but not running" is a pseudo state, that does not exist in the database. As such this status cannot be checked using only AFSDK. You have to use the Notifications SDK, the so-called ANSDK. In the notifications SDK, use ANNotification.IsNotificationRunning to check whether a notification is actually running. If this returns false and the Notification is enabled, that corresponds to "Ready but not running". Note that this makes a service calls for each notification, so it could be quite slow for many notifications. Also depending on the version of notification service you have, this call might not be supported (it was added in 1.2.1205.6). In that case, use ANServiceInformation.IsRunning(database). That will tell you if the database has been assigned to an instance of the service. While this doesn't always give you exactly whether a notification is running, it is what used to produce that message in older versions.

          3 of 3 people found this helpful
            • Re: AF notifications in ready but not running state

              Hi Mike,


              I've attempted to use ANNotification.IsNotificationRunning as you suggested but I can't seem to get Visual Studio to recognize it. I added the ANSDK and both of the OSIsoft.PIAnalytics references as you described in another thread and I'm using both the OSIsoft.AN and OSIsoft.AN.Notification namespaces but I still cannot seem to get Visual Studio to recognize ANNotification.IsNotificationRunning as valid within the context of my program. Any help would be greatly appreciated.