This file contains hidden or 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
import cStringIO | |
import json | |
import psycopg2 | |
from django.db import connections | |
from corehq.apps.dump_reload.sql.serialization import JsonLinesSerializer | |
from corehq.form_processor.models import CommCareCaseSQL |
This file contains hidden or 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
cchq icds-cas run-shell-command couchdb2 -b "service couchdb2 stop && rm -rf /opt/data/couchdb2/* && rm -f /usr/local/couchdb2/couchdb/etc/local.d/z_admin.ini && rm -f /usr/local/couchdb2/couchdb/etc/local.d/auto_gen.ini && > /usr/local/couchdb2/couchdb/etc/local.d/ssl.ini && service couchdb2 start" | |
cchq icds-cas ap deploy_db.yml --limit couchdb2 --branch=je/icds-cas-deploy --skip-check --start-at-task="Create system databases" |
This file contains hidden or 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
# based on https://github.com/dhatim/python-license-check | |
import argparse | |
try: | |
from configparser import ConfigParser, NoOptionError | |
except ImportError: | |
from ConfigParser import ConfigParser, NoOptionError | |
import re | |
import sys |
This file contains hidden or 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
from casexml.apps.phone.tests.utils import call_fixture_generator | |
from corehq.apps.app_manager.fixtures.mobile_ucr import report_fixture_generator | |
from casexml.apps.phone.models import OTARestoreCommCareUser | |
from corehq.apps.users.models import CommCareUser | |
from corehq.apps.app_manager.models import Application | |
from datetime import date | |
import logging | |
from corehq.apps.app_manager.models import ReportModule | |
from corehq.apps.app_manager.fixtures.mobile_ucr import ReportFixturesProvider | |
import json |
This file contains hidden or 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
copy_files: | |
- couch6: | |
- source_host: couch4 | |
source_user: couchdb | |
source_dir: /opt/data/couchdb2/ | |
target_dir: /opt/data/couchdb2/ | |
files: | |
- shards/00000000-1fffffff/commcarehq__fixtures.1495821829.couch | |
- .shards/00000000-1fffffff/commcarehq__fixtures.1495821829_design | |
- couch7: |
This file contains hidden or 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
# Drop child tables of intermediate aggregation tables. | |
# Each table must have a 'month' column. | |
# If tables have usage as reported by pg_stat_user_tables | |
# they will not be dropped. | |
import itertools | |
from datetime import date | |
from collections import defaultdict | |
from corehq.sql_db.connections import connection_manager | |
from sqlalchemy.exc import ProgrammingError |
This file contains hidden or 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
cat icds_cas_commcare-nginx_access.log | cut -d' ' -f 10,14 > cas_logs.txt | |
cat icds_cas_commcare-nginx_access.log.1 | cut -d' ' -f 10,14 >> cas_logs.txt | |
cat icds_commcare-nginx_access.log | cut -d' ' -f 10,14 >> cas_logs.txt | |
zcat icds_cas_commcare-nginx_access.log.*.gz | cut -d' ' -f 10,14 >> cas_logs.txt | |
echo -n 'Total,'; echo awk '{s+=$2}END{print s}' cas_logs.txt | |
echo -n 'App audio downloads,'; cat cas_logs.txt | grep CommCareAudio | awk '{s+=$2}END{print s}' | |
echo -n 'App video downloads,'; cat cas_logs.txt | grep CommCareVideo | awk '{s+=$2}END{print s}' | |
echo -n 'App image downloads,'; cat cas_logs.txt | grep CommCareImage | awk '{s+=$2}END{print s}' | |
echo -n 'Static files,'; cat cas_logs.txt | grep static | awk '{s+=$2}END{print s}' |
This file contains hidden or 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
# Load and parse CSV logs from PostgreSQL | |
import os | |
import re | |
import sys | |
import postgres_copy | |
import six | |
import sqlalchemy |
This file contains hidden or 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
@module mod-python | |
@define logpath "/home/cchq/www/{{ deploy_env }}/logs" | |
@define environment "{{ env_monitoring_id }}" | |
@define statsd_host "{{ datadog_statsd_host|default('localhost') }}" | |
@define statsd_port "{{ datadog_statsd_port|default(8125) }}" | |
source src { | |
file("`logpath`/{{ deploy_env }}-timing.log" follow-freq(1) flags(no-parse)); | |
}; |
This file contains hidden or 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
## | |
# {{ ansible_managed }} | |
# See https://github.com/dimagi/commcare-cloud/compare/sk/logstash?expand=1 | |
filter { | |
if [type] == "nginx-timing" { | |
grok { | |
match => [ | |
"message", "\[%{HTTPDATE:http_timestamp}\] (?<cache_status>[-\w]+) %{WORD:http_method} %{DATA:request} HTTP/%{NUMBER:httpversion} %{NUMBER:status_code} %{NUMBER:request_time}" | |
] |