Skip to content

Commit

Permalink
Merge pull request #616 from NagiosEnterprises/maint
Browse files Browse the repository at this point in the history
Release version 2.2.1
  • Loading branch information
jomann09 authored Feb 24, 2020
2 parents 2770224 + 863a8b1 commit d118e54
Show file tree
Hide file tree
Showing 25 changed files with 640 additions and 83 deletions.
11 changes: 10 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
Changelog
+++++++++

2.2.1 - 02/24/2020
==================
- Updated jQuery to 3.4.1 to fix security issues in CVE-2015-9251 and CVE-2019-11358
- Updated D3.js graphing library from version 4.x to 5.x
- Updated service API endpoint UNKNOWN output to explain what services were not found (#600,#601)
- Fixed ncpa.db file would being rewritten on upgrades, future upgrades will not have this happen (#589)
- Fixed issue with Solaris 11.4 services output parsing (thanks ljlapierre) (#610)
- Fixed GUI API browser active/passive check examples for the logs module missing filters (#595)

2.2.0 - 10/24/2019
===================
==================
- Added registry ProductID to Windows install registery key for easier lookup (#579)
- Added proper UNKNOWN output text prefix on checks that return UNKNOWN states (#575)
- Added X-Frame-Options and Content-Security-Policy to not allow NCPA in frames by default
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Downloads
Current versions:

+---------+-------------+-------------------------------------------------------+
| Current | **2.2.0** | `Downloads <https://www.nagios.org/ncpa/#downloads>`_ |
| Current | **2.2.1** | `Downloads <https://www.nagios.org/ncpa/#downloads>`_ |
+---------+-------------+-------------------------------------------------------+

`Older Versions <https://www.nagios.org/ncpa/archive.php>`_
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0
2.2.1
2 changes: 1 addition & 1 deletion agent/listener/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import ipaddress


__VERSION__ = '2.2.0'
__VERSION__ = '2.2.1'
__STARTED__ = datetime.datetime.now()
__INTERNAL__ = False

Expand Down
28 changes: 22 additions & 6 deletions agent/listener/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def get_services_via_lssrc(self, *args, **kwargs):
def get_services_via_svcs(self, *args, **kwargs):
services = {}
status = tempfile.TemporaryFile()
service = subprocess.Popen(['svcs', '-a'], stdout=status)
service = subprocess.Popen(['svcs', '-a', '-o', 'STATE,FMRI'], stdout=status)
service.wait()
status.seek(0)

Expand All @@ -288,10 +288,10 @@ def get_services_via_svcs(self, *args, **kwargs):
ls = line.split()

# Skip lrc items
if 'lrc:/' in ls[2]:
if 'lrc:/' in ls[1]:
continue

sub = ls[2].replace('svc:/', '').replace('/', '|')
sub = ls[1].replace('svc:/', '').replace('/', '|')
status = ls[0]
if status == 'online':
services[sub] = 'running'
Expand Down Expand Up @@ -320,8 +320,10 @@ def get_target_status(request_args):
def make_stdout(returncode, stdout_builder):
if returncode == 0:
prefix = 'OK'
elif returncode == 2:
prefix = 'CRITICAL';
else:
prefix = 'CRITICAL'
prefix = 'UNKNOWN'

prioritized_stdout = sorted(stdout_builder, key=lambda x: x['priority'], reverse=True)
info_line = ', '.join([x['info'] for x in prioritized_stdout])
Expand All @@ -333,6 +335,11 @@ def run_check(self, *args, **kwargs):
target_status = self.get_target_status(kwargs)
method = self.get_service_method(*args, **kwargs)

# Get a list of all services to be looking for
filtered_services = kwargs.get('service', [])
if not isinstance(filtered_services, list):
filtered_services = [filtered_services]

# Default to running status, so it will alert on not running
if not target_status:
target_status = 'running'
Expand All @@ -354,6 +361,10 @@ def run_check(self, *args, **kwargs):
priority = 1
builder = '%s (should be %s)' % (builder, ''.join(target_status))

# Remove each service with status from filtered_services to find out if we are missing some
i = filtered_services.index(service)
filtered_services.pop(i)

if priority > returncode:
returncode = priority

Expand All @@ -362,10 +373,15 @@ def run_check(self, *args, **kwargs):
if returncode > 0:
returncode = 2

if filtered_services:
for service in filtered_services:
stdout_builder.append({ 'info': '%s could not be found' % service, 'priority': 0 })
returncode = 3

stdout = self.make_stdout(returncode, stdout_builder)
else:
returncode = 3
stdout = "UNKNOWN: No services selected with 'service' value given"
returncode = 3
stdout = "UNKNOWN: No services found for service names: %s" % ', '.join(filtered_services)

# Get the check logging value
try:
Expand Down
2 changes: 1 addition & 1 deletion agent/listener/static/help/active.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../css/ncpa.css" type="text/css" />
<script src='../js/jquery.2.2.4.min.js'></script>
<script src='../js/jquery.3.4.1.min.js'></script>
<script src='../js/bootstrap.min.js'></script>
<script src='../js/help.js'></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion agent/listener/static/help/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../css/ncpa.css" type="text/css" />
<script src='../js/jquery.2.2.4.min.js'></script>
<script src='../js/jquery.3.4.1.min.js'></script>
<script src='../js/bootstrap.min.js'></script>
<script src='../js/help.js'></script>
<script type="text/javascript">
Expand Down
2 changes: 1 addition & 1 deletion agent/listener/static/help/configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../css/ncpa.css" type="text/css" />
<script src='../js/jquery.2.2.4.min.js'></script>
<script src='../js/jquery.3.4.1.min.js'></script>
<script src='../js/bootstrap.min.js'></script>
<script src='../js/help.js'></script>
</head>
Expand Down
10 changes: 5 additions & 5 deletions agent/listener/static/help/graphs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../css/ncpa.css" type="text/css" />
<script src='../js/jquery.2.2.4.min.js'></script>
<script src='../js/jquery.3.4.1.min.js'></script>
<script src='../js/bootstrap.min.js'></script>
<script src='../js/help.js'></script>
</head>
Expand All @@ -28,10 +28,10 @@ <h1>Real-time Graphing</h1>
<h2>Embedding Graphs</h2>
<p>In NCPA 2 you can embed graphs in your own pages. In order to do so, you'll need to add a few libraries to your page, create a graph URL, and embed it in your HTML.</p>
<h6>Adding the JS and CSS Includes</h6>
<p>You need any version of <b>jQuery</b> and you also need both <code>smoothie.js</code> and <code>d3.v4.min.js</code> to your page. Typically you add these to the head section of your HTML. Be sure to change <em>localhost:5693</em> to your defined NCPA hostname and port. Using the ones provided will ensure up-to-date versions when upgrading.</p>
<pre>&lt;script type=&quot;text/javascript&quot; src=&quot;https://localhost:5693/static/js/jquery.2.2.4.min.js&quot;&gt;&lt;/script&gt;
<p>You need any version of <b>jQuery</b> and you also need both <code>smoothie.js</code> and <code>d3.v5.min.js</code> to your page. Typically you add these to the head section of your HTML. Be sure to change <em>localhost:5693</em> to your defined NCPA hostname and port. Using the ones provided will ensure up-to-date versions when upgrading.</p>
<pre>&lt;script type=&quot;text/javascript&quot; src=&quot;https://localhost:5693/static/js/jquery.3.4.1.min.js&quot;&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https://localhost:5693/static/js/smoothie.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="https://localhost:5693/static/js/d3.v4.min.js"&gt;&lt;/script&gt;</pre>
&lt;script type="text/javascript" src="https://localhost:5693/static/js/d3.v5.min.js"&gt;&lt;/script&gt;</pre>
<p>If you are planning on using the basic styling that we use inside NCPA's GUI, you can also add the CSS included.</p>
<pre>&lt;link type="text/css" href="https://localhost:5693/static/css/ncpa-graph.css" rel="stylesheet"&gt;</pre>
<h6>Creating the Graph Module URL</h6>
Expand All @@ -44,7 +44,7 @@ <h6>Example</h6>
&lt;head&gt;
&lt;title&gt;Embedded Graph&lt;/title&gt;
&lt;link type=&quot;text/css&quot; href=&quot;https://localhost:5693/static/css/ncpa-graph.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://localhost:5693/static/js/jquery.2.2.4.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://localhost:5693/static/js/jquery.3.4.1.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://localhost:5693/static/js/smoothie.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://localhost:5693/static/js/d3.v4.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
Expand Down
2 changes: 1 addition & 1 deletion agent/listener/static/help/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../css/ncpa.css" type="text/css" />
<script src='../js/jquery.2.2.4.min.js'></script>
<script src='../js/jquery.3.4.1.min.js'></script>
<script src='../js/bootstrap.min.js'></script>
<script src='../js/help.js'></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion agent/listener/static/help/other.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../css/ncpa.css" type="text/css" />
<script src='../js/jquery.2.2.4.min.js'></script>
<script src='../js/jquery.3.4.1.min.js'></script>
<script src='../js/bootstrap.min.js'></script>
<script src='../js/help.js'></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion agent/listener/static/help/passive.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="../css/font-awesome.min.css" type="text/css" />
<link rel="stylesheet" href="../css/ncpa.css" type="text/css" />
<script src='../js/jquery.2.2.4.min.js'></script>
<script src='../js/jquery.3.4.1.min.js'></script>
<script src='../js/bootstrap.min.js'></script>
<script src='../js/help.js'></script>
</head>
Expand Down
8 changes: 4 additions & 4 deletions agent/listener/static/js/bootstrap.min.js

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions agent/listener/static/js/d3.v4.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions agent/listener/static/js/d3.v5.min.js

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions agent/listener/static/js/jquery.2.2.4.min.js

This file was deleted.

2 changes: 2 additions & 0 deletions agent/listener/static/js/jquery.3.4.1.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit d118e54

Please sign in to comment.