PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` 3 peS0$@sddlmZy ddlZWnddljZYnXddlZddlZddlZddlZddlZddl Z ddl Z y ddl Z Wnddl j Z YnXy ddlZWn:ek ry ddlZWnek rdZYnXYnXy ddlZWndZYnXddlmZmZmZGdddeZdS))datetimeN)get_fqdnget_server_nameget_platform_uuidsc@speZdZdZdddZidfddZdd Zd id ifd d Zdd dZdddZ dddZ ddZ ddZ dS)Clientzy This is a client used for communicating with an aggregator, either *the* Aggregator or an Onsight instance. NcCs2tj|jj|_||_||_||_||_d|_ dS)N) logging getLogger __class____name__log customer_key server_keyagg_urlversion call_timeout)selfrrrr r'/usr/lib/fm-agent/library/aggregator.py__init__*s zClient.__init__POSTcCs2dd|jjdD}tj|d}x|D]}yTtj|}|ddksV|ddkrdtjd|}|dd'ks||ddkrtd Wntk rtd YnX|d}d |kr|jd \}} t| pd } n|}d } d|kr|d|jd}|j j d||| d} d|j |f} |dkrb|j |d<d|d<t j tjj|d<|j jd|tj|} dd|jppdd} | d(krdtjkrtj|| tjd} nz|j jtjtrttdr|j jdttdtj|| |jtjd} n,tjd)krtj|| |jd!} n tj|| } n8tjd*krJdtjkrJtj|| |jd!} n tj|| } y|j jd"|| | | f| j|| | | | j }|dkrt|j!d#krt|j"n$|dkrt|j!d$krt|j"tj#|j$j%d%Stk r tj&d}t'|}|j j(d&|w,Yq,Xq,Wt|dS)+NcSsg|]}|jr|jqSr)strip).0urlrrr 3szClient.call..,rzhttp://httphttpszInvalid aggregator URLzInvalid aggregator URL format.:z/vzaggregator call %r to %r:%dz/v%s/%srZ agent_versionZv3Zmetadata_versionZ agent_timezData: %rzapplication/json)z Content-typeAccept Authorization zhp-ux)context_create_unverified_contextz0ssl has _create_unverified_context attribute: %s)timeoutr%)r'z%s - %s - %s - %szutf-8zUnable to connect: %s)rr)r!r$)r(r)r)r(r)r))rsplitrandomshuffleurlparse Exception ValueErrorintindexr infortimemktimernow timetupledebugjsondumpsrsysplatformhttplibHTTPSConnectionsslr& version_infohasattrrHTTPConnectionrequest getresponsestatusreasonloadsreaddecodeexc_infostrerror)ractiondatamethodZagg_urlsrMrZ url_partsrportparamsuriheaders connectionresperrrrrcall2sz                z Client.callc Cstjtjtjx}|jdd|jjddkrL|jjddjd\}}n |j}d}|jjdj|||j |t |f|j dSQRXdS)Ng@r rrz*get_local_ip: creating connection to {} {}) socketAF_INET SOCK_DGRAM settimeoutrr,r r4formatconnectr2 getsockname)rclienthostrQrrr get_local_ips zClient.get_local_ipFcCslt||||||||||| | | | | |d}|r>t}|r>||d<|r`x|jD]}||||<qLW|jd|S)N)results outage_eventsmetadatacountermeasures_metadatafactsdiscovered_containersdeleted_containersforce_send_schedulescommand_resultsregisterregister_custom_metrics incidentsconfigipsauto_topo_scans dem_enabledfm_server_identifierssync)dictrkeysrX)rrcrdrerfrgrhrirlrmrnrorprqrjrkrrdem_service_resultspayloadplatform_uuidsZdsrrrrts2z Client.syncc CsTd}|jjdy|jdd|idWn|jjdYnX|jjdd}|S) NFz beginning uninstall notification uninstallremove_instance)rOzerror connectingznotified successfullyT)r r4rXrM)rr{successrrrnotify_of_uninstalls  zClient.notify_of_uninstallcCs|jjdt}|j||d}t}|r2||d<|jddjdkrddlm}dd l m }y2|} | j |d <|j dt } | r| |d <Wn |jjd |d+YnXt}|r||d<|j||j|j|||jjd|jjtj|ddd} d} d} d}d}yP|jd|}|jj||d} |d} d|krdd|dkrd|dd}Wn6tk rtjd}|jjd||}YnXd} |jjd| |jdp|jdsd}d} d|kr||jdr|d} |ddkrd}n~|ddkrd}nj|dd kr&d!}nV|dd"kr:d#}nB|dd$krNd%}n.|djd&rtd'|djd(d)}n|d}|jjd*| | | || | | ||fS),NzBeginning handshake)r hostnamerprshandshake_typeZstandard forticlientr)_exit)ForticlientHelperZforticlient_metadata server_namezHandshake errorzHandshaking with aggregator:r)indentF handshaker found_servercommands log_levelzError connecting: %sTz/Connected successfully! Received server key: %rzIError performing handshake with the aggregator, please check connectivityrMZinvalid_credentialszIncorrect username/passwordZinvalid_customer_keyzUnknown/invalid customer keyZinvalid_server_groupzUnknown server groupZinactive_customerzCustomer inactiveZno_user_found_for_customerz%No active user found for the customerZinvalid_template_idzUnknown template id %szinvalid_template_id:rz8Success: %s, server key: %s, found server: %s, error: %s)r r4rr rgetlowerosrZforticlient_helperrZget_handshake_datapopr exceptionupdateparse_attributesr:r;rXr9r0r<rKrM startswithreplace)rrp properties attributesr~rOryrrhelperrrrr|rMrrWrrrrs             zClient.handshakecCs||r |p gd}|jd|S)a Request to the aggregator that it starts a maintenance for our server. It requires the duration of the maintenance in minutes, and accepts an optional list of tags to mark metrics that are going to be affected by it. )duration metric_tags maintenance)rX)rrrrxrrrr)szClient.maintenancecCs |jdS)z Request to the aggregator that it ends all active maintenances for our server. POST call with no parameters. end_maintenance)rX)rrrrr6szClient.end_maintenancecCs d|kr|rd|ipiSiSdS)z Receive a dictionary containing the attributes stored in the manifest file. Parse them accordingly and store them in an attribute dictionary. Attributes get parsed only if the customer key is present in the properties. r rNr)rrrrrrr=szClient.parse_attributes)NN)F)N)N) r __module__ __qualname____doc__rrXrbrtr}rrrrrrrrr$s U   W r)rr> http.clientr`rr-rerYr<r5 tracebackr/ urllib.parseparser: ImportError simplejsonr@ inspectorrrrobjectrrrrrs8