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

Watchmaker Status in System Log #415

Closed
Singlespeedinian opened this issue Nov 14, 2017 · 4 comments
Closed

Watchmaker Status in System Log #415

Singlespeedinian opened this issue Nov 14, 2017 · 4 comments

Comments

@Singlespeedinian
Copy link

Story:

As a System Administrator I want the ability to navigate to Instance Settings > Get System log in the AWS Console in order to verify that Watchmaker ran successfully.

Back of the card:

System Administrators should not need to SSH or RDP into each Instance to verify that WAM ran. They should be able to verify based on the contents of the system log within the AWS console.

  • If WAM ran successfully with no errors or warnings a "Watchmaker Status: Success!" message should appear in the system log

  • If WAM encountered a warning or error a "Watchmaker Status: <error / warning>" should be in the system log. For more detailed messages or stack traces the watchmaker.log file works just fine

@lorengordon
Copy link
Member

We've been thinking about this for a while actually, as we did something like this with SystemPrep. However, it wasn't really part of SystemPrep itself; it was tacked on in the wrapper that executed SystemPrep.

Watchmaker is much more finely scoped. Now, whether watchmaker ran successfully or not is purely determined through it's exit code. By definition, the exit code can only be captured outside of watchmaker. As a result, I don't think this feature can be implemented within the watchmaker project.

Also, watchmaker is agnostic to the infrastructure; we would not incorporate AWS-only features directly into watchmaker. For instances running on AWS, I'd recommend looking at Cloudwatch Logs to capture the watchmaker log file, and Cloudwatch Events to setup a trigger on success/failure.

@lorengordon
Copy link
Member

Streaming the watchmaker log to a Windows Event Log might work out: https://docs.python.org/2/library/logging.handlers.html#nteventloghandler

@lorengordon
Copy link
Member

Step 1: #421

@lorengordon
Copy link
Member

Getting closer. Got it working for Windows 2008 and 2012:

2017/12/11 13:45:19Z: EventLogEntry: Information  12/11/2017 1:45:19 PM  Watchmaker  2017-12-11 13:45:19,876 [watchmaker.managers.base.SaltWindows][INFO ][992]: No States were specified. Will not apply any salt states.
2017/12/11 13:45:19Z: EventLogEntry: Information  12/11/2017 1:45:19 PM  Watchmaker  2017-12-11 13:45:19,876 [watchmaker.managers.base.SaltWindows][INFO ][992]: Cleanup Time...
2017/12/11 13:45:19Z: EventLogEntry: Information  12/11/2017 1:45:19 PM  Watchmaker  2017-12-11 13:45:19,876 [watchmaker.managers.base.SaltWindows][DEBUG][992]: working_dir=C:\Watchmaker\WorkingFiles\Salt-owpzok6q
2017/12/11 13:45:19Z: EventLogEntry: Information  12/11/2017 1:45:19 PM  Watchmaker  2017-12-11 13:45:19,876 [watchmaker.managers.base.SaltWindows][INFO ][992]: Deleted working directory...
2017/12/11 13:45:19Z: EventLogEntry: Information  12/11/2017 1:45:19 PM  Watchmaker  2017-12-11 13:45:19,876 [watchmaker.managers.base.SaltWindows][INFO ][992]: Exiting cleanup routine...
2017/12/11 13:45:19Z: EventLogEntry: Information  12/11/2017 1:45:19 PM  Watchmaker  2017-12-11 13:45:19,876 [watchmaker.Client][INFO ][992]: Reboot scheduled. System will reboot after the script exits.
2017/12/11 13:45:19Z: EventLogEntry: Information  12/11/2017 1:45:19 PM  Watchmaker  2017-12-11 13:45:19,938 [watchmaker.Client][INFO ][992]: Stop time: 2017-12-11 13:45:19.938693

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants