Merge pull request #1252 from sjenning/prefer-systemd

prefer using systemd for oom monitoring
This commit is contained in:
Tim St. Clair 2016-05-02 11:50:53 -07:00
commit ee5bad8d84

View File

@ -205,13 +205,17 @@ func getSystemFile() (string, error) {
// initializes an OomParser object and calls getSystemFile to set the systemFile
// attribute. Returns and OomParser object and an error
func New() (*OomParser, error) {
parser, err := trySystemd()
if err == nil {
return parser, nil
}
systemFile, err := getSystemFile()
if err != nil {
return trySystemd()
return nil, err
}
file, err := os.Open(systemFile)
if err != nil {
return trySystemd()
return nil, err
}
return &OomParser{
ioreader: bufio.NewReader(file),