/// <summary> /// 添加所有磁盘监控 /// </summary> /// <param name="monitors">监控集合</param> /// <param name="options">配置选项</param> /// <exception cref="ArgumentNullException"></exception> /// <returns></returns> public static MonitorCollection AddDriveInfosMonitor(this MonitorCollection monitors, Action <DeriveInfoOptions> options) { var drives = System.IO.DriveInfo.GetDrives(); foreach (var item in drives) { monitors.AddDriveInfoMonitor(item.Name, item.Name, options); } return(monitors); }
/// <summary> /// 添加磁盘监控 /// </summary> /// <param name="monitors">监控集合</param> /// <param name="alias">磁盘别名</param> /// <param name="driveName">磁盘名称,a到z</param> /// <param name="options">配置选项</param> /// <exception cref="ArgumentNullException"></exception> /// <returns></returns> public static MonitorCollection AddDriveInfoMonitor(this MonitorCollection monitors, string alias, string driveName, Action <DeriveInfoOptions> options) { var opt = new DeriveInfoOptions(); options?.Invoke(opt); var service = new DriveInfoMonitor(opt, alias, driveName); monitors.Add(service); return(monitors); }
/// <summary> /// 添加应用程序监控 /// </summary> /// <param name="monitor">进程监控集合</param> /// <param name="alias">进程别名</param> /// <param name="processInfo">进程信息</param> /// <param name="options">进程配置选项</param> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentException"></exception> /// <returns></returns> public static MonitorCollection AddProcessMonitor(this MonitorCollection monitor, string alias, ProcessInfo processInfo, Action <ProcessOptions> options) { var opt = new ProcessOptions(); options?.Invoke(opt); var service = new ProcessMonitor(opt, alias, processInfo); monitor.Add(service); return(monitor); }
/// <summary> /// 添加站点监控 /// </summary> /// <param name="monitors">监控集合</param> /// <param name="alias">站点名称</param> /// <param name="uri">站点地址</param> /// <param name="options">配置选项</param> /// <exception cref="ArgumentNullException"></exception> /// <returns></returns> public static MonitorCollection AddWebSiteMonitor(this MonitorCollection monitors, string alias, Uri uri, Action <WebSiteOptions> options) { var opt = new WebSiteOptions(); options?.Invoke(opt); var service = new WebSiteMonitor(opt, alias, uri); monitors.Add(service); return(monitors); }
/// <summary> /// 添加服务状态监控 /// </summary> /// <param name="monitor">服务监控集合</param> /// <param name="alias">服务别名</param> /// <param name="serviceName">服务名称</param> /// <param name="options">配置选项</param> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentException"></exception> /// <returns></returns> public static MonitorCollection AddServiceProcessMonitor(this MonitorCollection monitor, string alias, string serviceName, Action <ServiceProcessOptions> options) { var opt = new ServiceProcessOptions(); options?.Invoke(opt); var service = new ServiceProcessMonitor(opt, alias, serviceName); monitor.Add(service); return(monitor); }
/// <summary> /// 添加应用程序监控 /// </summary> /// <param name="monitor">进程监控集合</param> /// <param name="alias">进程别名</param> /// <param name="fileName">进程文件路径</param> /// <param name="options">进程配置选项</param> /// <exception cref="ArgumentNullException"></exception> /// <exception cref="ArgumentException"></exception> /// <returns></returns> public static MonitorCollection AddProcessMonitor(this MonitorCollection monitor, string alias, string fileName, Action <ProcessOptions> options) { return(monitor.AddProcessMonitor(alias, new ProcessInfo(fileName), options)); }