prefer using systemd for oom monitoring

This commit is contained in:
Seth Jennings 2016-04-28 11:22:13 -05:00
parent ae814a5fff
commit 5fa60e5019

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),