Skip to content

Instantly share code, notes, and snippets.

@p-se
p-se / cephadm_status.sh
Created April 25, 2022 08:15 — forked from sebastian-philipp/cephadm_status.sh
cephadm_status.sh to properly write the status of cephadm avoiding asking for the same kind of information again and again
CEPHADM="sudo cephadm"
echo '# `ceph -s`'
echo '```'
$CEPHADM shell -- ceph -s
echo '```'
echo '# `ceph health detail`'
echo '```'
$CEPHADM shell -- ceph health detail
@p-se
p-se / prom.sh
Created December 5, 2019 10:51
Install Prometheus from precompiled binary archive
mkdir /tmp/prometheus
cd /tmp/prometheus
curl -LO https://github.com/prometheus/prometheus/releases/download/v2.14.0/prometheus-2.14.0.linux-amd64.tar.gz
tar xf prometheus-2.14.0.linux-amd64.tar.gz
cd /tmp/prometheus/prometheus-2.14.0.linux-amd64
# curl -LO https://raw.githubusercontent.com/ricardoasmarques/ceph-dev-docker/master/prometheus/prometheus.yml
# curl -LO https://raw.githubusercontent.com/ricardoasmarques/ceph-dev-docker/master/prometheus/alert.rules
echo "ddf47223ec716594254df110ee26ad52e66d7d4471ae8edbf9020087396861e5 prometheus-2.14.0.linux-amd64.tar.gz" > prometheus-2.14.0.linux-amd64.tar.gz.sha256
sha256sum prometheus-2.14.0.linux-amd64.tar.gz.sha256
if [[ "$?" != 0 ]] ; then
@p-se
p-se / fix.py
Last active November 12, 2019 16:27
salt runner to fix vagrant-ceph hostnames
# -*- coding: utf-8 -*-
# vim: ts=4 sts=4 sw=4 expandtab
from __future__ import absolute_import
import salt.client
import pdb
import re
from pprint import pprint
def hostnames(**kwargs):
@p-se
p-se / full.patch
Last active December 5, 2019 13:42
smart data integration to host page
diff --git a/src/pybind/mgr/dashboard/controllers/host.py b/src/pybind/mgr/dashboard/controllers/host.py
index e7ba628717..693b80ccb1 100644
--- a/src/pybind/mgr/dashboard/controllers/host.py
+++ b/src/pybind/mgr/dashboard/controllers/host.py
@@ -107,4 +107,9 @@ class Host(RESTController):
@RESTController.Resource('GET')
def smart(self, hostname):
# type: (str) -> dict
- return CephService.get_smart_data_by_host(hostname)
+ import requests
@p-se
p-se / smartctl
Created October 25, 2019 13:06
fake smartctl output for testing inside docker container
#!/bin/bash
URL="https://raw.githubusercontent.com/ceph/ceph/24bae30bc67b47559a2f0d041aa2134ead6a4e78/src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/fixtures/smart_data_version_1_0_response.json"
curl -s $URL | jq -M '.["WDC_WD1003FBYX-01Y7B1_WD-WCAW11111111"]'
@p-se
p-se / mock_device_data_in_frontend.diff
Last active October 7, 2019 15:47
Mocks device data in the frontend services with one device for each possible state (otherwise depends on diskprediction module data)
Index: src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts (revision 07a6e310dd6ab346854f32492b5ee0b33828aad8)
+++ src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts (date 1570462990761)
@@ -2,6 +2,8 @@
import { Injectable } from '@angular/core';
Index: src/pybind/mgr/dashboard/controllers/osd.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- src/pybind/mgr/dashboard/controllers/osd.py (date 1568804320000)
+++ src/pybind/mgr/dashboard/controllers/osd.py (date 1568813850316)
@@ -6,6 +6,7 @@
from ..services.ceph_service import CephService, SendCommandError
from ..services.exception import handle_send_command_error
#!/bin/bash
set -e
cd src/pybind/mgr/dashboard/frontend
if ! npx pretty-quick --pattern "{src,e2e}/**/*.{ts,scss}" --branch HEAD --check
then
echo "Ooops, you need to format frontend files."
exit 1
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import json
from contextlib import contextmanager
import cherrypy
from . import ApiController, RESTController, AuthRequired
from ..settings import Settings, Options
#!/bin/bash
MGR_MODULES_DIR=$(dirname $GIT_DIR)/src/pybind/mgr/
echo "find ${MGR_MODULES_DIR} -iname '*.pyc' -delete"
find ${MGR_MODULES_DIR} -iname '*.pyc' -delete