Skip to content
This repository has been archived by the owner on Oct 25, 2019. It is now read-only.

Commit

Permalink
Minor changes for release 0.1.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralph089 committed Apr 29, 2016
1 parent dad0c8c commit 3008cfb
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 18 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
-------
0.1.5 (2016-29-04)
------------------

* Fixed a argparse bug

0.1.4 (2016-29-04)
------------------

Expand Down
15 changes: 9 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It is written in Python and based on the PA REST API.
Tested on:

- PA-500 v6.0.1 - v6.0.9
- PA-3050 v6.0.9 - 6.0.12
- PA-3050 v6.0.9 - 7.0.0

.. image:: https://travis-ci.org/ralph-hm/nagios_check_paloalto.svg?branch=master
:target: https://travis-ci.org/ralph-hm/nagios_check_paloalto?branch=master
Expand Down Expand Up @@ -38,17 +38,18 @@ Usage
-----
Command-line usage::

usage: check_paloalto [-h] [-H HOST] [-T TOKEN] [-v]
{diskspace,certificates,load,environmental,sessinfo,thermal,throughput}
...
usage: check_paloalto [-h] [-H HOST] [-T TOKEN] [-v] [-t TIMEOUT]
{diskspace,certificates,load,useragent,environmental,sessinfo,thermal,throughput}
...

positional arguments:
{diskspace,certificates,load,environmental,sessinfo,thermal,throughput}
{diskspace,certificates,load,useragent,environmental,sessinfo,thermal,throughput}
diskspace Checks used diskspace.
certificates Checks the certificate store for expiring
certificates: Outputs is a warning, if a certificate
is in range.
load Checks the CPU load.
useragent Checks for running useragents.
environmental Checks if an alarm is found.
sessinfo Checks important session parameters.
thermal Checks the temperature.
Expand All @@ -64,5 +65,7 @@ Command-line usage::

Debug:
-v, --verbose increase output verbosity (use up to 3 times)

-t TIMEOUT, --timeout TIMEOUT
abort check execution after so many seconds (use 0 for
no timeout)

2 changes: 1 addition & 1 deletion check_pa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__author__ = 'Ralph Offinger'
__email__ = 'ralph.offinger@gmail.com'
__version__ = '0.1.3'
__version__ = '0.1.5'
27 changes: 18 additions & 9 deletions check_pa/check_paloalto.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,9 @@

@nagiosplugin.guarded
def main(): # pragma: no cover
if sys.argv[1] == "reset_throughput":
if throughput.reset():
print('Success')
exit()
else:
args = parse_args(sys.argv[1:])
check = args.func(args)
check.main(verbose=args.verbose, timeout=args.timeout)
args = parse_args(sys.argv[1:])
check = args.func(args)
check.main(verbose=args.verbose, timeout=args.timeout)


def _diskspace(args):
Expand Down Expand Up @@ -50,7 +45,12 @@ def _thermal(args):


def _throughput(args):
return throughput.create_check(args)
if args.reset:
if throughput.reset():
print("Success!")
exit()
else:
return throughput.create_check(args)


def _useragent(args):
Expand Down Expand Up @@ -149,6 +149,14 @@ def parse_args(args):
parser_sessinfo = subparsers.add_parser(
'sessinfo',
help='Checks important session parameters.')
parser_sessinfo.add_argument(
'-w', '--warn',
metavar='WARN', type=int, default=20000,
help='Warning if number of sessions is greater. (default: %(default)s)')
parser_sessinfo.add_argument(
'-c', '--crit',
metavar='CRIT', type=int, default=50000,
help='Critical if number of sessions is greater. (default: %(default)s)')
parser_sessinfo.set_defaults(func=_sessinfo)

# Sub-Parser for command 'thermal'.
Expand Down Expand Up @@ -176,6 +184,7 @@ def parse_args(args):
nargs='?',
required=True,
)
parser_throughput.add_argument('--reset', action='store_true')
parser_throughput.set_defaults(func=_throughput)

return parser.parse_args(args)
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ counter.

You can solve this error by executing the following command::

$ check_paloalto reset_throughput
$ check_paloalto -H IP -T TOKEN throughput -i 'any' --reset
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
]

setup(name='check_paloalto',
version='0.1.3',
version='0.1.5',
description="check_paloalto is a Nagios/Icinga plugin for Palo Alto Next Generation Firewalls. It is written in Python and based on the PA REST API.",
long_description=readme + '\n\n' + history,
author="Ralph Offinger",
Expand Down
1 change: 1 addition & 0 deletions tests/test_check_paloalto.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def setup_class(cls):
cls.exclude = ''
cls.range = '0:20'
cls.interface = 'test'
cls.reset = False

def test_arg_diskspace(self):
args = parse_args(['-H', self.host, '-T', self.token, 'diskspace'])
Expand Down

0 comments on commit 3008cfb

Please sign in to comment.