示例#1
0
        public void Tree_Factory_AllTypes_Single()
        {
            var client  = BaseTest.Initialize_Client(new MultiTypeResponse());
            var factory = new PrtgNodeFactory(client);

            var node = factory.Probe(1000,
                                     factory.Group(2000,
                                                   factory.Device(3000,
                                                                  factory.Sensor(4000,
                                                                                 factory.Property(3000, ObjectProperty.Name)
                                                                                 )
                                                                  )
                                                   )
                                     );

            var response = new NotificationTriggerResponse(
                NotificationTriggerItem.StateTrigger(parentId: "3000"),
                NotificationTriggerItem.SpeedTrigger(parentId: "3000")
                );

            var triggerClient = BaseTest.Initialize_Client(response);

            var triggerFactory = new PrtgNodeFactory(triggerClient);

            Assert.IsNotNull(triggerFactory.Trigger(3000, "Email and push notification to admin"));
        }
示例#2
0
        public async Task SetTriggerProperty_ChannelAsync()
        {
            var triggerItem = NotificationTriggerItem.ThresholdTrigger(channel: "Backup State", parentId: "4000");
            var channelItem = new ChannelItem(name: "Backup State");
            var response    = new NotificationTriggerResponse(new[] { triggerItem }, new[] { channelItem });
            var client      = Initialize_Client(response);

            var trigger = client.GetNotificationTriggers(4000).First(t => t.Type == TriggerType.Threshold);

            await ExecuteAsync(
                async c =>
            {
                var channel = await c.GetChannelAsync(4000, 1);

                await c.SetTriggerPropertyAsync(trigger, TriggerProperty.Channel, channel);
            },
                new[]
            {
                UnitRequest.Channels(4000),
                UnitRequest.ChannelProperties(4000, 1),
                UnitRequest.Sensors("filter_objid=4000"),
                UnitRequest.Channels(4000),
                UnitRequest.ChannelProperties(4000, 1),
                UnitRequest.EditSettings("id=4000&subid=7&channel_7=1")
            }
                );
        }
示例#3
0
        public void Tree_Factory_AllTypes_Multiple()
        {
            var client  = BaseTest.Initialize_Client(new MultiTypeResponse());
            var factory = new PrtgNodeFactory(client);

            var probes  = factory.Probes(Property.Name, "Local Probe");
            var groups  = factory.Groups(Property.Name, "Windows Infrastructure");
            var devices = factory.Devices(Property.Name, "dc-1");
            var sensors = factory.Sensors(Property.Name, "Ping");

            var properties = factory.Properties(3000);

            var response = new NotificationTriggerResponse(
                NotificationTriggerItem.StateTrigger(parentId: "3000"),
                NotificationTriggerItem.SpeedTrigger(parentId: "3000")
                );

            var triggerClient  = BaseTest.Initialize_Client(response);
            var triggerFactory = new PrtgNodeFactory(triggerClient);

            var triggers = triggerFactory.Triggers(3000);
        }