Skip to content

Commit

Permalink
agregado script de auto deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
pvrmza committed Oct 13, 2020
1 parent 0276083 commit fa11203
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Download https://github.com/pvrmza/docker-observium/blob/master/files/export_con

```
$ cd /opt/observium
$ wget https://github.com/pvrmza/docker-observium/blob/master/files/export_config.php -O export_config.php
$ wget https://raw.githubusercontent.com/pvrmza/docker-observium/master/files/export_config.php -O export_config.php
$ chmod u+x export_config.php
$ ./export_config.php > env_observium
```
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:
volumes:
- config:/config
ports:
- "80:80"
- "80"

volumes:
db_data:
Expand Down
9 changes: 9 additions & 0 deletions files/autodeploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

git clone https://github.com/pvrmza/docker-observium.git
cd docker-observium
cp env_mysql_example .env_mysql
cp env_observium_example .env_observium
docker-compose up -d


11 changes: 3 additions & 8 deletions files/cron-observium
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# Run a complete discovery of all devices once every 6 hours
33 */6 * * * root /opt/observium/discovery.php -h all > /proc/1/fd/1 2>/proc/1/fd/2
*/5 * * * * root /opt/observium/discovery.php -h new > /proc/1/fd/1 2>/proc/1/fd/2
*/5 * * * * root /opt/observium/poller-wrapper.py > /proc/1/fd/1 2>/proc/1/fd/2

# Run housekeeping script daily for syslog, eventlog and alert log
13 5 * * * root /opt/observium/housekeeping.php -ysel > /proc/1/fd/1 2>/proc/1/fd/2
47 4 * * * root /opt/observium/housekeeping.php -yrptb > /proc/1/fd/1 2>/proc/1/fd/2
# update host statuses exery 15 minutes
*/15 * * * * php /var/www/html/functions/scripts/pingCheck.php
*/15 * * * * php /var/www/html/functions/scripts/discoveryCheck.php

22 changes: 14 additions & 8 deletions files/foreground.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ chown www-data:www-data /config/rrd
#######
rm -rf /opt/observium/config.php
echo "<?php" > /config/config.php
# ENVIROMET to CONFIG
# ENVIRONMENT to CONFIG
while IFS= read -r line
do
var=`echo $line | cut -d = -f 1 |sed "s/OBSERVIUM_/['/g" | sed "s/__/']['/g" | sed "s/$/']/g" `
Expand Down Expand Up @@ -59,12 +59,18 @@ if [ -e /config/devices ]; then
./add_device.php /config/devices
fi

# Perform Initial Discovery ... in backgound
#./discovery.php -h all &
#######
# timezone
if [ -f /usr/share/zoneinfo/$TZ ]; then
echo $TZ > /etc/timezone
rm /etc/localtime && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
dpkg-reconfigure -f noninteractive tzdata

echo "date.timezone=$TZ" > /etc/php/7.2/apache2/conf.d/99_datatime.ini
fi




####################################3
# cron
# export env
# printenv | egrep ^OBSERVIUM | sort -u | sed 's/^\(.*\)$/export \1/g' > /etc/cron.env
# chmod 500 /etc/cron.env
#
supervisord -c /etc/supervisord.conf
70 changes: 70 additions & 0 deletions files/observium_templates_alert_all.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0"?>
<templates>
<template type="alert" description="Autogenerated observium template" version="0.91" created="Wed, 03 Jun 2020 13:26:38 -0300" observium="19.8.10000" id="9363235ba97447358f285a1c7d8bacfa">
<entity_type>storage</entity_type>
<name>storage</name>
<message>ALERT !! ALERT !! Disco Lleno !!! </message>
<severity>crit</severity>
<suppress_recovery>0</suppress_recovery>
<delay>2</delay>
<conditions_and>1</conditions_and>
<conditions>storage_perc greater 80</conditions>
<conditions_complex>storage_perc greater 80</conditions_complex>
</template>
<template type="alert" description="Autogenerated observium template" version="0.91" created="Wed, 03 Jun 2020 13:26:38 -0300" observium="19.8.10000" id="21d13bdf0f6b1cfc7b3b9ac7e7cff843">
<entity_type>processor</entity_type>
<name>processor</name>
<message>ALERT !! ALERT !! CPU AL PALO !!!</message>
<severity>crit</severity>
<suppress_recovery>0</suppress_recovery>
<delay>3</delay>
<conditions_and>1</conditions_and>
<conditions>processor_usage greater 80</conditions>
<conditions_complex>processor_usage greater 80</conditions_complex>
</template>
<template type="alert" description="Autogenerated observium template" version="0.91" created="Wed, 03 Jun 2020 13:26:38 -0300" observium="19.8.10000" id="d543529eb0ba2baff3b3b25e340624a5">
<entity_type>device</entity_type>
<name>reboot</name>
<message>ALERT !! ALERT !! se reinicio un equipo ! </message>
<severity>crit</severity>
<suppress_recovery>0</suppress_recovery>
<delay>1</delay>
<conditions_and>1</conditions_and>
<conditions>device_rebooted equal 1</conditions>
<conditions_complex>device_rebooted equal 1</conditions_complex>
</template>
<template type="alert" description="Autogenerated observium template" version="0.91" created="Wed, 03 Jun 2020 13:26:38 -0300" observium="19.8.10000" id="3036ca8d4d5792d79ecfde010d44ba8e">
<entity_type>port</entity_type>
<name>trafico</name>
<message>ALERT !! ALERT !! TRAFICO DE MAS !!! </message>
<severity>crit</severity>
<suppress_recovery>0</suppress_recovery>
<delay>3</delay>
<conditions_and>0</conditions_and>
<conditions>ifInOctets_perc ge 80</conditions>
<conditions>ifOutOctets_perc ge 80</conditions>
<conditions_complex>ifInOctets_perc ge 80 OR ifOutOctets_perc ge 80</conditions_complex>
</template>
<template type="alert" description="Autogenerated observium template" version="0.91" created="Wed, 03 Jun 2020 13:26:38 -0300" observium="19.8.10000" id="e4b654dd361e186cc41c4e1c9fbbecc2">
<entity_type>port</entity_type>
<name>vpncaida</name>
<message>ALERT !! ALERT !! VPN CAIDA !! </message>
<severity>crit</severity>
<suppress_recovery>0</suppress_recovery>
<delay>1</delay>
<conditions_and>1</conditions_and>
<conditions>ifOperStatus notequals up</conditions>
<conditions_complex>ifOperStatus notequals up</conditions_complex>
</template>
<template type="alert" description="Autogenerated observium template" version="0.91" created="Wed, 03 Jun 2020 13:26:38 -0300" observium="19.8.10000" id="80d30c11dae560a1b30bae47eb9dff5d">
<entity_type>printersupply</entity_type>
<name>toner</name>
<message>ALERTA !! ALERTA !! Sin toner !!</message>
<severity>crit</severity>
<suppress_recovery>0</suppress_recovery>
<delay>3</delay>
<conditions_and>1</conditions_and>
<conditions>supply_value le 5</conditions>
<conditions_complex>supply_value le 5</conditions_complex>
</template>
</templates>
43 changes: 43 additions & 0 deletions snmpd.conf.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Listen for connections on all interfaces (both IPv4 *and* IPv6)
agentAddress udp:161,udp6:[::1]:161

# Full view access
view all included .1

# system + hrSystem groups only
view systemonly included .1.3.6.1.2.1.1
view systemonly included .1.3.6.1.2.1.25.1

# Default access to full view
rocommunity 0bs3rv1um default -V all

# Default access to basic system info
#rocommunity public default -V systemonly

# System contact and location
syslocation Rack/Room/Building, Street, City, Country [GPSX,Y]
syscontact Contact Person <your@email.address>

# Disk Monitoring
disk / 10000
disk /var 5%
includeAllDisks 10%

# Unacceptable 1-, 5-, and 15-minute load averages
load 12 10 5

# This line allows Observium to detect the host OS if the distro script is installed
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/bin/distro

# This lines allows Observium to detect hardware, vendor and serial
extend .1.3.6.1.4.1.2021.7890.2 hardware /bin/cat /sys/devices/virtual/dmi/id/product_name
extend .1.3.6.1.4.1.2021.7890.3 vendor /bin/cat /sys/devices/virtual/dmi/id/sys_vendor
extend .1.3.6.1.4.1.2021.7890.4 serial /bin/cat /sys/devices/virtual/dmi/id/product_serial

# This line allows Observium to collect an accurate uptime
extend uptime /bin/cat /proc/uptime

# This line enables Observium's ifAlias description injection
#pass_persist .1.3.6.1.2.1.31.1.1.1.18 /usr/local/bin/ifAlias_persist


0 comments on commit fa11203

Please sign in to comment.