Code Monkey home page Code Monkey logo

sap_host_exporter's Introduction

SAP Host Exporter

This is a bespoke Prometheus exporter enabling the monitoring of SAP systems (a.k.a. SAP NetWeaver applications).

Exporter CI Dashboards CI

Table of Contents

  1. Features
  2. Installation
  3. Usage
    1. Configuration
    2. Metrics
    3. systemd integration
  4. Contributing
    1. Design
    2. Development
  5. License

Features

The exporter is a stateless HTTP endpoint. On each HTTP request, it pulls runtime data from the SAP system via the SAPControl web interface.

Exported data include:

  • Start Service processes
  • Enqueue Server stats
  • AS Dispatcher work process queue stats

Installation

The project can be installed in many ways, including but not limited to:

  1. Manual clone & build
  2. Go
  3. RPM

Manual clone & build

git clone https://github.com/SUSE/sap_host_exporter
cd sap_host_exporter
make
make install

Go

go get github.com/SUSE/sap_host_exporter

RPM

You can find the repositories for RPM based distributions in SUSE's Open Build Service.
On openSUSE or SUSE Linux Enterprise you can just use the zypper system package manager:

export DISTRO=SLE_15_SP2 # change as desired
zypper addrepo https://download.opensuse.org/repositories/server:/monitoring/$DISTRO/server:monitoring.repo
zypper install prometheus-sap_host_exporter

Usage

You can run the exporter as follows:

./sap_host_exporter --sap-control-url $SAP_HOST:$SAP_CONTROL_PORT

Though not strictly required, it is advised to run the exporter locally in the target SAP instance host, and connect to the SAPControl web service via Unix Domain Sockets:

./sap_host_exporter --sap-control-uds /tmp/.sapstream50013

For further details on SAPControl, please refer to the official SAP docs to properly connect to the SAPControl service.

The exporter will expose the metrics under the /metrics path, on port 9680 by default.

Hint: You can deploy a full SAP NetWeaver cluster via Terraform with SUSE/ha-sap-terraform-deployments; this exporter and the whole Prometheus monitoring stack will be automatically installed and configured for you.

Configuration

The runtime parameters can be configured either via CLI flags or via a configuration file, both of which are completely optional.

For more details, refer to the help message via sap_host_exporter --help.

Note: the built-in defaults are tailored for the latest version of SUSE Linux Enterprise and openSUSE.

The program will scan, in order, the current working directory, $HOME/.config, /etc and /usr/etc for files named sap_host_exporter.(yaml|json|toml). The first match has precedence, and the CLI flags have precedence over the config file.

Please refer to the example YAML configuration for more details.

Metrics

The exporter won't export any metric it can't collect, but since it doesn't care about which subsystems are present in the monitored target, failing to collect metrics is not considered a hard failure condition. Instead, in case some of the collectors fail to either register or perform collect cycles, a soft warning will be printed out in the log.

Refer to doc/metrics.md for extensive details about all the exported metrics.

systemd integration

A systemd unit file is provided with the RPM packages. You can enable and start it as usual:

systemctl --now enable prometheus-sap_host_exporter

Contributing

Pull requests are more than welcome!

We recommend having a look at the design document and the development notes before contributing.

License

Copyright 2020 SUSE LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

sap_host_exporter's People

Contributors

aleksei-burlakov avatar angelabriel avatar dependabot[bot] avatar mallozup avatar stefanotorresi avatar tester22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sap_host_exporter's Issues

sap_host_exporter isn't discovering all the SAP instances

Hello,

I've observed that the sap_host_exporter isn't discovering all the SAP instances of an distributed SAP system.
I've connected the sap_host_exporter directly to the ASCS instance and the sap_host_exporter is posing only the information about the ASCS instance itself.
On the same host there are also other instances (PAI) running with different virtual host name (but same SID).

How does the sap_host_exporter installation concept look for an distributed system, do I have to install an sap_host_exporter for each SAP instance, or should it be discovered via the ASCS instance.

Thank you very much in advanced.

Best regards!

Metrics related to SAP Enqueue Server are not displayed

Hello Everyone,

The sap_host_exporter is running fine on the SAP system and it is showing most of the metrics as desired.

The exporter is showing all the metrics related to :
SAP Start Service and SAP AS Dispatcher
but it is not showing any metrics related to
SAP Enqueue Server.

Any inputs how to get metrics related to SAP Enqueue Server will be highly appreciated.

Thanks in advance.

RFC: Zero config Exporter-> automatic discover the target.

I do have though a bit and I found out that configuring the sap_host exporter is by user not trivial.

we don't offer the same experience we offer like the ha_cluster_exporter without any configuration needed by default.

I think we can configure this all dynamically and retrieve the Instances automatically and serve them.

This is also a pattern in prometheus exporters

https://github.com/wrouesnel/postgres_exporter#automatically-discover-databases

prometheus-community/postgres_exporter#215

We might need to research also how we could offer such experience.

I think that using systemd It is still an elegant solution but we can always improve ๐Ÿ˜

I'm adding as RFC because we might think.

The same would be valuable for hanadb exporter where we don't need all this config files. if we can implement it here.

Only register collectors if the endpoint supports it.

Right now, we register all the collectors, regardless of what is available on the SAPControl endpoint.

Some collector may not be necessarily relevant for every SAP host, so we need to perform some kind of preflight check, possibly using the GetProcessList web service method, to asses whether or not a collector should be registered.

One example is avoiding registering the EnqueueServer collector if the host doesn't run the EnqueueServer process.

fix make obs-workdir target

The makefile target to create an OBS working directory doesn't currently work with a fake VERSION value like dev, it needs an actual git reference for the tar_scm source service to work. We should make possible to use this target with any git reference.

sapstartsrv is going [defunc] after sap_host_exporter is active

Hi,

I experience massive impact on my 3 node cluster running 5 SAP SID's. If all exporters are active before the SAP systems are running the sapstartsrv will go in defunct and this blocks all other start procedures of the cluster.
I was able to to reproduce that with stop sap_host_exporter. That looks for me that we have an issue with the sapstartsrv in case to many request are happen.
First of all I'll get in touch with SAP to verify the situation. Second we may should thing if we reduce the data which we are collecting or using a different method. Maybe the socket direct instead of a http request.

Add example URL to cli usage

when doing

./sap_host_exporter-dev-amd64 --help
Usage of ./sap_host_exporter-dev-amd64:
      --address string           The address to listen on for HTTP requests (default "0.0.0.0")
      --log-level string         The minimum logging level; levels are, in ascending order: debug, info, warn, error (default "info")
      --port string              The port number to listen on for HTTP requests (default "9680")
      --sap-control-url string   The URL of the SAPControl SOAP web service

we should add to --sap-control-url string an example which showcase

like "http://10.162.30.12:5002" the right url with a port

Collected metric was collected before with the same name and label values

Hello.
I have recently deployed this exporter on several instances, and in some cases I cannot get any metrics.
The exporters start and run without any apparent problems, but when trying to see what are they exposing via curl, I get the following:

curl localhost:9680/metrics
An error has occurred while serving metrics:

collected metric "sap_start_service_instances" { label:<name:"SID" value:"TGR" > label:<name:"features" value:"MESSAGESERVER|ENQUE" > label:<name:"instance_hostname" value:"saptgrcs" > label:<name:"instance_name" value:"ASCS01" > label:<name:"instance_number" value:"1" > label:<name:"start_priority" value:"1" > gauge:<value:2 > } was collected before with the same name and label values

The config file:

# The listening TCP/IP address and port.
address: "0.0.0.0"
port: "9680"

# The log level.
#
# Possible values, from less to most verbose: error, warn, info, debug.
log-level: "info"

# The path to a Unix Domain Socket to access SAPControl locally.
#
# This is usually /tmp/.sapstream5<instance number>13
#
# If this is specified, sap-control-url setting will be ignored.
# UDS connection doesn't require authentication
sap-control-uds: "/tmp/.sapstream50113"

In another instance:

curl http://localhost:9680/metrics
An error has occurred while serving metrics:

collected metric "sap_start_service_instances" { label:<name:"SID" value:"TGR" > label:<name:"features" value:"ENQREP" > label:<name:"instance_hostname" value:"saptgrers" > label:<name:"instance_name" value:"ERS02" > label:<name:"instance_number" value:"2" > label:<name:"start_priority" value:"0.5" > gauge:<value:1 > } was collected before with the same name and label values

And the corresponding config:

# The listening TCP/IP address and port.
address: "0.0.0.0"
port: "9680"

# The log level.
#
# Possible values, from less to most verbose: error, warn, info, debug.
log-level: "info"

# The path to a Unix Domain Socket to access SAPControl locally.
#
# This is usually /tmp/.sapstream5<instance number>13
#
# If this is specified, sap-control-url setting will be ignored.
# UDS connection doesn't require authentication
sap-control-uds: "/tmp/.sapstream50213"

In any other instances, the exporters are running fine and serving metrics without any problem. It is just in these two I'm getting the error messages.

AFAIK that error message usually appears when there are duplicated metrics at the source, but I do not know much about SAP systems and maybe I'm missing something here, so any help would be very appreciated.

Thanks in advance.

Find out clarity about project name.

I think we should really quickly found out what is the github project name.

Otherwise we will have to much reference everywhere that we need to change.

Exporter fails with panic error

Hello,

I have found that in a SAP host without HA plugin installed (PAS instance in my case), the exporter enters in a failing loop in every request.

Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: time="2020-04-07T17:34:59+02:00" level=warning msg="Enqueue Server Collector scrape failed: SAPControl web service error: EnqMon_GetStatistic failed"
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: time="2020-04-07T17:34:59+02:00" level=warning msg="Alert Collector scrape failed: SAPControl web service error: HA product checks not implemented"
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: panic: send on closed channel
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: goroutine 34 [running]:
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: github.com/SUSE/sap_host_exporter/collector/alert.(*alertCollector).recordHACheck(0xc000123080, 0xc00033b400, 0xc00010a960, 0x0, 0xc0001d0380)
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]:         /home/abuild/rpmbuild/BUILD/prometheus-sap_host_exporter-0.3.0+git.1586180171.ad72196/collector/alert/alert.go:92 +0x18c
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: github.com/SUSE/sap_host_exporter/collector/alert.(*alertCollector).recordHAChecks(0xc000123080, 0xc0001dad00, 0x15, 0x20, 0xc00010a960, 0x0, 0x0)
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]:         /home/abuild/rpmbuild/BUILD/prometheus-sap_host_exporter-0.3.0+git.1586180171.ad72196/collector/alert/alert.go:78 +0x63
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: github.com/SUSE/sap_host_exporter/collector/alert.(*alertCollector).recordHAConfigChecks(0xc000123080, 0xc00010a960, 0x0, 0x0)
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]:         /home/abuild/rpmbuild/BUILD/prometheus-sap_host_exporter-0.3.0+git.1586180171.ad72196/collector/alert/alert.go:53 +0x7f
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: github.com/SUSE/sap_host_exporter/collector/alert.(*alertCollector).recordHAConfigChecks-fm(0xc00010a960, 0x0, 0x0)
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]:         /home/abuild/rpmbuild/BUILD/prometheus-sap_host_exporter-0.3.0+git.1586180171.ad72196/collector/alert/alert.go:37 +0x34
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: github.com/SUSE/sap_host_exporter/collector.RecordConcurrently.func1(0xc0001d6060, 0xc00010a960, 0xc0001d2010)
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]:         /home/abuild/rpmbuild/BUILD/prometheus-sap_host_exporter-0.3.0+git.1586180171.ad72196/collector/default_collector.go:65 +0x30
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]: created by github.com/SUSE/sap_host_exporter/collector.RecordConcurrently
Apr 07 17:34:59 netweaver03 sap_host_exporter[31019]:         /home/abuild/rpmbuild/BUILD/prometheus-sap_host_exporter-0.3.0+git.1586180171.ad72196/collector/default_collector.go:64 +0x83
Apr 07 17:34:59 netweaver03 systemd[1]: [email protected]: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 07 17:34:59 netweaver03 systemd[1]: [email protected]: Unit entered failed state.
Apr 07 17:34:59 netweaver03 systemd[1]: [email protected]: Failed with result 'exit-code'.```

After every error the exporter is restarted automatically.

Connection refused

Hallo all,

When I am trying to run the command " ./sap_host_exporter --sap-control-url http://xx.xx.xx.xx"
I am getting the following error.

INFO[0000] Could not discover configuration file: Config File "sap_host_exporter" Not Found in "[/root/go/bin /root/.config /etc /usr/etc]"
INFO[0000] Default configuration values will be used
FATA[0000] SAPControl web service error: could not performGetInstanceProperties query: Post http://18.195.2.92: dial tcp 18.195.2.92:80: connect: connection refused

Can someone please guide onto this.
Thanks in advance

HTTP Error : Unauthorized

Hello everyone,

With every scrape from Prometheus (i.e. at every 1 minute interval), the following Warning/Error comes at the terminal where sap_host_exporter is running:

WARN[1754] Dispatcher Collector scrape failed: SAPControl web service error: HTTP Error: 'Unauthorized'

Any inputs how to get through this?
Thanks

New exporter metrics for application server connections

By using the sapcontrol command:
sapcontrol -nr -function GetAccessPointList

we can checks if the access points of the SAP instances can be retrieved using the Web service method.

It will also show the connections between all the application servers. Monitoring this connection can be used together with other metrics to check if a node is operational. It's maybe possible to draw a map with Grafana to identify some hot spots for connection entry points.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.