Skip to content

Commit

Permalink
nagios4 livestatus support
Browse files Browse the repository at this point in the history
It is now possible to compile livestatus for nagios4.
The <tt>setup.sh</tt> script from the check_mk tarball now autodetects
the nagios version and proposes it during the setup process.<br>
You can also choose the version manually (3 or 4).<br>
Depending on the chosen version livestatus includes the nagios headers from 3.2.0 or 4.0.2.<br><br>

If you just want to compile livestatus you can set the nagios version via an option in the configure script.<br>
<tt>configure --with-nagios4<tt>
  • Loading branch information
Andreas Boesl committed Feb 6, 2014
1 parent 20b5864 commit bc2a9b3
Show file tree
Hide file tree
Showing 62 changed files with 7,423 additions and 15 deletions.
15 changes: 15 additions & 0 deletions .werks/276
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Title: nagios4 livestatus support
Level: 3
Component: livestatus
Version: 1.2.5i1
Date: 1391698284
Class: feature

It is now possible to compile livestatus for nagios4.
The <tt>setup.sh</tt> script from the check_mk tarball now autodetects
the nagios version and proposes it during the setup process.<br>
You can also choose the version manually (3 or 4).<br>
Depending on the chosen version livestatus includes the nagios headers from 3.2.0 or 4.0.2.<br><br>

If you just want to compile livestatus you can set the nagios version via an option in the configure script.<br>
<tt>configure --with-nagios4<tt>
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@

Livestatus:
* 0337 New header for limiting the execution time of a query...
* 0276 nagios4 livestatus support...
* 0335 FIX: Parse state of downtime notification log entries correctly...
* 0336 FIX: Limit the number of lines read from a single logfile...
* 0344 FIX: Fix semantics of columns num_services_hard_*...
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TAROPTS = --owner=root --group=root --exclude=.svn --exclude=*~ \
--exclude=.gitignore --exclude=.*.swp --exclude=.f12
LIVESTATUS_SOURCES = configure aclocal.m4 config.guess config.h.in config.sub \
configure.ac ltmain.sh Makefile.am Makefile.in missing \
nagios/README nagios/*.h src/*.{h,c,cc} src/Makefile.{in,am} \
nagios/README nagios/*.h nagios4/README nagios4/*.h src/*.{h,c,cc} src/Makefile.{in,am} \
depcomp install-sh api/python/{*.py,README} api/perl/*


Expand Down Expand Up @@ -126,6 +126,8 @@ mk-livestatus:
cd livestatus ; tar cf - $(LIVESTATUS_SOURCES) | tar xf - -C ../mk-livestatus-$(VERSION)
mkdir -p mk-livestatus-$(VERSION)/nagios
cp livestatus/nagios/*.h mk-livestatus-$(VERSION)/nagios/
mkdir -p mk-livestatus-$(VERSION)/nagios4
cp livestatus/nagios4/*.h mk-livestatus-$(VERSION)/nagios4/
tar czf mk-livestatus-$(VERSION).tar.gz $(TAROPTS) mk-livestatus-$(VERSION)
rm -rf mk-livestatus-$(VERSION)

Expand Down
Binary file modified agents/windows/check_mk_agent.exe
Binary file not shown.
Binary file modified agents/windows/crash.exe
Binary file not shown.
Binary file modified agents/windows/install_agent.exe
Binary file not shown.
Binary file modified agents/windows/nowin.exe
Binary file not shown.
7 changes: 7 additions & 0 deletions livestatus/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_CHECK_FUNCS([bzero gettimeofday memmove regcomp select socket strcasecmp strdup strerror strtoul])

AC_ARG_WITH(nagios4,AC_HELP_STRING([--with-nagios4],[enabled compilation for nagios 4]), [
CPPFLAGS="${CFLAGS} -DNAGIOS4"
nagios_headers=nagios4
],
nagios_headers=nagios)
AC_SUBST(nagios_headers)

AC_CONFIG_FILES([Makefile
src/Makefile])
AC_OUTPUT
1 change: 1 addition & 0 deletions livestatus/nagios4/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These files are taken directly from Nagios 4.0.2.
156 changes: 156 additions & 0 deletions livestatus/nagios4/bitmap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#ifndef LIBNAGIOS_bitmap_h__
#define LIBNAGIOS_bitmap_h__

/**
* @file bitmap.h
* @brief Bit map API
*
* The bitmap api is useful for running set operations on objects
* indexed by unsigned integers.
* @{
*/
struct bitmap;
typedef struct bitmap bitmap;

/**
* Resize a bitmap
* If the bitmap is made smaller, data will silently be lost.
*
* @param bm The bitmap to resize
* @param size The new desired size of the bitmap
* @return 0 on success, -1 on errors.
*/
extern int bitmap_resize(bitmap *bm, unsigned long size);

/**
* Create a bitmaptor of size 'size'
* @param size Desired storage capacity
* @return A bitmap pointer on success, NULL on errors
*/
extern bitmap *bitmap_create(unsigned long size);

/**
* Destroy a bitmaptor by freeing all the memory it uses
* @param bm The bitmaptor to destroy
*/
extern void bitmap_destroy(bitmap *bm);

/**
* Copy a bitmaptor
* @param bm The bitmaptor to copy
* @return Pointer to an identical bitmap on success, NULL on errors
*/
extern bitmap *bitmap_copy(const bitmap *bm);

/**
* Set a bit in the map
* @param bm The bitmaptor to operate on
* @param pos Position of the bit to set
* @return 0 on success, -1 on errors
*/
extern int bitmap_set(bitmap *bm, unsigned long pos);

/**
* Check if a particular bit is set in the map
* @param bm The bitmaptor to check
* @param pos Position of the bit to check
* @return 1 if set, otherwise 0
*/
extern int bitmap_isset(const bitmap *bm, unsigned long pos);

/**
* Unset a particular bit in the map
* @param bm The bitmaptor to operate on
* @param pos Position of the bit to unset
*/
extern int bitmap_unset(bitmap *bm, unsigned long pos);

/**
* Obtain cardinality (max number of elements) of the bitmaptor
* @param bm The bitmaptor to check
* @return The cardinality of the bitmaptor
*/
extern unsigned long bitmap_cardinality(const bitmap *bm);
#define bitmap_size bitmap_cardinality

/**
* Count set bits in map. Completed in O(n/8) time.
* @param bm The bitmaptor to count bits in
* @return The number of set bits
*/
extern unsigned long bitmap_count_set_bits(const bitmap *bm);

/**
* Count unset bits in map. Completed in O(n/8) time.
* @param bm The bitmaptor to count bits in
* @return The number of set bits
*/
extern unsigned long bitmap_count_unset_bits(const bitmap *bm);

/**
* Unset all bits in a bitmap
* @param bm The bitmap to clear
*/
extern void bitmap_clear(bitmap *bm);

/**
* Calculate intersection of two bitmaps
* The intersection is defined as all bits that are members of
* both A and B. It's equivalent to bitwise AND.
* This function completes in O(n/sizeof(long)) operations.
* @param a The first bitmaptor
* @param b The second bitmaptor
* @return NULL on errors; A newly created bitmaptor on success.
*/
extern bitmap *bitmap_intersect(const bitmap *a, const bitmap *b);

/**
* Calculate union of two bitmaps
* The union is defined as all bits that are members of
* A or B or both A and B. It's equivalent to bitwise OR.
* This function completes in O(n/sizeof(long)) operations.
* @param a The first bitmaptor
* @param b The second bitmaptor
* @return NULL on errors; A newly created bitmaptor on success.
*/
extern bitmap *bitmap_union(const bitmap *a, const bitmap *b);

/**
* Calculate union of two bitmaps and store result in one of them
* @param res The first bitmap
* @param addme The bitmap to unite to the first bitmap
* @return NULL on errors, res on success
*/
extern bitmap *bitmap_unite(bitmap *res, const bitmap *addme);

/**
* Calculate set difference between two bitmaps
* The set difference of A / B is defined as all members of A
* that isn't members of B. Note that parameter ordering matters
* for this function.
* This function completes in O(n/sizeof(long)) operations.
* @param a The first bitmaptor (numerator)
* @param b The first bitmaptor (denominator)
* @return NULL on errors; A newly created bitmaptor on success.
*/
extern bitmap *bitmap_diff(const bitmap *a, const bitmap *b);

/**
* Calculate symmetric difference between two bitmaps
* The symmetric difference between A and B is the set that
* contains all elements in either set but not in both.
* This function completes in O(n/sizeof(long)) operations.
* @param a The first bitmaptor
* @param b The second bitmaptor
*/
extern bitmap *bitmap_symdiff(const bitmap *a, const bitmap *b);

/**
* Compare two bitmaps for equality
* @param a The first bitmaptor
* @param b The other bitmaptor
* @return Similar to memcmp(), with tiebreaks determined by cardinality
*/
extern int bitmap_cmp(const bitmap *a, const bitmap *b);
/** @} */
#endif /* LIBNAGIOS_bitmap_h__ */
Loading

0 comments on commit bc2a9b3

Please sign in to comment.