Hi,
My company used to use a VB Script to monitor ASP.NET Requests, but updating to .NET 4.5 will mess up your perf counters, which results in all data being displayed as 0. I have a C# script I want to use to use on servers by putting it in the ext directory of a local machine. I was wondering if maybe anyone had any resources I could use to see how to integrate my script into Xymon. Or maybe if someone has an example C# script that has been integrated with xymon. Thank you
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Diagnostics;
namespace PerfCounterQuery { class Program { static void Main(string[] args) { IntPtr userHandle = new IntPtr(0); string hostName = "."; string categoryName = "ASP.NET Applications"; string instanceName = "__Total__"; string[] counterNames = { "Requests Executing" , "Request Wait Time" , "Requests In Application Queue" , "Request Execution Time" }; PerformanceCounterCategory cat = new PerformanceCounterCategory(categoryName, hostName); List<PerformanceCounter> counters = new List<PerformanceCounter>(); foreach (string counterName in counterNames) { if (!PerformanceCounterCategory.CounterExists(counterName, categoryName, hostName)) { Console.WriteLine("perf counter \"" + counterName + "\" does not exist"); return; } counters.Add(new PerformanceCounter(categoryName, counterName, instanceName, hostName)); } foreach (PerformanceCounter counter in counters) Console.WriteLine(counter.CategoryName + " - " + counter.CounterName + " : " + counter.NextValue()); Console.ReadLine(); } } }
Foster Patch Web Server Technician AccuWeather