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

Fixes #5827: Add a technique to send send metrics #569

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
3 changes: 3 additions & 0 deletions techniques/system/server-roles/1.0/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<OUTPATH>rudder-server-roles.conf</OUTPATH>
<INCLUDED>false</INCLUDED>
</TML>
<TML name="metrics-reporting"/>
</TMLS>

<BUNDLES>
<NAME>root_component_check</NAME>
<NAME>metrics_reporting</NAME>
</BUNDLES>

<SYSTEMVARS>
Expand Down Expand Up @@ -69,6 +71,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<SECTION name="Check SQL credentials" component="true"/>
<SECTION name="Check SQL in rudder-webapp.properties" component="true"/>
<SECTION name="Check WebDAV credentials" component="true"/>
<SECTION name="Send metrics to rudder-project" component="true"/>
</SECTIONS>

</TECHNIQUE>
39 changes: 39 additions & 0 deletions techniques/system/server-roles/1.0/metrics-reporting.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
####################################################################################
# Copyright 2014 Normation SAS
#####################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#####################################################################################

bundle agent metrics_reporting
{
classes:
"accept_metrics" expression => strcmp("&SEND_METRICS&", "yes");
"run_metrics" expression => "accept_metrics.role_rudder_server_root";

"pass2" expression => "pass1";
"pass1" expression => "any";

methods:
run_metrics.pass2.metrics_ok::
"any" usebundle => rudder_common_report("server-roles", "result_success", "&TRACKINGKEY&", "Send metrics to rudder-project", "None", "Sending metrics to rudder-project succeded");
run_metrics.pass2.metrics_error::
"any" usebundle => rudder_common_report("server-roles", "result_error", "&TRACKINGKEY&", "Send metrics to rudder-project", "None", "Sending metrics to rudder-project failed");

commands:
run_metrics.!(metrics_ok|metrics_error)::
"/opt/rudder/bin/rudder-metrics-reporting -s"
# 10080 mn is 7 days
classes => rudder_common_classes_persist("metrics" ,"10080");
}