Skip to content

Instantly share code, notes, and snippets.

@junaid18183
junaid18183 / hdfs_file_count
Created July 11, 2013 09:23
This is Nagios plug-in to monitor the HDFS direcory for number of files in it and sends the alert basis on the threshold
#!/bin/bash
#This Plug-in monitors the HDFS direcory for number of files in it and sends the alert basis on the threshold
# Author - Juned Memon [email protected]
#######################################################################################
#Nagios Exit Status
STATE_OK=0
STATE_WARNING=1
@junaid18183
junaid18183 / cass_unreachable_nodes
Last active December 19, 2015 15:09
#These Nagios plug-in's monitors the Cassandra Cluster for number of nodes connected, and Unreachable nodes in Cassandra Ring; using nodetool ring command
#! /bin/bash
#This Plug-in monitors the Unreachable nodes in Cassandra Ring; using nodetool ring command
# Author - Juned Memon [email protected]
#########THIS part is for Nagios ################################
PROGNAME=`/usr/bin/basename $0`
@junaid18183
junaid18183 / nagios-client-install
Created July 11, 2013 09:37
This is the sample script to install the Nagios Plugins and NRPE on nagios clients, using compiling them.
#! /bin/bash
# Script to install nagios plugin and NRPE on nagios clients using downloading and compiling them.
# Step 1 --> Nagios plugins Installation
# add Nagios User with not shell access
useradd -s /sbin/nologin nagios
echo "user Nagios Added" >> /tmp/nagios_plugin_install.log
#Create a new issue in Jira from the Python XMLRPC interface. You'll have to
#provide the server and user credentials and match up your own fields
import sys
from xmlrpclib import Server
user = "username"
passwd = "passwd"
serverurl = "https://server.example.com/rpc/xmlrpc"
projectname = "demoproject"
@junaid18183
junaid18183 / Jenkins-install.info
Last active June 10, 2016 10:23
Install Jenkins and Tron on Centos
Important Pluging for Jenkins
Jenkins SSH plugin : https://wiki.jenkins-ci.org/display/JENKINS/SSH+plugin
Basic Configurarion : cat /var/lib/jenkins/config.xml
Jobs configuration : cat /var/lib/jenkins/jobs/<job-name>/config.xml
#!/usr/bin/python
# +----------------------------------------------------------------------+
# | |
# | _ _ __ __ |
# | | | | | | \/ | |
# | | |_ _ _ __ ___ __| | | \ / | ___ _ __ ___ ___ _ __ |
# | _ | | | | | '_ \ / _ \/ _` | | |\/| |/ _ \ '_ ` _ \ / _ \| '_ \ |
# | | |__| | |_| | | | | __/ (_| | | | | | __/ | | | | | (_) | | | | |
# | \____/ \__,_|_| |_|\___|\__,_| |_| |_|\___|_| |_| |_|\___/|_| |_| |
# | |
#!/bin/sh
#
# ## Plugin for Nagios to monitor the count of files in directory
# ## Written by Juned Memon
# ##
# ## - 20140312 Tested on Centos
#
#
# ## You are free to use this script under the terms of the Gnu Public License.
# ## No guarantee - use at your own risc.
@junaid18183
junaid18183 / jenkins_check.py
Last active August 29, 2015 14:03
jenkins_check.py
#! /usr/bin/env python
#---------------------------------------------------------------------------------------------------------------
# Author:
# Juned Memon <[email protected]>
# This is a simple Nagios plugin to check if any of the defined Jenkins Job is getting failed.
#---------------------------------------------------------------------------------------------------------------
#Imports
import urllib,sys,re
#import ast # using simplejson or json insted of ast
import simplejson
#!/usr/bin/python
#Author: Juned Memon
#Base for this script was created by: Andrew McDonald [email protected] http://mcdee.com.au and Jelle Bekker
# Example: config file
#[client]
#host = localhost
#user = root
#password = root-pass
@junaid18183
junaid18183 / Fabric-Setup.md
Last active November 16, 2016 09:56
Fabric-Setup

A Brief Introduction to Fabric

Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:

for s in $(cat servers.txt); do ssh $s service httpd graceful; done

Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.