Skip to content

Instantly share code, notes, and snippets.

@gardart
gardart / imo_reykjavik_3h.yml
Last active April 7, 2024 08:49
Home Assistant skynjari fyrir 3ja tíma mannaðar veðurathuganir frá Veðurstofu Íslands
#########################
# 5.4.2024 : Breytti ur apis.is yfir i xml thjonustu vedur.is
#
# Home Assistant skynjari fyrir 3ja tíma mannaðar veðurathuganir frá Veðurstofu Íslands.
# Mannaðar veðurstöðvar birta athuganir á 3 klst fresti.
# https://www.vedur.is/media/vedurstofan/XMLthjonusta.pdf
#
# Stöðvanúmerin má finna með því að fara á slóðina: https://www.vedur.is/vedur/stodvar
# Hér að neðan er Reykjavík valin (station=1)
#
# Install Nagios NRPE client with okconfig/adagios support
sudo rpm -ihv http://opensource.is/repo/ok-release.rpm
sudo yum update -y ok-release
sudo yum install -y nrpe nagios-plugins-load nagios-plugins-procs nagios-plugins-swap
sudo yum --enablerepo=ok-testing install -y nagios-plugins-check_cpu nagios-okconfig-nrpe
sudo yum enable nrpe
# Fix allowed hosts and dont blame nrpe in nrpe settings
export NAGIOS_SERVER='192.168.1.100'
sed -i "/^allowed_hosts=/ s/$/,$NAGIOS_SERVER/" /etc/nagios/nrpe.cfg
@gardart
gardart / BAC_RHEL7_G2_1611.md
Last active March 23, 2023 22:27
Golden image for RHEL7 on Hyper-V (VMM)

Step 1: Create build and capture machine for RHEL7 Step 2: Update machine, install packages Step 3: Create checkpoint Step 4: Sysprep Step 5: Copy vhdx file to your VMM library Step 6: Create template from your last BAC vhdx file Step 7: Revert to checkpoint created yearlier

To update RHEL7 template start at Step 3 and down to step 7.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Written as part of https://www.scrapehero.com/how-to-scrape-amazon-product-reviews-using-python/
from lxml import html
import json
import requests
import json,re
from dateutil import parser as dateparser
from time import sleep
@gardart
gardart / nagios-set-downtime.sh
Created August 26, 2016 13:50
Nagios - Schedule Downtime from the command line (from any host)
#!/bin/bash
# Bash script to schedule downtime for Host
function die {
echo $1;
exit 1;
}
if [ $# -lt 1 ]; then
@gardart
gardart / create_files_from_template
Last active July 1, 2022 01:57
Create multiple html files from csv file using a template
#!/bin/bash
# Create multiple html files from csv file using a template
# CSV file has the structure:
# filename href
#
INPUT=data.csv
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read flname href
@gardart
gardart / install-nagios-thruk-adagios-RHEL7.txt
Last active June 10, 2022 13:22
Install Nagios / Thruk / Adagios - RHEL7
yum update -y
yum install -y epel-release
yum clean all
# Add repos
rpm -Uvh "https://labs.consol.de/repo/stable/rhel7/i386/labs-consol-stable.rhel7.noarch.rpm"
rpm -ihv http://opensource.is/repo/ok-release.rpm
yum update -y ok-release
#########################
@gardart
gardart / create-cloud-template.sh
Created January 30, 2022 20:57 — forked from ManuelSchmitzberger/create-cloud-template.sh
This script will download a cloud image of many Linux distros and create a Proxmox 6 KVM template from it.
#!/bin/bash
set -o errexit
clear
printf "\n*** This script will download a cloud image and create a Proxmox VM template from it. ***\n\n"
### HOW TO USE
### Pre-req:
### - run on a Proxmox 6 server
### - a dhcp server should be active on vmbr1
@gardart
gardart / install_nrpe_pi.md
Last active February 7, 2019 22:20
Raspberry Pi - Install Nagios NRPE

# Debian | Raspbian

All steps on Debian require to run as root. To become root simply run:

Debian

su

Raspbian

from lxml import html
import csv
import os
import requests
from exceptions import ValueError
from time import sleep
from random import randint
def parse(url):
headers = {