Sujata,
In that case you can read the instance table in the BizTalkMsgBoxDb database and cross join it with the host instance in the BizTalkMgmtDb which will give you the amount of messages being processed by host instances.
This script WILL NOT give you information of all instances in your BizTalk environment. ONLY instences being processed by a server and host instance.
Here the script provided by Tord
Instances in Messagebox being processed by a host instance
You can also make use of existing BizTalk performance counters to monitor the messages.
PerformanceCounter msgsReceivedCounter = new
PerformanceCounter("BizTalk:Messaging", "Documents received", "ReceiveHost", "BizTalkServer");
msgsReceivedCounter.ReadOnly = true;
PerformanceCounter msgsSentCounter = new
PerformanceCounter("BizTalk:Messaging", "Documents processed", "SendHost", "BizTalkServer");
msgsSentCounter.ReadOnly = true;
lblSent.Text = string.Format("{0}", msgsSentCounter.NextValue());
lblReceived.Text = string.Format("{0}", msgsReceivedCounter.NextValue());
But this has its own limitations. Refer:
Get Biztalk's message count through C# .NET
To get how many messages BizTalk sends/receives per day (MsgBoxDB), look for Perfmon counters such as \BizTalk Messaging\Documents received or processed etc:
http://msdn.microsoft.com/en-us/library/aa558731(BTS.20).aspx.
You can be more specific and find out how many messages the FILE adapter picked up for example:
http://msdn.microsoft.com/en-us/library/aa559528(BTS.20).aspx.
Alternatively, If use HAT, option Queries -> Message counts, you can see the query that HAT use.
You can modify to your requirements.
If you want to know how many messages run through the BizTalk Server, I think you can reach to that number by (Message Received + Messages Send) option (+ Messages Transmission failures)
Rachit