Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/f5/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyc

�
�Udac@`sSddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZytdd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
ridd
lmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZ d e!fd!��YZ"d"e!fd#��YZ#d$e!fd%��YZ$d&�Z%e&d'krOe%�nd(S()i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bysV
---
module: bigip_monitor_snmp_dca
short_description: Manages BIG-IP SNMP data collecting agent (DCA) monitors
description:
  - The BIG-IP has an SNMP data collecting agent (DCA) that can query remote
    SNMP agents of various types, including the UC Davis agent (UCD) and the
    Windows 2000 Server agent (WIN2000).
version_added: 2.5
options:
  name:
    description:
      - Monitor name.
    type: str
    required: True
  description:
    description:
      - Specifies descriptive text that identifies the monitor.
    type: str
  parent:
    description:
      - The parent template of this monitor template. Once this value has
        been set, it cannot be changed. By default, this value is the C(snmp_dca)
        parent on the C(Common) partition.
    type: str
    default: "/Common/snmp_dca"
  interval:
    description:
      - Specifies, in seconds, the frequency at which the system issues the
        monitor check when either the resource is down or the status of the
        resource is unknown. When creating a new monitor, the default is C(10).
    type: int
  timeout:
    description:
      - Specifies the number of seconds the target has in which to respond to
        the monitor request. When creating a new monitor, the default is C(30)
        seconds. If the target responds within the set time period, it is
        considered 'up'. If the target does not respond within the set time
        period, it is considered 'down'. When this value is set to 0 (zero),
        the system uses the interval from the parent monitor. Note that
        C(timeout) and C(time_until_up) combine to control when a resource is
        set to up.
    type: int
  time_until_up:
    description:
      - Specifies the number of seconds to wait after a resource first responds
        correctly to the monitor before setting the resource to 'up'. During the
        interval, all responses from the resource must be correct. When the
        interval expires, the resource is marked 'up'. A value of 0, means
        that the resource is marked up immediately upon receipt of the first
        correct response. When creating a new monitor, the default is C(0).
    type: int
  community:
    description:
      - Specifies the community name that the system must use to authenticate
        with the host server through SNMP. When creating a new monitor, the
        default value is C(public). Note that this value is case sensitive.
    type: str
  version:
    description:
      - Specifies the version of SNMP that the host server uses. When creating
        a new monitor, the default is C(v1). When C(v1), specifies that the
        host server uses SNMP version 1. When C(v2c), specifies that the host
        server uses SNMP version 2c.
    type: str
    choices:
      - v1
      - v2c
  agent_type:
    description:
      - Specifies the SNMP agent running on the monitored server. When creating
        a new monitor, the default is C(UCD) (UC-Davis).
    type: str
    choices:
      - UCD
      - WIN2000
      - GENERIC
  cpu_coefficient:
    description:
      - Specifies the coefficient that the system uses to calculate the weight
        of the CPU threshold in the dynamic ratio load balancing algorithm.
        When creating a new monitor, the default is C(1.5).
    type: str
  cpu_threshold:
    description:
      - Specifies the maximum acceptable CPU usage on the target server. When
        creating a new monitor, the default is C(80) percent.
    type: int
  memory_coefficient:
    description:
      - Specifies the coefficient that the system uses to calculate the weight
        of the memory threshold in the dynamic ratio load balancing algorithm.
        When creating a new monitor, the default is C(1.0).
    type: str
  memory_threshold:
    description:
      - Specifies the maximum acceptable memory usage on the target server.
        When creating a new monitor, the default is C(70) percent.
    type: int
  disk_coefficient:
    description:
      - Specifies the coefficient that the system uses to calculate the weight
        of the disk threshold in the dynamic ratio load balancing algorithm.
        When creating a new monitor, the default is C(2.0).
    type: str
  disk_threshold:
    description:
      - Specifies the maximum acceptable disk usage on the target server. When
        creating a new monitor, the default is C(90) percent.
    type: int
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  state:
    description:
      - When C(present), ensures that the monitor exists.
      - When C(absent), ensures the monitor is removed.
    type: str
    choices:
      - present
      - absent
    default: present
    version_added: 2.5
notes:
  - Requires BIG-IP software version >= 12
  - This module does not support the C(variables) option because this option
    is broken in the REST API and does not function correctly in C(tmsh); for
    example you cannot remove user-defined params. Therefore, there is no way
    to automatically configure it.
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s�
- name: Create SNMP DCS monitor
  bigip_monitor_snmp_dca:
    name: my_monitor
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Remove TCP Echo Monitor
  bigip_monitor_snmp_dca:
    name: my_monitor
    state: absent
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
sV
parent:
  description: New parent template of the monitor.
  returned: changed
  type: str
  sample: snmp_dca
description:
  description: The description of the monitor.
  returned: changed
  type: str
  sample: Important Monitor
interval:
  description: The new interval in which to run the monitor check.
  returned: changed
  type: int
  sample: 2
timeout:
  description: The new timeout in which the remote system must respond to the monitor.
  returned: changed
  type: int
  sample: 10
time_until_up:
  description: The new time in which to mark a system as up after first successful response.
  returned: changed
  type: int
  sample: 2
community:
  description: The new community for the monitor.
  returned: changed
  type: str
  sample: foobar
version:
  description: The new new SNMP version to be used by the monitor.
  returned: changed
  type: str
  sample: v2c
agent_type:
  description: The new agent type to be used by the monitor.
  returned: changed
  type: str
  sample: UCD
cpu_coefficient:
  description: The new CPU coefficient.
  returned: changed
  type: float
  sample: 2.4
cpu_threshold:
  description: The new CPU threshold.
  returned: changed
  type: int
  sample: 85
memory_coefficient:
  description: The new memory coefficient.
  returned: changed
  type: float
  sample: 6.4
memory_threshold:
  description: The new memory threshold.
  returned: changed
  type: int
  sample: 50
disk_coefficient:
  description: The new disk coefficient.
  returned: changed
  type: float
  sample: 10.2
disk_threshold:
  description: The new disk threshold.
  returned: changed
  type: int
  sample: 34
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(tf5_argument_spec(ttransform_name(tcmp_str_with_nonet
ParameterscB`s�eZi	dd6dd6dd6dd6dd	6d
d6dd
6dd6dd6Zdddddddddd	dd
dddgZdddddddddddd
dddgZddddddddddd
dddgZed��Zed��Zed��Z	ed��Z
ed��Zed��Zed��Z
ed ��Zed!��Zed"��Zd#�Zed$��ZRS(%t
time_until_upttimeUntilUptparenttdefaultsFromt
agent_typet	agentTypetcpu_coefficienttcpuCoefficientt
cpu_thresholdtcpuThresholdtmemory_coefficienttmemoryCoefficienttmemory_thresholdtmemoryThresholdtdisk_coefficienttdiskCoefficienttdisk_thresholdt
diskThresholdtintervalttimeouttdestinationt	communitytversiontdescriptiontipcC`s`|jddkrdSdt|jd�ko;dknrOtd��nt|jd�S(NR$ii�Qs*Interval value must be between 1 and 86400(t_valuestNonetintR(tself((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR$Ns)cC`s(|jddkrdSt|jd�S(NR%(R+R,R-(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR%XscC`s(|jddkrdSt|jd�S(NR(R+R,R-(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR^scC`s4|jddkrdSt|j|jd�}|S(NR(R+R,R
t	partition(R.tresult((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRdscC`s|jd�}|S(NR(t_get_numeric_property(R.R0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRkscC`s|jd�}|S(NR(R1(R.R0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRpscC`s|jd�}|S(NR(R1(R.R0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRuscC`s|jd�}|S(NR(R1(R.R0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRzscC`s|jd�}|S(NR (R1(R.R0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR scC`s|jd�}|S(NR"(R1(R.R0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR"�scC`s[|j|dkrdSyt|j|�}Wn&tk
rVtdj|���nX|S(Ns#Provided {0} must be a valid number(R+R,tfloatt
ValueErrorRtformat(R.tpropertytfvar((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR1�s
cC`sdS(Ntsnmp_dca((R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyttype�s(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatablesR5R$R%RRRRRRR R"R1R8(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRs�
			
	t
ApiParameterscB`seZed��ZRS(cC`s"|jddkrdS|jdS(NR)tnone(NR@(R+R,(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR)�s(R9R:R5R)(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR?�stModuleParameterscB`seZed��ZRS(cC`s9|jddkrdS|jddkr.dS|jdS(NR)R@t(snoneRB(R+R,(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR)�s
(R9R:R5R)(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRA�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R=tgetattrt_filter_paramst	Exception(R.R0t
returnable((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyt	to_return�s
(R9R:RH(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRC�st
UsableChangescB`seZRS((R9R:(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRI�stReportableChangescB`seZRS((R9R:(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRJ�st
DifferencecB`sSeZdd�Zd�Zed��Zed��Zd�Zed��Z	RS(cC`s||_||_dS(N(twantthave(R.RLRM((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyt__init__�s	cC`s?yt||�}|SWn!tk
r:|j|�}|SXdS(N(RDtAttributeErrort_Difference__default(R.tparamR0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pytcompare�s
cC`s+|jj|jjkr'td��ndS(Ns$The parent monitor cannot be changed(RLRRMR(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR�scC`s�|jjdk	rN|jjdk	rN|jj|jjkr�td��q�nx|jjdk	r�|jj|jjkr�td��q�n<|jjdk	r�|jj|jjkr�td��q�n|jj|jjkr�|jjSdS(Ns1Parameter 'interval' must be less than 'timeout'.(RLR%R,R$RRM(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR$�s$cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RDRLRMRO(R.RQtattr1tattr2((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyt	__default�s
cC`st|jj|jj�S(N(RRLR)RM(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR)�sN(
R9R:R,RNRRR5RR$RPR)(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRK�s			t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�ZRS(cO`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR,RWR
RXtclientRARLR?RMRItchanges(R.targstkwargs((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRN�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRX(RR=RDRLR,RIR[(R.tchangedtkey((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyt_set_changed_options�scC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRX(RKRLRMRR>tdictRRR,t
isinstancetupdateRIR[tTruetFalse(R.tdiffR>R^tktchange((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyt_update_changed_optionss		
cC`s|j�}|rtStS(N(RiRdRe(R.R0((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyt
should_updatescC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRXR^(ReRaRLtstateRkRlRJR[RHRct_announce_deprecations(R.R^R0Rmt
reportableR[((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pytexec_modules	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgR((tpopRZRWt	deprecate(R.R0twarningstwarning((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRn.s


cC`s$|j�r|j�S|j�SdS(N(texistsRctcreate(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRk6s
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns0https://{0}:{1}/mgmt/tm/ltm/monitor/snmp-dca/{2}tservertserver_porti�tcode(R4RZtproviderRRLR/tnametapiRYtjsonR3ReRRd(R.turitresptresponse((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRw<s


+cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRMRjReRWt
check_modeRdtupdate_on_device(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRcKs
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RWR�Rdtremove_from_deviceRwR(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pytremoveTs
cC`s2|j�|j�|jjr$tS|j�tS(N(R`t_set_default_creation_valuesRWR�Rdtcreate_on_device(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRx\s


cC`s|jjdkr,|jjidd6�n|jjdkrX|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjid	d
6�n|jjdkr|jjidd6�n|jj	dkr4|jjid
d6�n|jj
dkr`|jjidd6�n|jjdkr�|jjidd6�n|jjdkr�|jjidd6�n|jj
dkr�|jjidd6�n|jjdkr|jjidd6�ndS(NiR%i
R$iRtpublicR'tv1R(tUCDRs1.5Rt80Rs1.0Rt70Rs2.0R t90R"(RLR%R,RcR$RR'R(RRRRRR R"(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR�ds0cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��ndS(NR}R/s-https://{0}:{1}/mgmt/tm/ltm/monitor/snmp-dca/RyRzRR{i�i�tmessage(i�i�(R[t
api_paramsRLR}R/R4RZR|R~tpostRR3Rtstrtcontent(R.RXR�R�R�tex((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR�~s
cC`s�|jj�}dj|jjd|jjdt|jj|jj��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��ndS(Ns0https://{0}:{1}/mgmt/tm/ltm/monitor/snmp-dca/{2}RyRzRR{i�R�(R[R�R4RZR|RRLR/R}R~tpatchRR3RR�R�(R.RXR�R�R�R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR��s

cC`s|j�r|j�StS(N(RwR�Re(R.((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRl�s
cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns0https://{0}:{1}/mgmt/tm/ltm/monitor/snmp-dca/{2}RyRzi�(R4RZR|RRLR/R}R~tdeleteRRd(R.R�R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR��s

cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ntd|�S(Ns0https://{0}:{1}/mgmt/tm/ltm/monitor/snmp-dca/{2}RyRzR{i�R�RX(R4RZR|RRLR/R}R~RYRR3RR�R�R?(R.R�R�R�R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR��s

(R9R:RNR`RiRjRpRnRkRwRcR�RxR�R�R�RlR�R�(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRV�s"																	
tArgumentSpeccB`seZd�ZRS(c(C`sJt|_tdtdt�dt�dtdd�dtdd	�d
tdd	�dtdd	�dt�d
tdddg�dtddddg�dt�dtdd	�dt�dtdd	�dt�dtdd	�dtdddddg�dtddd td!gf��}i|_|jjt�|jj|�dS("NR}trequiredR)Rtdefaults/Common/snmp_dcaR$R8R-R%RR'R(tchoicesR�tv2cRR�tWIN2000tGENERICRRRRR R"RmRkRlR/tCommontfallbacktF5_PARTITION(Rdtsupports_check_modeRaR	t
argument_specRcR(R.R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyRN�s6							(R9R:RN(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RWRr(
R�RR�R�RVRpt	exit_jsonRt	fail_jsonR�(tspecRWtmmtresultsR�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pytmain�s		t__main__N('t
__future__RRRR8t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRt'library.module_utils.network.f5.compareRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont'ansible.module_utils.network.f5.compareRR?RARCRIRJtobjectRKRVR�R�R9(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_monitor_snmp_dca.pyt<module>sJ


�I
�
6�#	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]