Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #8: Added Linux Connector to Community repository #11

Merged
merged 4 commits into from
Jan 15, 2024

Conversation

alexdgilbert
Copy link
Contributor

  • Developed Linux Connector
  • Added system.yaml for common grounds with other potential system connectors

- Developed Linux Connector
- Added system.yaml for common grounds with other potential system connectors
@alexdgilbert alexdgilbert self-assigned this Dec 25, 2023
@alexdgilbert alexdgilbert linked an issue Dec 25, 2023 that may be closed by this pull request
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
- Usage of /proc/ tools instead of sar
- Usage of simple job instead of discovery/collect
- Added an embedded file for memory awk compute
Copy link
Member

@bertysentry bertysentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're getting there! 😉

extends:
- ../System/System
metrics:
system.service.loaded:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 3 metrics need to be merged into a single system.service.status metric.

The stateSet allows for several values of the stateSet to be 1:

  • system.service.status{id="PatrolAgent",state="loaded"} 1
  • system.service.status{id="PatrolAgent",state="not-found"} 0
  • system.service.status{id="PatrolAgent",state="active"} 1
  • system.service.status{id="PatrolAgent",state="inactive"} 0
  • system.service.status{id="PatrolAgent",state="running"} 1
  • system.service.status{id="PatrolAgent",state="dead"} 0
  • system.service.status{id="PatrolAgent",state="exited"} 0

Now, considering that a service can be either loaded or not-found, we can drop the not-found state. Similarly, a service is either active or inactive, we can drop the inactive state. If a user wants to find inactive services, they just need to look for system.service.status{state="active"} == 0.

Conclusion: we should have 1 system.service.status metric with stateSet: [ loaded, active, running, dead, exited ].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stateSet allows for several values of the stateSet to be 1:

Currently it is a oneOf relationship.
If we map a key to a value, then the stateSet won't be able to do that unless we map values like loaded|active and enhance the engine to support it at the time of sending the metric to OTEL.

Copy link
Member

@NassimBtk NassimBtk Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise oneOf mapping can be achieved with
system.service.status: <unique_value>
Then additional state metrics can be mapped as follows:
system.service.status{state="active"}: <0 or 1>

Copy link
Member

@bertysentry bertysentry Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah @NassimBtk the second suggestion is a good workaround.

I think we still should implement the ability to map several values at once as you suggested loaded|active|running. But on the other hand, such string is quite difficult to produce and requires some string concatenations (say: concatenate $2, $3 and $4).

Another option would be to (optionally) define statesets directly in metrics: mapping, like in the example below:

# Metrics definition: we only define [running, dead, exited]
  system.service.status:
    description: Service Status
    type:
      stateSet:
      - running
      - dead
      - exited

# [...]
mapping:
  metrics:
    system.service.status{state="loaded|not-found"}: $2
    system.service.status{state="active|inactive"}: $3
    system.service.status: $4 # This stateset is already defined at the top

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think for now we'll use @NassimBtk's workaround, which means:

  1. Defining only states [running, dead, exited] for system.service.status
  2. Translating $2 from [not-found, loaded] to [0, 1]
  3. Translating $3 from [inactive, active] to [0, 1], and then:
mapping:
  metrics:
    system.service.status{state="loaded"}: $2
    system.service.status{state="active"}: $3
    system.service.status: $4

src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/Linux.yaml Outdated Show resolved Hide resolved
src/main/connector/system/Linux/memory.awk Outdated Show resolved Hide resolved
- Removed superfluous quotation marks
- Simplified awk scripts where possible
- Formatting of code
- Awk formatting
- Change to service states
@NassimBtk NassimBtk changed the title Added Linux Connector to Community repository Issue 8#: Added Linux Connector to Community repository Jan 11, 2024
@NassimBtk NassimBtk changed the title Issue 8#: Added Linux Connector to Community repository Issue #8: Added Linux Connector to Community repository Jan 11, 2024
@NassimBtk NassimBtk merged commit 552bab7 into main Jan 15, 2024
1 check passed
@NassimBtk NassimBtk deleted the 8-add-linux-system-connector-to-community-repository branch January 15, 2024 09:08
@NathalieLe NathalieLe added this to the 1.0.00 milestone Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Linux System Connector to Community repository
4 participants