├── .art ├── adminer_database.png ├── adminer_front_page.png ├── ceph.png ├── devices.png ├── front_page.png ├── logo.png ├── webmin_admin_tklbam.png └── webmin_dashboard.png ├── .gitignore ├── Makefile ├── README.rst ├── changelog ├── conf.d ├── downloads └── main ├── overlay ├── etc │ ├── apache2 │ │ └── sites-available │ │ │ └── observium.conf │ └── cron.d │ │ └── observium └── usr │ ├── lib │ └── inithooks │ │ ├── bin │ │ └── observium.py │ │ └── firstboot.d │ │ ├── 20regen-observium-secrets │ │ └── 40observium │ └── local │ └── bin │ ├── turnkey-get-observium-ver │ └── turnkey-update-observium └── plan └── main /.art/adminer_database.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/adminer_database.png -------------------------------------------------------------------------------- /.art/adminer_front_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/adminer_front_page.png -------------------------------------------------------------------------------- /.art/ceph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/ceph.png -------------------------------------------------------------------------------- /.art/devices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/devices.png -------------------------------------------------------------------------------- /.art/front_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/front_page.png -------------------------------------------------------------------------------- /.art/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/logo.png -------------------------------------------------------------------------------- /.art/webmin_admin_tklbam.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/webmin_admin_tklbam.png -------------------------------------------------------------------------------- /.art/webmin_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/turnkeylinux-apps/observium/082a510b215902e4ad2b70dae16bc60570a051ca/.art/webmin_dashboard.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # files at the root level to NOT track 2 | build 3 | iso 4 | *.pyc 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | COMMON_CONF = apache-credit 2 | 3 | include $(FAB_PATH)/common/mk/turnkey/lamp.mk 4 | include $(FAB_PATH)/common/mk/turnkey.mk 5 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | Observium - Network Management and Monitoring 2 | ============================================= 3 | 4 | `Observium`_ is an autodiscovering SNMP based network monitoring 5 | platform written in PHP which includes support for a wide range of 6 | network hardware and operating systems including Cisco, Windows, Linux, 7 | HP, Dell, FreeBSD, Juniper, Brocade, Netscaler, NetApp and many more. 8 | 9 | This appliance includes all the standard features in `TurnKey Core`_, 10 | and on top of that: 11 | 12 | - Observium configurations: 13 | 14 | - Installed from upstream source code to /opt/observium. 15 | - Includes all recommended packages including libvirt for virtual 16 | machine monitoring. 17 | - Includes recommended cronjob for discovery and polling. 18 | 19 | **Security note**: Updates to Observium may require supervision so 20 | they **ARE NOT** configured to install automatically. See `Observium 21 | documentation`_ for upgrading. 22 | 23 | - SSL support out of the box. 24 | - `Adminer`_ administration frontend for MySQL (listening on port 25 | 12322 - uses SSL). 26 | - Postfix MTA (bound to localhost) to allow sending of email (e.g., 27 | password recovery). 28 | - All secrets will be regenerated during installation / firstboot 29 | (security). 30 | - Webmin modules for configuring Apache2, PHP, MySQL and Postfix. 31 | 32 | Note: Due to security concerns, adding devices from the webUI is NOT enabled. 33 | Please add new devices manually via the CLI. Alternatively, if you are 34 | not concerned with the potential security risk, adding devices from the 35 | webUI may be enabled - please see `#488(comment)`_. 36 | 37 | Credentials *(passwords set at first boot)* 38 | ------------------------------------------- 39 | 40 | - Webmin, SSH, MySQL: username **root** 41 | - Adminer: username **adminer** 42 | - Observium: username **admin** 43 | 44 | 45 | .. _Observium: https://www.observium.org 46 | .. _TurnKey Core: https://www.turnkeylinux.org/core 47 | .. _Observium documentation: http://docs.observium.org/updating/ 48 | .. _Adminer: https://www.adminer.org/ 49 | .. _#488(comment): https://github.com/turnkeylinux/tracker/issues/488#issuecomment-153762770 50 | -------------------------------------------------------------------------------- /changelog: -------------------------------------------------------------------------------- 1 | turnkey-observium-18.0 (1) turnkey; urgency=low 2 | 3 | * Install latest Observium CE release - 23.09.13005. 4 | [Anton Pyrogovskyi ] 5 | 6 | * Confconsole: bugfix broken DNS-01 Let's Encrypt challenge- closes #1876 & 7 | #1895. 8 | [Jeremy Davis ] 9 | 10 | * Ensure hashfile includes URL to public key - closes #1864. 11 | 12 | * Include webmin-logviewer module by default - closes #1866. 13 | 14 | * Upgraded base distribution to Debian 12.x/Bookworm. 15 | 16 | * Configuration console (confconsole): 17 | - Support for DNS-01 Let's Encrypt challenges. 18 | [ Oleh Dmytrychenko github: @NitrogenUA ] 19 | - Support for getting Let's Encrypt cert via IPv6 - closes #1785. 20 | - Refactor network interface code to ensure that it works as expected and 21 | supports more possible network config (e.g. hotplug interfaces & wifi). 22 | - Show error message rather than stacktrace when window resized to 23 | incompatable resolution - closes #1609. 24 | [ Stefan Davis ] 25 | - Bugfix exception when quitting configuration of mail relay. 26 | [ Oleh Dmytrychenko github: @NitrogenUA ] 27 | - Improve code quality: implement typing, fstrings and make (mostly) PEP8 28 | compliant. 29 | [Stefan Davis & Jeremy Davis 30 | 31 | * Firstboot Initialization (inithooks): 32 | - Refactor start up (now hooks into getty process, rather than having it's 33 | own service). 34 | [ Stefan Davis ] 35 | - Refactor firstboot.d/01ipconfig (and 09hostname) to ensure that hostname 36 | is included in dhcp info when set via inithooks. 37 | - Package turnkey-make-ssl-cert script (from common overlay - now packaged 38 | as turnkey-ssl). Refactor relevant scripts to leverage turnkey-ssl. 39 | - Refactor run script - use bashisms and general tidying. 40 | - Show blacklisted password characters more nicely. 41 | - Misc packaging changes/improvements. 42 | - Support returning output from MySQL - i.e. support 'SELECT'. (Only 43 | applies to apps that include MySQL/MariaDB). 44 | 45 | * Web management console (webmin): 46 | - Upgraded webmin to v2.105. 47 | - Replace webmin-shell with webmin-xterm module by default - closes #1904. 48 | - Removed stunnel reverse proxy (Webmin hosted directly now). 49 | - Ensure that Webmin uses HTTPS with default cert 50 | (/etc/ssl/private/cert.pem). 51 | - Disabled Webmin Let's Encrypt (for now). 52 | 53 | * Web shell (shellinabox): 54 | - Completely removed in v18.0 (Webmin now has a proper interactive shell). 55 | - Note: previous v18.0 releases did not include webmin-xterm pkg - see 56 | above webmin note &/or #1904. 57 | 58 | * Backup (tklbam): 59 | - Ported dependencies to Debian Bookworm; otherwise unchanged. 60 | 61 | * Security hardening & improvements: 62 | - Generate and use new TurnKey Bookworm keys. 63 | - Automate (and require) default pinning for packages from Debian 64 | backports. Also support non-free backports. 65 | 66 | * IPv6 support: 67 | - Adminer (only on LAMP based apps) listen on IPv6. 68 | - Nginx/NodeJS (NodeJS based apps only) listen on IPv6. 69 | 70 | * Misc bugfixes & feature implementations: 71 | - Remove rsyslog package (systemd journal now all that's needed). 72 | - Include zstd compression support. 73 | - Enable new non-free-firmware apt repo by default. 74 | - Improve turnkey-artisan so that it works reliably in cron jobs (only 75 | Laravel based LAMP apps). 76 | 77 | * Set mod_evasive log location - makes debugging easier. 78 | [ Jeremy Davis ] 79 | 80 | * Include and enable mod_evasive and mod_security2 by default in Apache. 81 | [ Stefan Davis ] 82 | 83 | * Includes new 'tkl-upgrade-php' helper script - to allow easy update/change 84 | of PHP version - closes #1892. 85 | [Marcos Méndez @ POPSOLUTIONS ] 86 | 87 | * Debian default PHP updated to v8.2. 88 | 89 | * Include new 'tkl-update-php' script - to make updating/changing PHP 90 | version easier for end users. 91 | [Marcos Méndez @ POPSOLUTIONS ] 92 | 93 | * DEV: Add support for setting max_execution_time & max_input_vars in 94 | php.ini via appliance Makefile (PHP_MAX_EXECUTION_TIME & 95 | PHP_MAX_INPUT_VARS). 96 | 97 | * Use MariaDB (MySQL replacement) v10.11.3 (from debian repos). 98 | 99 | -- Jeremy Davis Wed, 03 Apr 2024 21:49:04 +0000 100 | 101 | turnkey-observium-17.2 (1) turnkey; urgency=low 102 | 103 | * Install latest Observium CE release - 22.12. 104 | 105 | * Update cron job to explicitly call poller-wrapper.py with python3. 106 | Closes #1771 107 | 108 | * Remove MIBs config from /etc/snmp/snmp.conf (not required for Observium). 109 | Closes #1644 110 | 111 | * Add additional dependencies and confirm that graphing is working (either 112 | the issue is fixed, or the original issue was client side). Closes #1798 113 | 114 | * Note: Please refer to turnkey-core's 17.2 changelog for changes common to 115 | all appliances. Here we only describe changes specific to this appliance 116 | 117 | -- Jeremy Davis Sun, 19 Feb 2023 22:53:30 +0000 118 | 119 | turnkey-observium-17.1 (1) turnkey; urgency=low 120 | 121 | * Updated all Debian packages to latest. 122 | [ autopatched by buildtasks ] 123 | 124 | * Patched bugfix release. Closes #1734. 125 | [ autopatched by buildtasks ] 126 | 127 | -- Jeremy Davis Wed, 14 Sep 2022 06:53:58 +0000 128 | 129 | turnkey-observium-17.0 (1) turnkey; urgency=low 130 | 131 | * Install latest Observium CE release - 21.10.1. 132 | 133 | * Note: Please refer to turnkey-core's 17.0 changelog for changes common to 134 | all appliances. Here we only describe changes specific to this appliance 135 | 136 | -- Zhenya Hvorostian Mon, 21 Feb 2022 00:15:34 +0300 137 | 138 | turnkey-observium-16.1 (1) turnkey; urgency=low 139 | 140 | * Install latest Observium CE release - 20.9.0. 141 | 142 | * Fix error finding MIBs modules - closes #1510. 143 | 144 | * Add housekeeping to Observium cron job - closes #1422. 145 | 146 | * Include 'turnkey-update-observium' (and 'turnkey-get-observium-ver') 147 | script(s) to support easy update - closes #750. 148 | 149 | * Note: Please refer to turnkey-core's 16.1 changelog for changes common to 150 | all appliances. Here we only describe changes specific to this appliance 151 | 152 | -- Jeremy Davis Thu, 18 Mar 2021 12:54:10 +1100 153 | 154 | turnkey-observium-16.0 (1) turnkey; urgency=low 155 | 156 | * Install latest Observium CE release - 19.8.1. 157 | 158 | * Explcitly disable TLS<1.2 (i.e. SSLv3, TLSv1, TLSv1.1). (v15.x 159 | TurnKey releases supported TLS 1.2, but could fallback as low as TLSv1). 160 | 161 | * Update SSL/TLS cyphers to provide "Intermediate" browser/client support 162 | (suitable for "General-purpose servers with a variety of clients, 163 | recommended for almost all systems"). As provided by Mozilla via 164 | https://ssl-config.mozilla.org/. 165 | 166 | * Updated all relevant Debian packages to Buster/10 versions; including 167 | PHP 7.3. 168 | 169 | * Updated version of mysqltuner script - now installed as per upstream 170 | recommendation. 171 | 172 | * Note: Please refer to turnkey-core's changelog for changes common to all 173 | appliances. Here we only describe changes specific to this appliance. 174 | 175 | -- Stefan Davis Tue, 12 May 2020 14:50:42 +1000 176 | 177 | turnkey-observium-15.1 (1) turnkey; urgency=low 178 | 179 | * Install latest Observium CE release (18.9.1). 180 | 181 | * Rebuild to resolve inadvertent removal of mariadb during sec-updates 182 | - part of #1246. 183 | 184 | -- Jeremy Davis Thu, 22 Nov 2018 14:00:58 +1100 185 | 186 | turnkey-observium-15.0 (1) turnkey; urgency=low 187 | 188 | * Latest upstream version of Observium (CE 17.9.0). 189 | 190 | * Install Adminer directly from stretch/main repo 191 | 192 | * Provide "adminer" root-like user for Adminer MySQL access 193 | 194 | * Replace MySQL with MariaDB (drop-in MySQL replacement) 195 | 196 | * Updated version of mysqltuner script 197 | 198 | * Includes PHP7.0 (installed from Debian repos) 199 | 200 | * Updated PHP default settings 201 | 202 | * Remove phpsh (no longer maintained) 203 | 204 | * Note: Please refer to turnkey-core's changelog for changes common to all 205 | appliances. Here we only describe changes specific to this appliance. 206 | 207 | -- Vlad Kuzmenko Tue, 19 Jun 2018 12:40:42 +0200 208 | 209 | turnkey-observium-14.2 (1) turnkey; urgency=low 210 | 211 | * Latest upstream version of Observium (tested on 0.16.10.8128) 212 | 213 | * Upgraded Adminer to 4.2.5 214 | 215 | * Installed security updates. 216 | 217 | * Note: Please refer to turnkey-core's changelog for changes common to all 218 | appliances. Here we only describe changes specific to this appliance. 219 | 220 | -- Stefan Davis Thu, 16 Mar 2017 01:27:58 +1100 221 | 222 | turnkey-observium-14.1 (1) turnkey; urgency=low 223 | 224 | * Observium: 225 | 226 | - Latest upstream version of Observium. 227 | - Created missing log directory (#460). 228 | - Fixed missing php5-mcrypt dependency (#487). 229 | 230 | * Latest Debian package versions. 231 | 232 | * Note: Please refer to turnkey-core's changelog for changes common to all 233 | appliances. Here we only describe changes specific to this appliance. 234 | 235 | -- Jeremy Davis Wed, 17 Feb 2016 16:58:22 +1100 236 | 237 | turnkey-observium-14.0 (1) turnkey; urgency=low 238 | 239 | * Latest upstream version of Observium 240 | 241 | * Replaced PHPMyAdmin with Adminer 242 | 243 | * Hardened default SSL settings 244 | 245 | * Note: Please refer to turnkey-core's changelog for changes common to all 246 | appliances. Here we only describe changes specific to this appliance. 247 | 248 | -- Jeremy Davis Fri, 19 Jun 2015 00:55:38 +1000 249 | 250 | turnkey-observium-13.0 (1) turnkey; urgency=low 251 | 252 | * Initial public release of TurnKey Observium, based on TKLDev submitted 253 | by Eric Young. 254 | 255 | * SSL support out of the box. 256 | 257 | * Latest upstream version of Observium: 258 | 259 | - Installed from upstream source code to /opt/observium. 260 | - Includes all recommended packages including libvirt for virtual 261 | machine monitoring. 262 | - Includes recommended cronjob for discovery and polling. 263 | 264 | * Regenerates all secrets during installation / firstboot (security). 265 | 266 | * Includes postfix MTA (bound to localhost) for sending of email (e.g. 267 | password recovery). Also includes webmin postfix module for convenience 268 | 269 | * Note: Please refer to turnkey-core's changelog for changes common to all 270 | appliances. Here we only describe changes specific to this appliance. 271 | 272 | -- Alon Swartz Thu, 17 Oct 2013 19:33:38 +0300 273 | -------------------------------------------------------------------------------- /conf.d/downloads: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | dl() { 4 | [ "$FAB_HTTP_PROXY" ] && PROXY="--proxy $FAB_HTTP_PROXY" 5 | cd $2; curl -L -f -O $PROXY $1; cd - 6 | } 7 | 8 | SRC=/usr/local/src 9 | 10 | turnkey-get-observium-ver > $SRC/observium_version 11 | 12 | SRC=/usr/local/src 13 | dl http://www.observium.org/observium-community-latest.tar.gz $SRC 14 | -------------------------------------------------------------------------------- /conf.d/main: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | DB_NAME=observium 4 | DB_USER=observium 5 | DB_PASS=$(mcookie) 6 | 7 | ADMIN_NAME=admin 8 | ADMIN_PASS=turnkey 9 | 10 | SRC=/usr/local/src 11 | APPROOT=/opt/observium 12 | WEBROOT=/var/www/observium 13 | 14 | VERSION_LOCATION=/usr/local/lib/turnkey-update-observium/current.json 15 | 16 | # unpack observium and create required directories 17 | tar -zxf $SRC/observium-*.tar.gz -C $(dirname $APPROOT) 18 | rm $SRC/observium-*.tar.gz 19 | mkdir -p $(dirname $VERSION_LOCATION) 20 | mv $SRC/observium_version $VERSION_LOCATION 21 | 22 | mkdir -p $APPROOT/rrd 23 | mkdir -p $APPROOT/graphs 24 | chown www-data:www-data $APPROOT/rrd 25 | chown www-data:www-data $APPROOT/graphs 26 | 27 | # configure apache and webroot 28 | a2dissite 000-default 29 | a2ensite observium 30 | a2enmod rewrite 31 | 32 | ln -s $APPROOT/html $WEBROOT 33 | 34 | # start services 35 | service mysql start 36 | 37 | # setup the database 38 | CONF=$APPROOT/config.php 39 | cp $APPROOT/config.php.default $CONF 40 | sed -i "\ 41 | s|\(\['db_name'\]\).*|\1 = \"$DB_NAME\";|; \ 42 | s|\(\['db_user'\]\).*|\1 = \"$DB_USER\";|; \ 43 | s|\(\['db_pass'\]\).*|\1 = \"$DB_PASS\";|; " $CONF 44 | 45 | echo "\$config['email']['backend'] = \"sendmail\";" >> $CONF 46 | echo "\$config['email']['sendmail_path'] = \"/usr/bin/sendmail -t -i\";" >> $CONF 47 | 48 | mysqladmin create $DB_NAME 49 | mysql --batch --execute "\ 50 | grant all privileges on $DB_NAME.* to $DB_USER@localhost identified by '$DB_PASS'; \ 51 | flush privileges;" 52 | 53 | # insert default schema 54 | cd $APPROOT 55 | ./discovery.php -u 56 | 57 | # create admin user (level 10) 58 | $APPROOT/adduser.php $ADMIN_NAME $ADMIN_PASS 10 59 | 60 | # install pear libraries 61 | pear install Net_IPv4 62 | pear install Net_IPv6 63 | 64 | # allow logging 65 | mkdir -p $APPROOT/logs 66 | chown -R www-data:www-data $APPROOT/logs 67 | ln -s $APPROOT/logs /var/log/observium 68 | 69 | # stop services 70 | service mysql stop 71 | -------------------------------------------------------------------------------- /overlay/etc/apache2/sites-available/observium.conf: -------------------------------------------------------------------------------- 1 | ServerName localhost 2 | 3 | 4 | UseCanonicalName Off 5 | ServerAdmin webmaster@localhost 6 | DocumentRoot /var/www/observium/ 7 | 8 | 9 | 10 | SSLEngine on 11 | ServerAdmin webmaster@localhost 12 | DocumentRoot /var/www/observium/ 13 | 14 | 15 | 16 | Options +FollowSymLinks 17 | AllowOverride All 18 | Require all granted 19 | 20 | 21 | -------------------------------------------------------------------------------- /overlay/etc/cron.d/observium: -------------------------------------------------------------------------------- 1 | 33 */6 * * * root /opt/observium/discovery.php -h all >> /dev/null 2>&1 2 | */5 * * * * root /opt/observium/discovery.php -h new >> /dev/null 2>&1 3 | */5 * * * * root /usr/bin/python3 /opt/observium/poller-wrapper.py 1 >> /dev/null 2>&1 4 | # Run housekeeping script daily for syslog, eventlog and alert log 5 | 13 5 * * * root /opt/observium/housekeeping.php -sel >> /dev/null 2>&1 6 | # Run housekeeping script daily for rrds, ports, orphaned entries in the database and performance data 7 | 47 4 * * * root /opt/observium/housekeeping.php -rptb >> /dev/null 2>&1 8 | -------------------------------------------------------------------------------- /overlay/usr/lib/inithooks/bin/observium.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """Set Observium admin password 3 | 4 | Option: 5 | --pass= unless provided, will ask interactively 6 | 7 | """ 8 | 9 | import sys 10 | import getopt 11 | 12 | import crypt 13 | from random import SystemRandom 14 | import hashlib 15 | 16 | from libinithooks.dialog_wrapper import Dialog 17 | from mysqlconf import MySQL 18 | 19 | def usage(s=None): 20 | if s: 21 | print("Error:", s, file=sys.stderr) 22 | print("Syntax: %s [options]" % sys.argv[0], file=sys.stderr) 23 | print(__doc__, file=sys.stderr) 24 | sys.exit(1) 25 | 26 | def main(): 27 | try: 28 | opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ['help', 'pass=']) 29 | except getopt.GetoptError as e: 30 | usage(e) 31 | 32 | password = "" 33 | for opt, val in opts: 34 | if opt in ('-h', '--help'): 35 | usage() 36 | elif opt == '--pass': 37 | password = val 38 | 39 | if not password: 40 | d = Dialog('TurnKey Linux - First boot configuration') 41 | password = d.get_password( 42 | "Observium Password", 43 | "Enter new password for the Observium 'admin' account.") 44 | 45 | random = SystemRandom() 46 | salt = hashlib.sha1(str(random.random()).encode('utf8')).hexdigest()[:8] 47 | hash = crypt.crypt(password, "$1$" + salt + "$") 48 | 49 | m = MySQL() 50 | m.execute('UPDATE observium.users SET password=%s WHERE username=\"admin\";', (hash,)) 51 | 52 | 53 | if __name__ == "__main__": 54 | main() 55 | 56 | -------------------------------------------------------------------------------- /overlay/usr/lib/inithooks/firstboot.d/20regen-observium-secrets: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # regenerate observium secrets and mysql password 3 | 4 | . /etc/default/inithooks 5 | 6 | CONF=/opt/observium/config.php 7 | 8 | PASSWORD=$(mcookie) 9 | 10 | sed -i "s/\(\$config\['db_pass'] =\) .*;$/\1 \"$PASSWORD\";/" $CONF 11 | $INITHOOKS_PATH/bin/mysqlconf.py --user=observium --pass="$PASSWORD" 12 | -------------------------------------------------------------------------------- /overlay/usr/lib/inithooks/firstboot.d/40observium: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | # set observium admin password 3 | 4 | . /etc/default/inithooks 5 | 6 | [ -e $INITHOOKS_CONF ] && . $INITHOOKS_CONF 7 | $INITHOOKS_PATH/bin/observium.py --pass="$APP_PASS" 8 | 9 | -------------------------------------------------------------------------------- /overlay/usr/local/bin/turnkey-get-observium-ver: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | red=$(tput setaf 196) 4 | reset=$(tput sgr0) 5 | 6 | fatal() { echo "${red}FATAL:${reset} $@" >&2; exit 1; } 7 | 8 | if [[ "$(whoami)" != 'root' ]]; then 9 | fatal "This script must be run as 'root', please try again with 'sudo'." 10 | fi 11 | 12 | usage() { 13 | EXIT_CODE=0 14 | if [[ "$#" -gt 0 ]]; then 15 | EXIT_CODE=$1 16 | shift 17 | echo "${red}ERROR:${reset} $@" >&2 18 | echo 19 | fi 20 | cat <&2; } 10 | fatal() { echo "${red}FATAL:${reset} $@" >&2; exit 1; } 11 | 12 | [[ -z "$DEBUG" ]] || set -x 13 | 14 | if [[ "$(whoami)" != 'root' ]]; then 15 | fatal "This script must be run as 'root', please try again with 'sudo'." 16 | fi 17 | 18 | # update channel; 'ce' by default 19 | CHANNEL=ce 20 | 21 | CUR_VER=/usr/local/lib/turnkey-update-observium/current.json 22 | OB_FILE=observium-community-latest.tar.gz 23 | OB_DIR=/opt/observium 24 | BU_DIR=$(dirname $OB_DIR)/$(basename $OB_DIR)_backup_$(date +"%Y_%m_%d") 25 | 26 | count=0 27 | while [[ -d $BU_DIR ]]; do 28 | count=$((count+1)) 29 | BU_DIR=$BU_DIR_$count 30 | done 31 | 32 | cat <${reset} to exit Or ${yellow}${reset} to continue. 62 | EOF 63 | read -rs response 64 | 65 | if [[ "$CHANNEL" != 'ce' ]]; then 66 | fatal "Unfortuantely, this script does not know how to update $CHANNEL channel." 67 | fi 68 | 69 | if [[ -f "$CUR_VER" ]]; then 70 | VER_DIR=$(dirname $CUR_VER) 71 | # uses CHANNEL var, but current only supports 'ce' 72 | info "Checking for latest $CHANNEL version." 73 | turnkey-get-observium-ver $CHANNEL > $VER_DIR/latest.json 74 | if [[ "$(jq -r 'keys'[0] $CUR_VER)" != "$CHANNEL" ]]; then 75 | fatal "Currently this script only works with the '$CHANNEL' channel." 76 | elif cmp -s $CUR_VER $VER_DIR/latest.json; then 77 | info "Current version matches latest version, exiting..." 78 | rm -rf $VER_DIR/latest.json 79 | exit 80 | else 81 | info "A different version has been found, attempting update..." 82 | fi 83 | else 84 | warn "Current version not found, attempting update anyway..." 85 | fi 86 | 87 | info "Backing up $OB_DIR to $BU_DIR" 88 | if [[ -d "$OB_DIR" ]]; then 89 | mv $OB_DIR $BU_DIR 90 | else 91 | fatal "$OB_DIR not found." 92 | fi 93 | 94 | info "Downloading latest release from observium.org" 95 | wget -O /tmp/$OB_FILE https://www.observium.org/$OB_FILE 96 | 97 | info "Unpacking tarball" 98 | tar zxvf /tmp/$OB_FILE -C /opt/ 99 | 100 | paths="rrd *log*" 101 | for path in $paths; do 102 | info "Moving $path from backup to new install" 103 | mv $BU_DIR/$path $OB_DIR/ 104 | done 105 | 106 | info "Copying config.php from backup to new install" 107 | cp $BU_DIR/config.php $OB_DIR/ 108 | 109 | info "Updating DB schema" 110 | /opt/observium/discovery.php -u 111 | 112 | info "Forcing rediscovery of all devices" 113 | /opt/observium/discovery.php -h all 114 | 115 | info "Setting permissions for relevant Observium sub-directories." 116 | chown -R www-data:www-data $OB_DIR/{rrd,graphs} 117 | chown -R www-data:www-data $OB_DIR/*log* 118 | 119 | info "Removng downloaded Observium archive file." 120 | rm -rf /tmp/$OB_FILE 121 | 122 | info "Please test and if everything is working ok, you can manually delete $BU_DIR" 123 | -------------------------------------------------------------------------------- /plan/main: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | php-gd 5 | php-json 6 | php-snmp 7 | php-xml 8 | php-pear 9 | php-mbstring 10 | php-bcmath 11 | php-curl 12 | php-opcache 13 | php-apcu 14 | php-curl 15 | 16 | whois 17 | snmp 18 | rrdtool 19 | fping 20 | nmap 21 | mtr-tiny 22 | ipmitool 23 | 24 | graphviz 25 | imagemagick 26 | 27 | python3-mysqldb 28 | 29 | /* Optional deps for scanning VMs */ 30 | libvirt-daemon-system 31 | libvirt-clients 32 | 33 | /* turnkey-get-observium-ver dep */ 34 | jq 35 | --------------------------------------------------------------------------------