How to generate a report of all changed config channel files?
I'm working on building a report to show all the changed files for all the systems
in my satellite, but I can't quite seem to find any useful information in the API.
What I would like is report that mirrors the information found by the scheduled action:
"Show differences between profiled config files and deployed config files"
The problem, as usual, is the information in the WebUI is not condusive
to reporting on large numbers of systems, and the API doesn't have it.
The closest thing are the system.config methods, but they don't have any
way to directly compare information.
I've considered hitting all the client systems and running rhncfg-client verify (yuck),
or trying to webscrape the WebUI (more yuck).
I'd like to produce something like the rhncfg-client verify output but
from the backend that would look something like this for every system:
system: foo
system_id:100000100
modified_files: {
{name: "/etc/sudoers", type: "file", system_rev: "5", channel: "base-files", sat_rev:"7"},
{name: "/etc/sudoers.d", type: "directory", system_rev: "3", channel: "override-files", sat_rev:"5"}
}
The only thing that appears to have anything related to this level of file comparison is
the scheduled action to compare files. It doesn't look like this type of data exists normally.
So looking at scheduleFileComparisons(), that doesn't really help any.
Notwithstanding the problem of having to schedule for each individual file path for
every server in the list, it's a scheduled action, so I don't know when it's complete.
Getting the actionId doesn't tell me anything useful, either. So, once that activity is done,
I can't do anything with the results, and I have to wait X hours to get the info in the first place.
If it had something in the API like configchannel.getActionResults()
that allowed me to traverse the details of the action I scheduled, that
would be useful. eg,
Method: getComparisonResults()
Description:
Get Detailed Results of a given Action
parameters:
string sessionKey
int actionId
Returns:
struct - comparisonDetails
int "id" - action Id
... whatever other basic action info ...
struct - iterable list of systems to see the actual
results of the comparison
The key part is to be able to actually look at the comparison results
for a given action, and that doesn't currently exist. What I'm looking
for is an API equivalent to:
htp://satserver/rhn/schedule/CompletedSystems.do
It shows a list of all servers, where you can drill down on a given server and
see all the file comparisons, which is exctly what I want, but it's not
something that exists in a report format. Responses
rhncfg-client diff [filename]
It'll show the diff against local vs Satellite analogus to "rcsdiff -u 'copy in Satellite' 'local_file'". If the local file is not found the filename will be '/dev/null'. It's not very readable but I'll leave the re-parsing as an exercise.
> looking to the API for something to generate a report
Sorry to have misunderstood you. So you want an API call that will return 'TRUE' if the last run of "compare-files" job found a difference? Obviously Satellite knows the status of this flag because it reports the sum() in my nightly email. If you want the actual diffs you'll have to go find the Java routine that the WebUI uses. I don't believe they exposed that call in the API either. You'll have to de-compile the java files for that task to ascertain exactly what it does. I'm certain there is a database field that stores the flag and the last scrape of the managed files.
That brings up a good point though. There is no "status" display in the WebUI to indicate configuration deviation. That's a pretty big oversight.
[OT: and this is one of my major beefs with the use of Task-o-matic. Cron+AT has worked just fine for 40 years. I wish RedHat would stop introducing unnecessary complexity. If the 'bundles' were python/perl we'd have a prayer of understanding what was going on. Ditto the problem-child that is Jabber. What's so hard about doing a 'wget http://<satellite/jobs/<hostid>/<jobid>" and having the client parse that? Just because all those 1337 botnets use chat servers for command control doesn't mean it should be used. KISS, people!]
This'll be flagged as "offensive" probably, but at the end of the day what you want is Puppet or Chef. ;-)
The configuration channel aspect of Satellite was quite poorly thought out. Even a cursory design of such a system would have allowed for a direct tie-in between host-groups and configuration channels. It would furthermore have had a logic engine such that you could do conditional overrides be it for individual hosts or host-groups. Whomever wrote the code simply didn't think the problem through.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
