public override void PollCycle()
        {
            MSMQConnectSession connection    = MSMQConnectionUtil.connect(this.host, this.domain, this.username, this.password);
            MSMQServiceMeteric serviceMetric = connection.getMSMQServiceMetric();
            List <MSMQMeteric> msmqMetric    = connection.getMSMQMetric();

            Console.WriteLine("reporting meteric" + GetAgentName());
            ReportMetric("ALL/" + MSMQServiceMeteric.incomingMessagesPerSecLabel, "Messages Per Second", float.Parse(serviceMetric.IncomingMessagesPerSec.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.incomingMultiCastSessionsLabel, "Session", float.Parse(serviceMetric.IncomingMultiCastSessions.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.ipSessionsLabel, "Session", float.Parse(serviceMetric.IpSessions.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.incomingMessagesCountLabel, "Message", float.Parse(serviceMetric.IncomingMessagesCount.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.outgoingMessagesCountLabel, "Message", float.Parse(serviceMetric.OutgoingMessagesCount.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.outgoingHttpSessionsLabel, "Session", float.Parse(serviceMetric.OutgoingHttpSessions.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.outgoingMessagesPerSecLabel, "Messages Per Second", float.Parse(serviceMetric.OutgoingMessagesPerSec.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.outgoingMulticastSessionsLabel, "Session", float.Parse(serviceMetric.OutgoingMulticastSessions.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.sessionsLabel, "Session", float.Parse(serviceMetric.Sessions.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.totalBytesInAllQueuesLabel, "Bytes", float.Parse(serviceMetric.TotalBytesInAllQueues.ToString()));
            ReportMetric("ALL/" + MSMQServiceMeteric.totalMessagesInAllqueuesLabel, "Message", float.Parse(serviceMetric.TotalMessagesInAllQueues.ToString()));

            foreach (MSMQMeteric m in msmqMetric)
            {
                ReportMetric(m.Name + "/" + MSMQMeteric.bytesInJournalQueueLabel, "Bytes", float.Parse(m.BytesInJournalQueue.ToString()));
                ReportMetric(m.Name + "/" + MSMQMeteric.bytesInQueueLabel, "Bytes", float.Parse(m.BytesInQueue.ToString()));
                ReportMetric(m.Name + "/" + MSMQMeteric.messagesInJournalQueueLabel, "Message", float.Parse(m.MessagesInJournalQueue.ToString()));
                ReportMetric(m.Name + "/" + MSMQMeteric.messagesInQueueLabel, "Message", float.Parse(m.MessagesInQueue.ToString()));
                Console.WriteLine(m.Name);
            }
        }
        public MSMQServiceMeteric getMSMQServiceMetric()
        {
            var msqmServiceData = session.QueryInstances(@"root\cimv2", "WQL", "SELECT * FROM Win32_PerfRawdata_MSMQ_MSMQService");
            MSMQServiceMeteric msmqServiceMetric = new MSMQServiceMeteric();

            foreach (CimInstance md in msqmServiceData)
            {
                msmqServiceMetric.IncomingMultiCastSessions = (long.Parse(md.CimInstanceProperties["IncomingMulticastSessions"].Value.ToString()));
                msmqServiceMetric.IncomingMessagesPerSec    = (long.Parse(md.CimInstanceProperties["IncomingMessagesPersec"].Value.ToString()));
                msmqServiceMetric.IpSessions                = (long.Parse(md.CimInstanceProperties["IPSessions"].Value.ToString()));
                msmqServiceMetric.IncomingMessagesCount     = (long.Parse(md.CimInstanceProperties["MSMQIncomingMessages"].Value.ToString()));
                msmqServiceMetric.OutgoingMessagesCount     = (long.Parse(md.CimInstanceProperties["MSMQOutgoingMessages"].Value.ToString()));
                msmqServiceMetric.OutgoingHttpSessions      = (long.Parse(md.CimInstanceProperties["OutgoingHTTPSessions"].Value.ToString()));
                msmqServiceMetric.OutgoingMessagesPerSec    = (long.Parse(md.CimInstanceProperties["OutgoingMessagesPersec"].Value.ToString()));
                msmqServiceMetric.OutgoingMulticastSessions = (long.Parse(md.CimInstanceProperties["OutgoingMulticastSessions"].Value.ToString()));
                msmqServiceMetric.Sessions = (long.Parse(md.CimInstanceProperties["Sessions"].Value.ToString()));
                msmqServiceMetric.TotalBytesInAllQueues    = (long.Parse(md.CimInstanceProperties["Totalbytesinallqueues"].Value.ToString()));
                msmqServiceMetric.TotalMessagesInAllQueues = (long.Parse(md.CimInstanceProperties["Totalmessagesinallqueues"].Value.ToString()));
            }

            return(msmqServiceMetric);
        }