Skip to content

Instantly share code, notes, and snippets.

@neilhwatson
Created July 15, 2015 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neilhwatson/4b01b0c86c84cba6eef7 to your computer and use it in GitHub Desktop.
Save neilhwatson/4b01b0c86c84cba6eef7 to your computer and use it in GitHub Desktop.
data processing for rlinder
neil@ettin ~/.cfagent/inputs $ cat rlinder.cf
body common control
{
bundlesequence => {
"main",
};
}
bundle agent main
{
methods:
"any" usebundle => test;
}
bundle agent test
{
vars:
"pwds" data => parsejson('
[
{ "user": "joe",
"hash": "*KRB*",
"uid" : "1357",
"promisee": "sysadmin team",
},
{ "user": "bob",
"hash": "*LCK*",
"uid" : "1354",
"promisee": "sysadmin team",
}
]
');
"i" slist => getindices( "pwds" );
"users[${i}]" string => "${pwds[${i}][user]}";
"users" slist => getvalues( 'users' );
reports:
"method( ${pwds[${i}][user]},${pwds[${i}][hash]},${pwds[${i}][uid]},${pwds[${i}][promisee]} )";
"users: ${users}";
}
neil@ettin ~/.cfagent/inputs $ cf-agent -Kf ./rlinder.cf
R: method( joe,*KRB*,1357,sysadmin team )
R: method( bob,*LCK*,1354,sysadmin team )
R: users: bob
R: users: joe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment