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 pe@sddlmZddlmZddlmZddlZddlZddlZddlZy ddl Z Wn:e k ry ddl Z Wne k rdZ YnXYnXGddde Z dS))Anomaly)datetime) ThresholdNc@sPeZdZddZddZddZeddZd d Zd d Z d dZ ddZ dS)SchedulecCs:tj|jj|_|j|d|_tj|_ d|_ i|_ dS)Nr) logging getLogger __class____name__logupdatelast_check_valuernownext_check_timenumber_of_checkscached_results)self schedule_datar%/usr/lib/fm-agent/library/schedule.py__init__s   zSchedule.__init__cCst|j}|d=|S)Nr )dict__dict__)rstaterrr __getstate__&s zSchedule.__getstate__cCs |jj|tj|jj|_dS)N)rr rrrr r )rrrrr __setstate__+s zSchedule.__setstate__c Cs&ddddddddddgd}||S) Nnull<rgt)iddelayoperatorvalue)r plugin_textkeyresource_textkeyoption frequency thresholdsr)clsdatarrrcreate_test_schedule/szSchedule.create_test_schedulec Cs|d|_|d|_|d|_t|dtkr:|d|_ntj|dpHd|_|d|_g|_ |j dd|_ xL|dD]@}y|j j t f|Wqv|jjd |tjfYqvXqvWdS) Nr r$r%r&rr' server_keyr(zError storing threshold %s: %s)r r$r%typerr&jsonloadsr'r(getr,appendrr critical traceback format_exc)rrZthreshold_datarrrr As     zSchedule.updatecCsd|j|j|j|jfS)Nz)r r$r%r)rrrr__repr__RszSchedule.__repr__cCsf|j|}||_|jd7_|dk r>|jjd|j|j|n|jjd|j|j|j||||fS)NrzSchedule %s, check #%d: %dz"Schedule %s, check #%d: )checkr rr debugr detect_anomalies)rplugin_manager anomaliesr#rrrr6Xs  zSchedule.checkcCs|dkr dSx|jD]}|jjd|j|jf|j|r|jjd|j|jf|j|kr||j|j}tj|_|j |_ nt |j |j }|j |j|iq|j|kr||jj r|jjd|j|jf||j=qWdS)Nz/Schedule %s checking value against threshold %sz2Schedule %s threshold %s - Value exceeds thresholdzKSchedule %s threshold %s - Value within threshold, removing pending anomaly)r(r infor Zlimit_exceededr0rr time_last_detectedrZschedules_number_of_checksrZdurationr reported_as_exceeded_duration)rr#r: thresholdanomalyrrrr8es      zSchedule.detect_anomaliesN) r __module__ __qualname__rrr classmethodr+r r5r6r8rrrrrs  r)r?rrr>rrr3systimer. ImportError simplejsonobjectrrrrrs