Skip to content

Instantly share code, notes, and snippets.

@neilhwatson
Last active August 29, 2015 14:22
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/6f9d2f514d9ff64cb4e8 to your computer and use it in GitHub Desktop.
Save neilhwatson/6f9d2f514d9ff64cb4e8 to your computer and use it in GitHub Desktop.
body common control
{
bundlesequence => {
"main",
};
}
bundle agent main
{
methods:
"any" usebundle => fwports;
"any" usebundle => test;
}
bundle agent fwports
{
vars:
"tcp" data => parsejson( '
{
"inbound" :
{
"ssh" : 22,
"smtp" : 25,
"ntp" : 123
},
"outbound" :
{
"ssh" : 22,
"http" : 80,
"https" : 443
}
}
');
}
bundle agent test
{
vars:
"i" slist => getindices( "fwports.tcp[inbound]" );
reports:
"inbound_tcp port [${fwports.tcp[inbound][${i}]}] for [${i}]";
}
neil@ettin ~/.cfagent/inputs $ cf-agent -Kf ./fwports.cf
R: inbound_tcp port [22] for [ssh]
R: inbound_tcp port [25] for [smtp]
R: inbound_tcp port [123] for [ntp]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment