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

(SLV-672) Add system class to manage system metric #30

Merged
merged 1 commit into from
Nov 25, 2019
Merged

Conversation

RandellP
Copy link
Contributor

@RandellP RandellP commented Nov 5, 2019

Depends on #28

The new system class is very similar to the init.pp... this is to keep the two seperate during development.
They may get merged in teh future. But the work flow is such that the master would have puppet metrics collector and sysystem included, while the compilers would only have system. To merge them would require a clean way to turn off all pe metrics for the compilers.

Also added system_cpu and system_memory to use sar_metric to gather cpu and memory metrics.

manifests/sar_metric.pp Show resolved Hide resolved
manifests/sar_metric.pp Show resolved Hide resolved
cron { "${metrics_type}_metrics_tidy" :
ensure => $metric_ensure,
user => 'root',
hour => fqdn_rand(3, $metrics_type ),
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the 3 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is the max for the hour. Basically will generate a random number between 0 and 3. This is so all the cron jobs don't run at the same time and possibly impact perf. It's just a copy pasta from pe_metric.pp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked offline about this, and added a comment.

ensure => $metric_ensure,
user => 'root',
hour => fqdn_rand(3, $metrics_type ),
minute => (5 * fqdn_rand(11, $metrics_type )),
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the 5 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

another copy paste from pe_metric.pp generates a random number between 0 and 5 for the minute it should run to try an not run all metrics gathering at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

talked offline and added a comment

@RandellP RandellP force-pushed the SLV-672 branch 2 times, most recently from 7ad2425 to 8235b24 Compare November 6, 2019 21:53
johnduarte
johnduarte previously approved these changes Nov 8, 2019
define puppet_metrics_collector::sar_metric (
String $output_dir,
String $scripts_dir,
Enum['absent', 'present'] $metric_ensure = 'present',

Choose a reason for hiding this comment

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

It seems odd to have some of these aligned with extra spaces ($metric_ensure, $metrics_type, etc...) and the rest not aligned ($polling_frequency_seconds, $collection_frequency). Is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They look aligned with extra space on my screen?

cron { "${metrics_type}_metrics_tidy" :
ensure => $metric_ensure,
user => 'root',
hour => fqdn_rand(3, $metrics_type ),
Copy link

@billclaytor billclaytor Nov 12, 2019

Choose a reason for hiding this comment

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

Suggested change
hour => fqdn_rand(3, $metrics_type ),
hour => fqdn_rand(3, $metrics_type),

ensure => $metric_ensure,
user => 'root',
hour => fqdn_rand(3, $metrics_type ),
minute => (5 * fqdn_rand(11, $metrics_type )),

Choose a reason for hiding this comment

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

Suggested change
minute => (5 * fqdn_rand(11, $metrics_type )),
minute => (5 * fqdn_rand(11, $metrics_type)),

}

puppet_metrics_collector::sar_metric { 'cpu' :
metric_ensure => $metrics_ensure,
Copy link

@billclaytor billclaytor Nov 12, 2019

Choose a reason for hiding this comment

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

If this is being aligned with the code above:

Suggested change
metric_ensure => $metrics_ensure,
metric_ensure => $metrics_ensure,

otherwise:

Suggested change
metric_ensure => $metrics_ensure,
metric_ensure => $metrics_ensure,

}

puppet_metrics_collector::sar_metric { 'memory' :
metric_ensure => $metrics_ensure,

Choose a reason for hiding this comment

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

See alignment suggestion in 'system_cpu ' above.

johnduarte
johnduarte previously approved these changes Nov 13, 2019
@johnduarte
Copy link
Contributor

@RandellP this PR requires a rebase before it can be merged.

billclaytor
billclaytor previously approved these changes Nov 13, 2019
@RandellP RandellP dismissed stale reviews from billclaytor and johnduarte via 62fd050 November 14, 2019 19:28
@RandellP RandellP force-pushed the SLV-672 branch 3 times, most recently from 43543af to 02fad23 Compare November 18, 2019 17:10
@jarretlavallee
Copy link
Contributor

I am running some tests with this now and will report back this afternoon with the results.

Copy link
Contributor

@jarretlavallee jarretlavallee left a comment

Choose a reason for hiding this comment

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

I made a few small changes and this looks to be running well on my systems.

Comment on lines 19 to 23
file { "${scripts_dir}/generate_system_metrics":
ensure => present,
mode => '0755',
source => 'puppet:///modules/puppet_metrics_collector/generate_system_metrics'
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The generate_system_metrics file declaration should be outside of the if ! defined block since it is not declared anywhere else. This caused the generate_system_metrics to be missing on my system when both of the classes below were included in my test system.

  include puppet_metrics_collector
  include puppet_metrics_collector::system

manifests/sar_metric.pp Show resolved Hide resolved
manifests/system_cpu.pp Show resolved Hide resolved
manifests/sar_metric.pp Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@RandellP RandellP force-pushed the SLV-672 branch 2 times, most recently from aee4d5c to fbb45f8 Compare November 23, 2019 00:13
The new system class is very similar to the init.pp... this is to keep the two seperate during development.
They may get merged in teh future.  But the work flow is such that the master would have puppet metrics collector and sysystem included, while the compilers would only have system.  To merge them would require a clean way to turn off all pe metrics for the compilers.

Also added system_cpu and system_memory to use sar_metric to gather cpu and memory metrics.
Copy link
Contributor

@jarretlavallee jarretlavallee left a comment

Choose a reason for hiding this comment

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

Looks good to me

@johnduarte johnduarte merged commit 167011c into master Nov 25, 2019
@johnduarte johnduarte deleted the SLV-672 branch November 25, 2019 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants