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

feat: add measurements from puppet 5 #9706

Merged
merged 5 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions plugins/inputs/puppetagent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,19 @@ Meta:
- tags: ``

Measurement names:
- puppetagent_changes_total
- puppetagent_events_failure
- puppetagent_events_total
- puppetagent_events_success
- puppetagent_resources_changed
- puppetagent_resources_corrective_change
- puppetagent_resources_failed
- puppetagent_resources_failedtorestart
- puppetagent_resources_outofsync
- puppetagent_resources_restarted
- puppetagent_resources_scheduled
- puppetagent_resources_changed
- puppetagent_resources_skipped
- puppetagent_resources_total
- puppetagent_resources_failedtorestart
- puppetagent_resources_restarted
- puppetagent_resources_outofsync
- puppetagent_changes_total
- puppetagent_time_service
- puppetagent_time_lastrun
- puppetagent_version_config
Expand All @@ -108,18 +109,26 @@ Meta:
- tags: ``

Measurement names:
- puppetagent_time_user
- puppetagent_time_schedule
- puppetagent_time_filebucket
- puppetagent_time_file
- puppetagent_time_exec
- puppetagent_time_anchor
- puppetagent_time_sshauthorizedkey
- puppetagent_time_package
- puppetagent_time_total
- puppetagent_time_catalogapplication
- puppetagent_time_configretrieval
- puppetagent_time_lastrun
- puppetagent_time_convertcatalog
- puppetagent_time_cron
- puppetagent_time_exec
- puppetagent_time_factgeneration
- puppetagent_time_file
- puppetagent_time_filebucket
- puppetagent_time_group
- puppetagent_time_lastrun
- puppetagent_time_noderetrieval
- puppetagent_time_notify
- puppetagent_time_package
- puppetagent_time_pluginsync
- puppetagent_time_schedule
- puppetagent_time_sshauthorizedkey
- puppetagent_time_total
- puppetagent_time_transactionevaluation
- puppetagent_time_user
- puppetagent_version_config

#### PuppetAgent string measurements:
Expand Down
39 changes: 24 additions & 15 deletions plugins/inputs/puppetagent/last_run_summary.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
---
events:
failure: 0
noop: 0
total: 0
success: 0
resources:
changed: 0
corrective_change: 0
failed: 0
failed_to_restart: 0
out_of_sync: 0
restarted: 0
scheduled: 0
changed: 0
skipped: 0
total: 109
failed_to_restart: 0
restarted: 0
out_of_sync: 0
changes:
total: 0
time:
user: 0.004331
schedule: 0.001123
filebucket: 0.000353
file: 0.441472
exec: 0.508123
anchor: 0.000555
yumrepo: 0.006989
ssh_authorized_key: 0.000764
service: 1.807795
package: 1.325788
total: 8.85354707064819
catalog_application: 0.010555
config_retrieval: 4.75567007064819
last_run: 1444936531
convert_catalog: 1.3
cron: 0.000584
exec: 0.508123
fact_generation: 0.34
file: 0.441472
filebucket: 0.000353
last_run: 1444936531
node_retrieval: 1.235
notify: 0.00035
package: 1.325788
plugin_sync: 0.325788
schedule: 0.001123
service: 1.807795
ssh_authorized_key: 0.000764
total: 8.85354707064819
transaction_evaluation: 4.69765
user: 0.004331
yumrepo: 0.006989
version:
config: "environment:d6018ce"
puppet: "3.7.5"
52 changes: 31 additions & 21 deletions plugins/inputs/puppetagent/puppetagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,39 +32,49 @@ type State struct {

type event struct {
Failure int64 `yaml:"failure"`
Noop int64 `yaml:"noop"`
Total int64 `yaml:"total"`
Success int64 `yaml:"success"`
}

type resource struct {
Failed int64 `yaml:"failed"`
Scheduled int64 `yaml:"scheduled"`
Changed int64 `yaml:"changed"`
Skipped int64 `yaml:"skipped"`
Total int64 `yaml:"total"`
FailedToRestart int64 `yaml:"failed_to_restart"`
Restarted int64 `yaml:"restarted"`
OutOfSync int64 `yaml:"out_of_sync"`
Changed int64 `yaml:"changed"`
CorrectiveChange int64 `yaml:"corrective_change"`
Failed int64 `yaml:"failed"`
FailedToRestart int64 `yaml:"failed_to_restart"`
OutOfSync int64 `yaml:"out_of_sync"`
Restarted int64 `yaml:"restarted"`
Scheduled int64 `yaml:"scheduled"`
Skipped int64 `yaml:"skipped"`
Total int64 `yaml:"total"`
}

type change struct {
Total int64 `yaml:"total"`
}

type time struct {
User float64 `yaml:"user"`
Schedule float64 `yaml:"schedule"`
FileBucket float64 `yaml:"filebucket"`
File float64 `yaml:"file"`
Exec float64 `yaml:"exec"`
Anchor float64 `yaml:"anchor"`
SSHAuthorizedKey float64 `yaml:"ssh_authorized_key"`
Service float64 `yaml:"service"`
Package float64 `yaml:"package"`
Total float64 `yaml:"total"`
ConfigRetrieval float64 `yaml:"config_retrieval"`
LastRun int64 `yaml:"last_run"`
Cron float64 `yaml:"cron"`
Anchor float64 `yaml:"anchor"`
CataLogApplication float64 `yaml:"catalog_application"`
ConfigRetrieval float64 `yaml:"config_retrieval"`
ConvertCatalog float64 `yaml:"convert_catalog"`
Cron float64 `yaml:"cron"`
Exec float64 `yaml:"exec"`
FactGeneration float64 `yaml:"fact_generation"`
File float64 `yaml:"file"`
FileBucket float64 `yaml:"filebucket"`
Group float64 `yaml:"group"`
LastRun int64 `yaml:"last_run"`
NodeRetrieval float64 `yaml:"node_retrieval"`
Notify float64 `yaml:"notify"`
Package float64 `yaml:"package"`
PluginSync float64 `yaml:"plugin_sync"`
Schedule float64 `yaml:"schedule"`
Service float64 `yaml:"service"`
SSHAuthorizedKey float64 `yaml:"ssh_authorized_key"`
Total float64 `yaml:"total"`
TransactionEvaluation float64 `yaml:"transaction_evaluation"`
User float64 `yaml:"user"`
}

type version struct {
Expand Down
64 changes: 37 additions & 27 deletions plugins/inputs/puppetagent/puppetagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,43 @@ func TestGather(t *testing.T) {

tags := map[string]string{"location": "last_run_summary.yaml"}
fields := map[string]interface{}{
"events_failure": int64(0),
"events_total": int64(0),
"events_success": int64(0),
"resources_failed": int64(0),
"resources_scheduled": int64(0),
"resources_changed": int64(0),
"resources_skipped": int64(0),
"resources_total": int64(109),
"resources_failedtorestart": int64(0),
"resources_restarted": int64(0),
"resources_outofsync": int64(0),
"changes_total": int64(0),
"time_lastrun": int64(1444936531),
"version_configstring": "environment:d6018ce",
"time_user": float64(0.004331),
"time_schedule": float64(0.001123),
"time_filebucket": float64(0.000353),
"time_file": float64(0.441472),
"time_exec": float64(0.508123),
"time_anchor": float64(0.000555),
"time_sshauthorizedkey": float64(0.000764),
"time_service": float64(1.807795),
"time_package": float64(1.325788),
"time_total": float64(8.85354707064819),
"time_configretrieval": float64(4.75567007064819),
"time_cron": float64(0.000584),
"version_puppet": "3.7.5",
"events_failure": int64(0),
"events_noop": int64(0),
"events_success": int64(0),
"events_total": int64(0),
"resources_changed": int64(0),
"resources_correctivechange": int64(0),
"resources_failed": int64(0),
"resources_failedtorestart": int64(0),
"resources_outofsync": int64(0),
"resources_restarted": int64(0),
"resources_scheduled": int64(0),
"resources_skipped": int64(0),
"resources_total": int64(109),
"changes_total": int64(0),
"time_anchor": float64(0.000555),
"time_catalogapplication": float64(0.010555),
"time_configretrieval": float64(4.75567007064819),
"time_convertcatalog": float64(1.3),
"time_cron": float64(0.000584),
"time_exec": float64(0.508123),
"time_factgeneration": float64(0.34),
"time_file": float64(0.441472),
"time_filebucket": float64(0.000353),
"time_group": float64(0),
"time_lastrun": int64(1444936531),
"time_noderetrieval": float64(1.235),
"time_notify": float64(0.00035),
"time_package": float64(1.325788),
"time_pluginsync": float64(0.325788),
"time_schedule": float64(0.001123),
"time_service": float64(1.807795),
"time_sshauthorizedkey": float64(0.000764),
"time_total": float64(8.85354707064819),
"time_transactionevaluation": float64(4.69765),
"time_user": float64(0.004331),
"version_configstring": "environment:d6018ce",
"version_puppet": "3.7.5",
}

acc.AssertContainsTaggedFields(t, "puppetagent", fields, tags)
Expand Down