Skip to content

Instantly share code, notes, and snippets.

@q1x
q1x / maintenance.py
Created February 3, 2021 08:14
Zabbix automaintenance
#!/usr/bin/env python
#
# import needed modules.
# pyzabbix is needed, see https://github.com/lukecyca/pyzabbix
#
import argparse
import ConfigParser
import os
import os.path
import time
@q1x
q1x / Vagrantfile
Created November 11, 2020 20:19
Vagrant Box for SaltStack Development
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "geerlingguy/centos7"
config.vm.network "docs", guest: 8000, host: 8000, host_ip: "127.0.0.1"
config.vm.provision "shell", inline: <<-SHELL
set -e
yum -q -y install git vim-enhanced @development zlib-devel bzip2 bzip2-devel readline-devel sqlite \
sqlite-devel openssl-devel xz xz-devel libffi-devel findutils
@q1x
q1x / itemcleanup.py
Created October 11, 2019 14:26
Zabbix Item Cleanup
#!/usr/bin/env python
#
# import needed modules.
# pyzabbix is needed, see https://github.com/lukecyca/pyzabbix
#
import argparse
import ConfigParser
import os
import os.path
import time
@q1x
q1x / proxydeps.py
Created March 6, 2019 16:22
Zabbix proxy dependencies
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# import needed modules.
# pyzabbix is needed, see https://github.com/lukecyca/pyzabbix
#
import argparse
import ConfigParser
import os
import os.path
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# import needed modules.
# pyzabbix is needed, see https://github.com/lukecyca/pyzabbix
#
import argparse
import ConfigParser
import os
import os.path
@q1x
q1x / fix-dependencies.py
Last active November 22, 2017 14:03
Zabbix dependencies on inventory type and location tag
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# import needed modules.
# pyzabbix is needed, see https://github.com/lukecyca/pyzabbix
#
import argparse
import ConfigParser
import os
import os.path
@q1x
q1x / mysql.sls
Created March 20, 2017 12:55
Conditional mysql-server install via mysql-formula
# Setup the mysql client
include:
- mysql.client
# Only setup mysql server if a root password has been set
{% if salt['pillar.get']('mysql:server:root_password',false) %}
- mysql.server
- mysql.remove_test_database
{% else %}
Mysql root password is not set, skipping Mysql installation:
@q1x
q1x / Vagrantfile
Created April 1, 2016 15:05
Zabbix 3.0.x Vagrant file
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@q1x
q1x / .pythonrc
Created December 21, 2015 14:58
zabbix pythonrc
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set ft=python :
try:
import readline
import ConfigParser
import os
import os.path
import sys
#!/bin/bash
#
# This script counts the number of returned lines from an SNMP walk.
#
COMMUNITY="$1"
IP="$2"
OID="$3"
FILTER="$4"
# Disable mibs to save time