static void Main(string[] args) { CheckHttpTcpPluginOptions Options = new CheckHttpTcpPluginOptions(); Options.label = "HTTP"; Options.units = "ms"; Options.port = 80; Options.url = "/"; Options.ProcessArgs(args); TcpPlugin plugin = new TcpPlugin(Options); plugin.Connect(); String requestString = String.Format("GET {0} HTTP/1.0\r\nAccept:*.*\r\n Host:{1}\r\n\r\n", Options.url, Options.hostname); //plugin.Send(String.Format("GET {0} HTTP/1.0\n", Options.url)); plugin.Send(String.Format(requestString); String value = plugin.ReceiveBanner(); plugin.Disconnect(); // always warn for level 400-500 http status codes plugin.GetStatus(value, @"HTTP/1\.[01] (4\d\d|5\d\d)", NagiosPluginsNT.Plugin<TcpPluginOptions>.StatusCode.Critical); plugin.AppendValue(value); plugin.AppendValue("Response Time", plugin.GetResponseTime()); plugin.Finish(); }
static void Main(string[] args) { TcpPluginOptions Options = new TcpPluginOptions(); Options.units = "ms"; Options.ProcessArgs(args); TcpPlugin plugin = new TcpPlugin(Options); plugin.Connect(); String value = plugin.ReceiveBanner(); plugin.Disconnect(); plugin.AppendValue(value); plugin.AppendValue("Response time", plugin.GetResponseTime()); plugin.Finish(); }