Code

nagixsc.git
13 years agoMigrating from "datetime" to "time"
Sven Velt [Mon, 21 Feb 2011 19:12:47 +0000 (20:12 +0100)]
Migrating from "datetime" to "time"

Windows ActivePython has some problems with "strftime()" from "datetime". All
we need is also in "time" - and is much more simple...

Signed-off-by: Sven Velt <sven@velt.de>
13 years agoxml2cfg: Try to lookup IP for host_name
Sven Velt [Thu, 17 Feb 2011 14:34:32 +0000 (15:34 +0100)]
xml2cfg: Try to lookup IP for host_name

Signed-off-by: Sven Velt <sven@velt.de>
13 years agoAdd "command_prefix" to conf files
Sven Velt [Wed, 22 Dec 2010 14:48:43 +0000 (15:48 +0100)]
Add "command_prefix" to conf files

Either use "command_prefix" in [nagixsc] for all service checks in this
conf file or use "_command_prefix" per host/sections. Last overwrites
the first.

Signed-off-by: Sven Velt <sven@velt.de>
13 years agoAdd "add_pnp4nagios_template_hint"
Sven Velt [Wed, 22 Dec 2010 14:32:09 +0000 (15:32 +0100)]
Add "add_pnp4nagios_template_hint"

Signed-off-by: Sven Velt <sven@velt.de>
13 years agoFix commit by mistake
Sven Velt [Wed, 22 Dec 2010 14:31:19 +0000 (15:31 +0100)]
Fix commit by mistake

14 years agoCorrect timestamps of passive service
Sven Velt [Fri, 19 Nov 2010 10:39:17 +0000 (11:39 +0100)]
Correct timestamps of passive service

Old: Use "now"
New: Use timestamp of service or xml file

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoobsses: Debug output, typo
Sven Velt [Fri, 15 Oct 2010 08:33:40 +0000 (10:33 +0200)]
obsses: Debug output, typo

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoACL support for http2nagios
Sven Velt [Fri, 24 Sep 2010 09:37:16 +0000 (11:37 +0200)]
ACL support for http2nagios

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoFIX: write_xml_or_die always set Auth to None...
Sven Velt [Thu, 23 Sep 2010 14:47:34 +0000 (16:47 +0200)]
FIX: write_xml_or_die always set Auth to None...

14 years agoWIP: obsess_daemon.py with additional HTTP support
Sven Velt [Thu, 23 Sep 2010 14:13:20 +0000 (16:13 +0200)]
WIP: obsess_daemon.py with additional HTTP support

Please give "URL user pass" as command line options

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoSplit write_xml(), add write_xml_or_die()
Sven Velt [Thu, 23 Sep 2010 13:32:39 +0000 (15:32 +0200)]
Split write_xml(), add write_xml_or_die()

Added "-q" to conf2xml and live2xml

Signed-off-by: Sven Velt <sven@velt.de>
14 years agohttp2nagios is now able to write to command pipe
Sven Velt [Thu, 23 Sep 2010 11:12:13 +0000 (13:12 +0200)]
http2nagios is now able to write to command pipe

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoFix: (Now real) random filenames in checkresultdir
Sven Velt [Thu, 23 Sep 2010 10:38:58 +0000 (12:38 +0200)]
Fix: (Now real) random filenames in checkresultdir

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoWIP: Obsessing/distributed setup with Nag(ix)SC
Sven Velt [Thu, 23 Sep 2010 08:11:48 +0000 (10:11 +0200)]
WIP: Obsessing/distributed setup with Nag(ix)SC

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoSmall cleanups for sample config files
Sven Velt [Mon, 6 Sep 2010 12:01:58 +0000 (14:01 +0200)]
Small cleanups for sample config files

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoNew function write_xml
Sven Velt [Mon, 6 Sep 2010 09:15:35 +0000 (11:15 +0200)]
New function write_xml

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoAdded livestatus as data source
Sven Velt [Fri, 3 Sep 2010 15:05:20 +0000 (17:05 +0200)]
Added livestatus as data source

... to conf2http (try "_livestatus" as config file name after putting
path/ip&port into conf2http.cfg)
... new command live2xml

and be a little bit more verbose in the config file of conf2http

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoFixed port for http2nagios
Sven Velt [Fri, 3 Sep 2010 14:13:47 +0000 (16:13 +0200)]
Fixed port for http2nagios

and be a little bit more verbose in sample-configs/http2nagios.cfg

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoFix for config file reading
Sven Velt [Fri, 3 Sep 2010 13:53:04 +0000 (15:53 +0200)]
Fix for config file reading

14 years agoFix for Python 2.5
Sven Velt [Thu, 26 Aug 2010 11:44:40 +0000 (13:44 +0200)]
Fix for Python 2.5

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoxml2cfg: Read templates from files
Sven Velt [Thu, 26 Aug 2010 09:50:24 +0000 (11:50 +0200)]
xml2cfg: Read templates from files

Also select if it outputs hosts and/or services

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoAdd timeout to plugin execution
Sven Velt [Tue, 27 Jul 2010 11:57:42 +0000 (13:57 +0200)]
Add timeout to plugin execution

It's now possible to terminate plugins after a few seconds. Just set
"plugin_timeout" and maybe "plugin_timeout_returncode" in "[nagixsc]"
section in the conf file. Sample config "timeout.conf" included in
"sample-configs/conf/".

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoChanged default file, add output mode
Sven Velt [Tue, 27 Jul 2010 11:50:57 +0000 (13:50 +0200)]
Changed default file, add output mode

The XML file is now read from STDIN (before: "nagixsc.xml") and output
shows human readable format ONLY. If you want a python list/dict, set
"-P" ("pprint") option at commandline.

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoAdded fork()ing to HTTP daemons
Sven Velt [Sun, 20 Jun 2010 21:01:26 +0000 (23:01 +0200)]
Added fork()ing to HTTP daemons

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoRebuild config file parsing, added defaults
Sven Velt [Thu, 17 Jun 2010 18:01:37 +0000 (20:01 +0200)]
Rebuild config file parsing, added defaults

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoReorder daemonizing (creation of PID file)
Sven Velt [Thu, 17 Jun 2010 12:51:31 +0000 (14:51 +0200)]
Reorder daemonizing (creation of PID file)

If the pipe is NOT writeable you should see an error message instead of
just a not running daemon.

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoNew init.d scripts for all distribution
Sven Velt [Thu, 17 Jun 2010 12:50:00 +0000 (14:50 +0200)]
New init.d scripts for all distribution

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoAdded README with URLs to repo
Sven Velt [Wed, 9 Jun 2010 13:30:44 +0000 (15:30 +0200)]
Added README with URLs to repo

Signed-off-by: Sven Velt <sven@velt.de>
14 years agocheck for writable checkresult directory
Joerg Linge [Thu, 3 Jun 2010 16:47:37 +0000 (00:47 +0800)]
check for writable checkresult directory

14 years agoPimp xml2cfg with code from xml2nagios
Sven Velt [Thu, 3 Jun 2010 15:18:24 +0000 (17:18 +0200)]
Pimp xml2cfg with code from xml2nagios

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoAdd function to merge multiple XML files
Sven Velt [Thu, 3 Jun 2010 12:38:09 +0000 (14:38 +0200)]
Add function to merge multiple XML files

Signed-off-by: Sven Velt <sven@velt.de>
14 years ago2nd try: Dots are a security hole in file names
Sven Velt [Thu, 27 May 2010 13:29:29 +0000 (15:29 +0200)]
2nd try: Dots are a security hole in file names

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoDots are a security hole in filenames
Sven Velt [Tue, 25 May 2010 14:02:50 +0000 (16:02 +0200)]
Dots are a security hole in filenames

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoFix "active" mode to check if only 1 result in XML
Sven Velt [Fri, 26 Mar 2010 14:27:45 +0000 (15:27 +0100)]
Fix "active" mode to check if only 1 result in XML

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoFilter out host check if -D specified
Sven Velt [Tue, 23 Mar 2010 16:40:38 +0000 (17:40 +0100)]
Filter out host check if -D specified

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoDisable SSL in sample-configs/*.cfg
Sven Velt [Tue, 23 Mar 2010 16:23:07 +0000 (17:23 +0100)]
Disable SSL in sample-configs/*.cfg

Could be confusing because of not existing cert/key file.

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoAdded check if command line is empty
Sven Velt [Fri, 5 Mar 2010 12:06:52 +0000 (13:06 +0100)]
Added check if command line is empty

An empty command line entry in conf file did raise an error within
subprocess call. Now an unknow check result is returned.

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoHTTP-Server can now daemonize
Sven Velt [Thu, 4 Mar 2010 13:58:01 +0000 (14:58 +0100)]
HTTP-Server can now daemonize

Added daemonize() to nagixsc and "-d" or "--daemon" to conf2http and
http2nagios.

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoRename scripts and python module
Sven Velt [Thu, 4 Mar 2010 09:18:02 +0000 (10:18 +0100)]
Rename scripts and python module

Put nagixsc.py into nagixsc/__init__.py to use and install it as an usul
Python module.

Renamed dummy_* to more "offical" names.

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoSmall fix if run in "checkresult" mode
Sven Velt [Tue, 23 Feb 2010 15:10:27 +0000 (16:10 +0100)]
Small fix if run in "checkresult" mode

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoAdded --nossl to HTTP daemons
Sven Velt [Thu, 18 Feb 2010 12:08:43 +0000 (13:08 +0100)]
Added --nossl to HTTP daemons

Disable SSL on command line even if it's activated in cfg file.

Signed-off-by: Sven Velt <sven@velt.de>
14 years agoconf2xml: Added HTTP POST support
Sven Velt [Wed, 17 Feb 2010 15:51:00 +0000 (16:51 +0100)]
conf2xml: Added HTTP POST support

It's not longer necessary to create and XML file, save it and
HTTP(S)-POST it with curl. Just use a URL as output file, add -l/-a if
login is required and be happy :)

14 years agoSmall syntax fix
Sven Velt [Wed, 17 Feb 2010 15:50:34 +0000 (16:50 +0100)]
Small syntax fix

14 years agoFix filename
Sven Velt [Tue, 9 Feb 2010 22:17:33 +0000 (23:17 +0100)]
Fix filename

14 years agoRework http2nagios (and xml2nagios) and add SSL
Sven Velt [Tue, 9 Feb 2010 22:13:03 +0000 (23:13 +0100)]
Rework http2nagios (and xml2nagios) and add SSL

"nagixsc_http2nagios.py" does not call "nagixsc_xml2nagios.py" as a subprocess
anymore.

Instead there are 2 function "dict2out_passive" for passive checks and
"dict2out_checkresult" for check result creation.

And... nagixsc_http2nagios now also supports SSL so noone has to send
his authentication data unencrypted over the network :)

14 years agoconf2http can now use SSL!
Sven Velt [Tue, 9 Feb 2010 14:03:05 +0000 (15:03 +0100)]
conf2http can now use SSL!

Have a look at the conf2http.cfg! It *needs* two more options, "ssl" and
"sslcert". To be sure use a *FULL* pathname to key/cert file.

Create a key and self-signed certificate with:

% openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
          -keyout server.pem -out server.pem

14 years agoEnhance conf2http (and conf2xml)
Sven Velt [Wed, 13 Jan 2010 23:20:00 +0000 (00:20 +0100)]
Enhance conf2http (and conf2xml)

"nagixsc_conf2http.py" does not call "nagixsc_conf2xml.py" as a
subprocess anymore.

Instead "conf2dict()" is now a function in "nagixsc.py" and can be
called without fork()/exec().

14 years agoMove encoding check to "nagixsc.py"
Sven Velt [Wed, 13 Jan 2010 22:09:55 +0000 (23:09 +0100)]
Move encoding check to "nagixsc.py"

14 years agoMove "exec_check" to nagixsc.py
Sven Velt [Wed, 13 Jan 2010 21:55:15 +0000 (22:55 +0100)]
Move "exec_check" to nagixsc.py

14 years agoAllow command lines with quotes
Sven Velt [Fri, 8 Jan 2010 13:48:12 +0000 (14:48 +0100)]
Allow command lines with quotes

Until now command lines where split at spaces (" ") but if you want some
string arguments including spaces ("-e '220 mail.server.de'") this
doesn't work anymore. So now we use "shlex.split()" for this.

14 years agoAdded check to reset future timestamps
Sven Velt [Tue, 5 Jan 2010 14:03:54 +0000 (15:03 +0100)]
Added check to reset future timestamps

14 years agoOutput service only if description is set
Sven Velt [Fri, 18 Dec 2009 14:50:07 +0000 (15:50 +0100)]
Output service only if description is set

14 years agoConfig files and cmd line options for daemons
Sven Velt [Thu, 17 Dec 2009 23:59:30 +0000 (00:59 +0100)]
Config files and cmd line options for daemons

Moved config files from examples/ to sample-configs/conf/, new config
files for daemons in sample-configs/

Changed path names in QUICKSTART.de.txt

14 years agoImport md5 from hashlib/md5, dep. on Py version
Sven Velt [Wed, 16 Dec 2009 16:35:45 +0000 (17:35 +0100)]
Import md5 from hashlib/md5, dep. on Py version

2.4: Only "md5" available
2.5: "md5" and "hashlib" work
2.6: Only "hashlib"

So try to "from hashlib import md5" and if it doesn't work just do a
"from md5 import md5" and just use "md5(___).hexdigest()" in the code.

14 years agoAgain still PoC, but reworked w/o CherryPy
Sven Velt [Mon, 14 Dec 2009 23:38:16 +0000 (00:38 +0100)]
Again still PoC, but reworked w/o CherryPy

14 years agoStill PoC, but reworked w/o CherryPy
Sven Velt [Mon, 14 Dec 2009 23:07:43 +0000 (00:07 +0100)]
Still PoC, but reworked w/o CherryPy

14 years agoFix "file -1 seconds old" bug
Sven Velt [Mon, 14 Dec 2009 23:11:40 +0000 (00:11 +0100)]
Fix "file -1 seconds old" bug

14 years agoWIP: PoC of "http2nagios" / rename "cgi"->"http"
Sven Velt [Fri, 11 Dec 2009 11:58:29 +0000 (12:58 +0100)]
WIP: PoC of "http2nagios" / rename "cgi"->"http"

14 years agoWIP: PoC of conf2cgi/Nag(ix)RPE \o/
Sven Velt [Tue, 8 Dec 2009 22:45:19 +0000 (23:45 +0100)]
WIP: PoC of conf2cgi/Nag(ix)RPE  \o/

14 years agoFilter option build into nagixsc_conf2xml (-H/-D)
Sven Velt [Tue, 8 Dec 2009 21:57:12 +0000 (22:57 +0100)]
Filter option build into nagixsc_conf2xml (-H/-D)

14 years agoAllow HTTP username and password (-l/-a)
Sven Velt [Tue, 8 Dec 2009 13:26:58 +0000 (14:26 +0100)]
Allow HTTP username and password (-l/-a)

14 years agoAdded host checks
Sven Velt [Tue, 8 Dec 2009 11:06:13 +0000 (12:06 +0100)]
Added host checks

15 years agoTypo in QUICKSTART.de.txt, thx to Sven Jeck
Sven Velt [Fri, 4 Dec 2009 08:47:50 +0000 (09:47 +0100)]
Typo in QUICKSTART.de.txt, thx to Sven Jeck

15 years agoWIP: Generate minimal, hardcoded Nagios cfg from XML
Sven Velt [Mon, 30 Nov 2009 10:53:31 +0000 (11:53 +0100)]
WIP: Generate minimal, hardcoded Nagios cfg from XML

15 years agoInitial commit
Sven Velt [Sun, 29 Nov 2009 19:26:08 +0000 (20:26 +0100)]
Initial commit