Arguments types

This module contains a set of functions to convert or specify argument types.

monitoring.nagios.plugin.argument.days(integer)

Convert integer to a timedelta object. integer is a number of days.

Parameters:integer (str, unicode) – the number of days.
Returns:the number of days as a timedelta object.
Return type:timedelta

Example:

>>> days(5)
datetime.timedelta(5)
monitoring.nagios.plugin.argument.hours(integer)

Convert integer to a timedelta object.

Argument integer is a number of hours.

Parameters:integer (str, unicode) – the number of hours.
Returns:the number of hours as a timedelta object.
Return type:timedelta

Example:

>>> hours(4)
datetime.timedelta(0, 14400)
monitoring.nagios.plugin.argument.http_basic_auth(auth_string)

Convert a HTTP Basic Authentication string to a tuple.

Parameters:auth_string (str, unicode) – the basic auth string of the form login:passwd.
Returns:Basic auth as a tuple (login, passwd).
Return type:tuple

Example:

>>> http_basic_auth("besancon:8jj_767hhgy")
('besancon', '8jj_767hhgy')
monitoring.nagios.plugin.argument.minutes(integer)

Convert integer to a timedelta object. integer is a number of minutes.

Parameters:integer (str, unicode) – the number of minutes.
Returns:the number of minutes as a timedelta object.
Return type:timedelta

Example:

>>> minutes(32)
datetime.timedelta(0, 1920)
monitoring.nagios.plugin.argument.seconds(integer)

Convert integer to a timedelta object. integer is a number of seconds.

Parameters:integer (str, unicode) – the number of seconds.
Returns:the number of seconds as a timedelta object.
Return type:timedelta

Example:

>>> seconds(54)
datetime.timedelta(0, 54)