Skip to content

Instantly share code, notes, and snippets.

View moolitayer's full-sized avatar

Mooli Tayer moolitayer

View GitHub Profile
:product:
:datawarehouse_manager: true
:prototype:
:monitoring: true
#!/usr/bin/env ruby
require File.join(Dir.pwd, 'config/environment')
ALERT_UUID="17ac4258-cd1e-11e6-914b-024234304b62"
MiqAlert.where(:guid => ALERT_UUID).destroy_all # will destroy statuses and action(?) too
ma = MiqAlert.create!(guid: ALERT_UUID, description: "All hawkular", options: {:notifications=>{:delay_next_evaluation=>600, :evm_event=>{}, :automate=>{:event_name=>"Oh no, an alert"}}}, db: "ContainerNode", expression: {:eval_method=>"hwk_generic", :mode=>"internal", :options=>{}})
# create new MAS based on the existing ones
ExtManagementSystem.where(:type => "ManageIQ::Providers::Openshift::ContainerManager").each do |ext|
mas = MiqAlertStatus.create!(
#Logs at: /var/www/miq/vmdb/log
# DB Access:
sudo su - postgres -c "psql vmdb_production"
# Rails Console:
cd /var/www/miq/vmdb/
source /etc/default/evm
bin/rails c
timedatectl
chkconfig --list ntpd
ntpq -p # run NTP query
@moolitayer
moolitayer / alert_buffer.json
Last active September 15, 2017 14:52
Debug Collection
{"generationID":"4cf35435-6833-487d-bc64-f2bd171999b3","messages":[{"index":97,"timestamp":"2017-09-13T17:39:31.040232406Z","data":{"alerts":[{"annotations":{"message":"Huge node detected","miqTarget":"ContainerNode","severity":"HIGH","url":"https://www.example.com/fixing_instructions"},"endsAt":"0001-01-01T00:00:00Z","generatorURL":"http://prometheus-2278364511-lb8zw:9090/graph?g0.expr=container_spec_memory_limit_bytes+%3E+1e%2B10\u0026g0.tab=0","labels":{"alertname":"BigMemNode","beta_kubernetes_io_arch":"amd64","beta_kubernetes_io_instance_type":"m4.xlarge","beta_kubernetes_io_os":"linux","failure_domain_beta_kubernetes_io_region":"us-west-2","failure_domain_beta_kubernetes_io_zone":"us-west-2c","hostname":"certtest-node-compute-b5ad6","id":"/","instance":"ip-172-31-63-23.us-west-2.compute.internal","job":"kubernetes-nodes","kubernetes_io_hostname":"ip-172-31-63-23.us-west-2.compute.internal","logging_infra_fluentd":"true","ops_node":"old","region":"us-west-2","type":"compute"},"startsAt":"2017-08-31T17:10