Skip to content

Instantly share code, notes, and snippets.

@frbayart
Created May 16, 2012 12:12
Show Gist options
  • Save frbayart/2709892 to your computer and use it in GitHub Desktop.
Save frbayart/2709892 to your computer and use it in GitHub Desktop.
mysql_user with cfengine
bundle agent mysql_user() {
vars:
any::
"users_to_check" slist => { "francois", "benoit" };
"user_is_not_here" string => execresult("/usr/local/bin/mysql_user_check $(users_to_check)","noshell");
classes:
"mysql_check_OK" expression => strcmp("$(user_is_not_here)", "OK");
"mysql_check_NOK" expression => strcmp("$(user_is_not_here)", "NOK");
reports:
mysql_check_OK.!mysql_check_NOK::
"users exists";
mysql_check_NOK.!mysql_check_OK::
"users unknown";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment