-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ openmediavault-zfs (3.0.6) stable; urgency=low | |
* Fix snapshot creating | ||
* Add snapshot rollback | ||
* Add force pool import option | ||
* Add zfs zed notification | ||
|
||
-- OpenMediaVault Plugin Developers <[email protected]> Sat, 19 Nov 2016 23:15:41 +0900 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
/** | ||
* @license http://www.gnu.org/licenses/gpl.html GPL Version 3 | ||
* @author Volker Theile <[email protected]> | ||
* @author OpenMediaVault Plugin Developers <[email protected]> | ||
* @copyright Copyright (c) 2009-2015 Volker Theile | ||
* @copyright Copyright (c) 2015-2016 OpenMediaVault Plugin Developers | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
class OMVZFS extends \OMV\Engine\Module\ServiceAbstract | ||
implements \OMV\Engine\Notify\IListener, \OMV\Engine\Module\INotification { | ||
/** | ||
* Get the module name. | ||
*/ | ||
public function getName() { | ||
return "ZFS-ZED"; | ||
} | ||
/** | ||
* Defines the modules that if present should start before the service | ||
* provided by this module. | ||
* @return An array of modules. | ||
*/ | ||
public function shouldStart() { return [ "email" ]; } | ||
/** | ||
* Generate the configuration. | ||
* @throw E_EXEC_FAILED | ||
*/ | ||
public function applyConfig() { | ||
$cmd = new \OMV\System\Process("omv-mkconf", "zed"); | ||
$cmd->setRedirect2to1(); | ||
$cmd->execute(); | ||
} | ||
/** | ||
* Get the notification configuration. | ||
*/ | ||
public function getNotificationConfig() { | ||
return [ | ||
[ | ||
"id" => "zfs", | ||
"type" => getText("Storage"), | ||
"title" => gettext("ZFS ZED") | ||
] | ||
]; | ||
} | ||
/** | ||
* Bind listeners. | ||
*/ | ||
function bindListeners(\OMV\Engine\Notify\Dispatcher $dispatcher) { | ||
$dispatcher->addListener( | ||
OMV_NOTIFY_MODIFY, | ||
"org.openmediavault.conf.system.notification.email", | ||
[ $this, "setDirty" ]); | ||
$dispatcher->addListener( | ||
OMV_NOTIFY_MODIFY, | ||
"org.openmediavault.conf.system.notification.notification", | ||
[ $this, "setDirty" ]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
# | ||
# @license http://www.gnu.org/licenses/gpl.html GPL Version 3 | ||
# @author Volker Theile <[email protected]> | ||
# @author OpenMediaVault Plugin Developers <[email protected]> | ||
# @copyright Copyright (c) 2009-2013 Volker Theile | ||
# @copyright Copyright (c) 2013-2015 OpenMediaVault Plugin Developers | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
set -e | ||
|
||
. /etc/default/openmediavault | ||
. /usr/share/openmediavault/scripts/helper-functions | ||
|
||
OMV_ZED_CONFIG=${OMV_ZED_CONFIG:-"/etc/zfs/zed.d/zed.rc"} | ||
OMV_ZED_NOTIFY_INTERVAL_SECS=3600 | ||
|
||
xmlstarlet sel -t -m "//system/email" \ | ||
-i "enable[. = '1'] and //system/notification/notifications/notification[id='zfs'][enable = '1']" \ | ||
-v "concat('ZED_EMAIL_ADDR=',primaryemail)" -n \ | ||
-o "ZED_NOTIFY_INTERVAL_SECS=${OMV_ZED_NOTIFY_INTERVAL_SECS}" \ | ||
-b \ | ||
${OMV_CONFIG_FILE} | xmlstarlet unesc > ${OMV_ZED_CONFIG} |