<s> from django . utils . translation import ugettext as _ <EOL> from freenasUI . freeadmin . hook import HookMetaclass <EOL> from freenasUI . system . alert import alertPlugins , Alert , BaseAlert <EOL> from freenasUI . middleware . notifier import notifier <EOL> class BootVolumeStatusAlert ( BaseAlert ) : <EOL> __metaclass__ = HookMetaclass <EOL> __hook_reverse_order__ = False <EOL> name = '<STR_LIT>' <EOL> def on_volume_status_not_healthy ( self , state , status ) : <EOL> return Alert ( <EOL> Alert . CRIT , <EOL> _ ( '<STR_LIT>' ) % { <EOL> '<STR_LIT:state>' : state , <EOL> '<STR_LIT:status>' : status , <EOL> } <EOL> ) <EOL> def run ( self ) : <EOL> alerts = [ ] <EOL> state , status = notifier ( ) . zpool_status ( '<STR_LIT>' ) <EOL> if state == '<STR_LIT>' : <EOL> pass <EOL> else : <EOL> alerts . append ( <EOL> self . on_volume_status_not_healthy ( state , status ) <EOL> ) <EOL> return alerts <EOL> alertPlugins . register ( BootVolumeStatusAlert ) </s>
