1. Packages
  2. Packages
  3. Chronosphere
  4. API Docs
  5. ServiceDataSource
Viewing docs for Chronosphere v0.9.16
published on Friday, Jun 5, 2026 by Chronosphere
Viewing docs for Chronosphere v0.9.16
published on Friday, Jun 5, 2026 by Chronosphere

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Pulumi = Chronosphere.Pulumi;
    using Pulumi = Pulumi.Pulumi;
    
    return await Deployment.RunAsync(() => 
    {
        var gateway = Pulumi.ServiceDataSource.Invoke(new()
        {
            Slug = "gateway",
        });
    
        var gatewayUp = new Pulumi.Monitor("gatewayUp", new()
        {
            Name = "Gateway up",
            CollectionId = gateway.Apply(serviceDataSourceResult => serviceDataSourceResult.Id),
            Query = new Pulumi.Inputs.MonitorQueryArgs
            {
                PrometheusExpr = "up{service=\"gateway\"}",
            },
            SeriesConditions = new Pulumi.Inputs.MonitorSeriesConditionsArgs
            {
                Conditions = new[]
                {
                    new Pulumi.Inputs.MonitorSeriesConditionsConditionArgs
                    {
                        Severity = "warn",
                        Value = 1,
                        Op = "LT",
                    },
                },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/chronosphereio/pulumi-chronosphere/sdk/go/chronosphere"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		gateway, err := chronosphere.ServiceDataSource(ctx, &chronosphere.ServiceDataSourceArgs{
    			Slug: "gateway",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = chronosphere.NewMonitor(ctx, "gatewayUp", &chronosphere.MonitorArgs{
    			Name:         pulumi.String("Gateway up"),
    			CollectionId: *pulumi.String(gateway.Id),
    			Query: &chronosphere.MonitorQueryArgs{
    				PrometheusExpr: pulumi.String("up{service=\"gateway\"}"),
    			},
    			SeriesConditions: &chronosphere.MonitorSeriesConditionsArgs{
    				Conditions: chronosphere.MonitorSeriesConditionsConditionArray{
    					&chronosphere.MonitorSeriesConditionsConditionArgs{
    						Severity: pulumi.String("warn"),
    						Value:    pulumi.Float64(1),
    						Op:       pulumi.String("LT"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    

    Example coming soon!

    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.chronosphere.ChronosphereFunctions;
    import com.pulumi.chronosphere.inputs.ServiceDataSourceArgs;
    import com.pulumi.chronosphere.Monitor;
    import com.pulumi.chronosphere.MonitorArgs;
    import com.pulumi.chronosphere.inputs.MonitorQueryArgs;
    import com.pulumi.chronosphere.inputs.MonitorSeriesConditionsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var gateway = ChronosphereFunctions.ServiceDataSource(ServiceDataSourceArgs.builder()
                .slug("gateway")
                .build());
    
            var gatewayUp = new Monitor("gatewayUp", MonitorArgs.builder()        
                .name("Gateway up")
                .collectionId(gateway.applyValue(serviceDataSourceResult -> serviceDataSourceResult.id()))
                .query(MonitorQueryArgs.builder()
                    .prometheusExpr("up{service=\"gateway\"}")
                    .build())
                .seriesConditions(MonitorSeriesConditionsArgs.builder()
                    .conditions(MonitorSeriesConditionsConditionArgs.builder()
                        .severity("warn")
                        .value(1)
                        .op("LT")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as chronosphere from "@pulumi-chronosphere/pulumi-chronosphere";
    import * as chronosphere from "@pulumi/chronosphere";
    
    const gateway = chronosphere.ServiceDataSource({
        slug: "gateway",
    });
    const gatewayUp = new chronosphere.Monitor("gatewayUp", {
        name: "Gateway up",
        collectionId: gateway.then(gateway => gateway.id),
        query: {
            prometheusExpr: "up{service=\"gateway\"}",
        },
        seriesConditions: {
            conditions: [{
                severity: "warn",
                value: 1,
                op: "LT",
            }],
        },
    });
    
    import pulumi
    import pulumi_chronosphere as chronosphere
    
    gateway = chronosphere.service_data_source(slug="gateway")
    gateway_up = chronosphere.Monitor("gatewayUp",
        name="Gateway up",
        collection_id=gateway.id,
        query=chronosphere.MonitorQueryArgs(
            prometheus_expr="up{service=\"gateway\"}",
        ),
        series_conditions=chronosphere.MonitorSeriesConditionsArgs(
            conditions=[chronosphere.MonitorSeriesConditionsConditionArgs(
                severity="warn",
                value=1,
                op="LT",
            )],
        ))
    
    resources:
      gatewayUp:
        type: chronosphere:Monitor
        properties:
          name: Gateway up
          collectionId: ${gateway.id}
          query:
            prometheusExpr: up{service="gateway"}
          seriesConditions:
            conditions:
              - severity: warn
                value: 1
                op: LT
    variables:
      gateway:
        fn::invoke:
          Function: chronosphere:ServiceDataSource
          Arguments:
            slug: gateway
    

    Using ServiceDataSource

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function serviceDataSource(args: ServiceDataSourceArgs, opts?: InvokeOptions): Promise<ServiceDataSourceResult>
    function serviceDataSourceOutput(args: ServiceDataSourceOutputArgs, opts?: InvokeOptions): Output<ServiceDataSourceResult>
    def service_data_source(slug: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> ServiceDataSourceResult
    def service_data_source_output(slug: pulumi.Input[Optional[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[ServiceDataSourceResult]
    func ServiceDataSource(ctx *Context, args *ServiceDataSourceArgs, opts ...InvokeOption) (*ServiceDataSourceResult, error)
    func ServiceDataSourceOutput(ctx *Context, args *ServiceDataSourceOutputArgs, opts ...InvokeOption) ServiceDataSourceResultOutput
    public static class ServiceDataSource 
    {
        public static Task<ServiceDataSourceResult> InvokeAsync(ServiceDataSourceArgs args, InvokeOptions? opts = null)
        public static Output<ServiceDataSourceResult> Invoke(ServiceDataSourceInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<ServiceDataSourceResult> serviceDataSource(ServiceDataSourceArgs args, InvokeOptions options)
    public static Output<ServiceDataSourceResult> serviceDataSource(ServiceDataSourceArgs args, InvokeOptions options)
    
    fn::invoke:
      function: chronosphere:ServiceDataSource
      arguments:
        # arguments dictionary
    data "chronosphere_servicedatasource" "name" {
        # arguments
    }

    The following arguments are supported:

    Slug string
    Slug of the service to look up.
    Slug string
    Slug of the service to look up.
    slug string
    Slug of the service to look up.
    slug String
    Slug of the service to look up.
    slug string
    Slug of the service to look up.
    slug str
    Slug of the service to look up.
    slug String
    Slug of the service to look up.

    ServiceDataSource Result

    The following output properties are available:

    Description string
    Read-only: free-form description of the service.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Read-only: display name of the service.
    Slug string
    Slug of the service to look up.
    Description string
    Read-only: free-form description of the service.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Read-only: display name of the service.
    Slug string
    Slug of the service to look up.
    description string
    Read-only: free-form description of the service.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Read-only: display name of the service.
    slug string
    Slug of the service to look up.
    description String
    Read-only: free-form description of the service.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Read-only: display name of the service.
    slug String
    Slug of the service to look up.
    description string
    Read-only: free-form description of the service.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Read-only: display name of the service.
    slug string
    Slug of the service to look up.
    description str
    Read-only: free-form description of the service.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Read-only: display name of the service.
    slug str
    Slug of the service to look up.
    description String
    Read-only: free-form description of the service.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Read-only: display name of the service.
    slug String
    Slug of the service to look up.

    Package Details

    Repository
    chronosphere chronosphereio/pulumi-chronosphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the chronosphere Terraform Provider.
    Viewing docs for Chronosphere v0.9.16
    published on Friday, Jun 5, 2026 by Chronosphere

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial