· Jun 9, 2016 1m read

Ensemble monitoring

First post!   In order to somewhat redeem myself for an unnecessary call to support,  I've decided to post some classes that I've written to monitor certain metrics inside our Ensemble Live instance (yeah, Kyle, you WERE laughing at me, but it's okay).  What the classes do is to run queries and code to get database sizes, status of the mirror, counts of rows in tables such as EnsLib.HL7.Message and Ens.MessageHeader.  The data is collected and written to tables and then an email is sent out daily upon completion.  I've found this quite useful in keeping an eye on what's going on.  It's helped me to spot mirroring issues, as well as database growth that was not anticipated.  The main classes run in the Ensemble namespace because we're running a mirrored configuration and I want to get the data for both servers.  Only the primary will send the email.  The actual email class runs in the namespace that I'm most concerned with monitoring.

To say that my comments in the code are sparse is very generous (I can get lazy sometimes).  That said, I'm happy to answer any questions you might have and welcome input for improvements in the code.  

Also, there are a couple of items in the code that really don't do anything, but I haven't bothered cleaning them up.  It works, why mess with it?

Github link (I think):

Discussion (5)0
Log in or sign up to continue

This is a sample of the email output:

Date                      DB NAME            Directory             Size(GB)               Free(GB)             % Free                  Free Disk Space(GB)
06/13/2016         LIVE                       H:\live\                 491.774                 4.113                     0.84                       734.17
06/12/2016         LIVE                       H:\live\                 491.774                 0.955                     0.19                       734.24
06/11/2016         LIVE                       H:\live\                 490.774                 0.527                     0.11                       735.22
06/10/2016         LIVE                       H:\live\                 486.774                 0.435                     0.09                       739.14
06/09/2016         LIVE                       H:\live\                 484.774                 0.267                     0.06                       741.11
06/08/2016         LIVE                       H:\live\                 483.774                 0.946                     0.20                       742.10
06/07/2016         LIVE                       H:\live\                 483.774                 2.843                     0.59                       742.12
Last Purge Job:
Started:        2016-06-13 07:53
Finished:       2016-06-13 07:54
Status:         Success
Mirror Status:
Failover Mode:           Arbiter Controlled
Connection Status:    Both failover members are connected to the arbiter
Current Role:              Primary
Status:                           Active
Current Type:            Failover
Journal Latency:        N/A
Database Latency:    N/A
Current Role:              Backup
Status:                           Active
Current Type:            Failover
Journal Latency:        Active
Database Latency:    Caught up
Current Role:              Async
Status:                           Async
Current Type:            Async
Journal Latency:        Caught up
Database Latency:    Caught up
Mirror file status
Time last file sent, Journal File
Secondary:     06/13/2016 - 07:02:59,MIRROR-LIVEMIRROR-20160613.023
D/R                    06/13/2016 - 07:02:59,MIRROR-LIVEMIRROR-20160613.023
Date                                      Msg Header Count          HL7 Msg Count                  Over 90 day count           Journal Free Space (GB)       Full Size
06/13/2016                         297,695,134                        143,720,796                        1,535                     611.55                                                   1,249,445,774   
06/12/2016                         300,339,462                        144,745,038                        684                         645.66                                                   218,690,487      
06/11/2016                         300,175,355                        144,585,713                        602                         620.45                                                   3,660,130,114   
06/10/2016                         298,014,061                        143,702,880                        508                         603.46                                                   4,169,611,018   
06/09/2016                         297,530,982                        143,507,436                        338                         596.53                                                   4,114,797,465   
06/08/2016                         297,320,463                        143,320,444                        165                         621.41                                                   4,891,285,909   
06/07/2016                         297,207,426                        143,164,757                        0                              654.68                                                   2,958,572,967    

Hi Andrew,

Thanks for posting this. I am in the process of coding a similar automated statistics email, so I am reading your code with interest and may well use some of it. My only comment is that since this is for monitoring Ensemble, I actually decided to use Ensemble to implement it. So I have a message class with properties like "Subject" etc. and this is sent to an Operation that uses the Ensemble email adapter to send it. There is also a Service that runs once a day to pull the required information and builds the email message.