[BlueOnyx:25164] Re: Update Monitoring

Michael Stauber mstauber at blueonyx.it
Thu Oct 14 11:23:05 -05 2021


Hi Tobias,

> we are monitoring the availability of os updates of all of our servers
> with a nagios installation via querying yum.
> 
> I wonder how to monitor updates of the blueonyx.it packages as well - as
> they are not fed through a yum repo. Michael, can you give a hint where
> to look at?

A good place to start is this Active Monitor component:

/usr/sausalito/swatch/bin/am_updates.pl

It polls NewLinQ and checks if there are updated PKGs available for PKGs
that you already have installed. Active Monitor runs it every 15 minutes.

Turn on Debugging in the script and watch /var/log/messages and if
everything is fully up to date you'll see "PKGs are up to date." in the
logfile.

If you want to make it *really* simple, use this script instead:

#---------------------------------------------------------------
#!/usr/bin/perl -I/usr/sausalito/perl

use CCE;

my $cce = new CCE;
$cce->connectuds();

@am_oid = $cce->find('ActiveMonitor');
($ok, $AM) = $cce->get($am_oid[0]);
($ok, $Updates) = $cce->get($AM, 'Updates');

if ($Updates->{'currentState'} == 'G') {
	print "Fully up to date\n";
}
else {
	print "Updates are available\n";
}

$cce->bye('SUCCESS');
exit(0);
#---------------------------------------------------------------

That just polls "Active Monitor", which checks the 'Updates' NameSpace
field 'currentState'. That has three possible values: "G", "Y", "R"
(Green, Yellow, Red).

If that field is not "G", then PKG Updates are available for PKGs that
are already installed.

If you want or need a list of PKGs that are available for install as
updates (or in general), then it gets more complicated, but the
principle is the same:

Query CCE for "Package" and it will report all objects of Class
"Package". Which includes both PKGs that are installed as well as those
that are available on NewLinQ. Then check the field 'installState'. That
is either set to "Available" or "Installed".

The complicated part is comparing if a PKG of a given name (example:
"PHP80") is present with 'installState' "Installed" and if there is
another with the same name ("PHP80") that has the 'installState'
"Available". If so, then this is an available update.

Let me know if you need any more info and I'll see what I can do.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list