monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any suggestions for checking installed packages on RHEL?


From: Christopher Wood
Subject: Re: Any suggestions for checking installed packages on RHEL?
Date: Thu, 25 May 2017 14:23:29 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

This question is usually where I say that people shouldn't be checking if 
packages exist, they should be instead be managing packages with configuration 
management. That way you only need to monitor the results of one config run on 
a server rather than all the individual packages.

More topically, if you have a list of package names you can check them against 
the list from "rpm -qa" and alert. Here's a facter (docs.puppet.com/facter) 
fact which reports package versions for selected packages, you can do something 
similar in a monitoring script and add anything you want like missing package 
notification.

packages = [
  'bash',
]

rpmqa = %x{/bin/rpm -qa --qf '%{NAME};%{V};%{RELEASE}\n'}

output = []

rpmqa.split("\n").each do |line|
  packages.each do |name|
    if /^#{name};/.match(line)
      output << line
    end
  end
end

Facter.add('package_audit') do
  setcode do
    output
  end
end



On Thu, May 25, 2017 at 10:43:59AM -0700, Billy Vitro wrote:
> Does anyone have good suggestions on checking for specific packages (e.g.
> perl-DBD-SQLite) installed on an RHEL host. I know I could just run 'rpm -qa
> perl-DBD-SQLite') for each package, but I was wondering if someone built
> something more thorough.
> 
> Thanks.
> -- 
> Billy Vitro                       |  cisco Systems, Inc.
> address@hidden                  |  (408) 526-4817
> http://www.linkedin.com/in/bvitro |  Illegitimus non carborundum.
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general



reply via email to

[Prev in Thread] Current Thread [Next in Thread]