SNMP Poller tool to monitor any thing on network

Few years ago, I had created one SNMP Poller tool using perl and snmp utilites that can poll OID informations from any network devices, which is kind of passive monitoring mechanism.

Thought to make it Opensource under GNU GPL.

The details of the utility with its usage can be found here, if anyone is interested to use it.

https://github.com/kumarprd/snmp-poller

Posted in ARTICLES, FOSS, Monitoring, Programming, SCRIPTING | Tagged , , , , , | Leave a comment

My MongoDB cheatsheet

Few years ago, I was working on one mongoDB project.Its a NoSQL database , easy to learn and its pure JSON based.

I learned it myself and had created a cheatsheet for it, so I can easily recall it anytime I want. It can help anyone who is interested in learning it quickly.

Thought to share the sheet. It can be found here :

https://github.com/kumarprd/mongo-guide/blob/master/my-mongo_guide.txt

 

 

 

Posted in ARTICLES, Concepts, Database, NoSQL, TIPS & T RICS | Tagged , , | Leave a comment

chef attribute : avoiding “undefined method `[]’ for nil:NilClass” error

In chef, when a nested attribute that might not exist/or not crated yet, you can use rescue as a modifier to an if statement.

For example, assuming that only some of your nodes have node[‘install_wls’][‘isManaged’]defined:

if node['install_wls']['isManaged']
do the stuff
end rescue NoMethodError

will avoid the chef run bailing with “undefined method `[]’ for nil:NilClass” error.

Though there are any legit method errors within your if block to handle empty/nil/blank attributes, you’ve just caught an exception you shouldn’t.

I use this in cookbooks that have extra functionality if some dependency of other component recipe happens to be installed. For example, the odi cookbook  depend on wls or odi depends on oracldb.

Posted in ARTICLES, Configurtion management, DevOps, HOWTO | Tagged , , , , | Leave a comment

chef knife tricks: Add a node in an environment

 

Sometime during automation of a large deployment process, we have to bootstrap a node , create environment and add the node in that particular environment on the fly.

 

  1. Bootstraping :

knife bootstrap  slcn09vmf0209.us.ora.com -x root -P welcome1 -N node2

2. Create environment dynamically from inside the programme:(python here)


## Create an envtemplate with required values in it

envtemplate = """

{
"name": \""""+envname+"""\",
"description": "The master development branch",
"cookbook_versions": {
},
"json_class": "Chef:Environment",
"chef_type": "environment",
"default_attributes": {
"revrec":
{
"required_version": \""""+appVersion+"""\"

}
},
"override_attributes": {
}
}

##write the envtemplate in a file

with open("/tmp/"+envname+".json","w") as f:
f.write(envtemplate)
f.close()

## Create env from the teplate json file

subprocess.call("knife environment from file /tmp/"+envname+".json", shell=True)

3. Add the node in the environment:


knife exec -E 'nodes.find("name:node2") {|n| n.chef_environment("env209");n.save }'

 

Posted in ARTICLES, Configurtion management, DevOps, HOWTO, Programming | Tagged , , , | Leave a comment

Linux performance Monitoring Tools

There are a lot of tools used for monitoring the performance in Linux.

Here is the list of tools in one image that covers what is monitored by what.

linuxperformanceobservabilitytool

 

Posted in DevOps, Monitoring, OperatingSystem | Tagged , , | Leave a comment

Nagios Plugin Developed@NagiosExchange

Long ago, while working in one of the previous organization, there were lots of components like services and servers running in production environment. I had deployed all products one by one from scratch and the count kept on increasing. There were components like PLM Servers, DB Server, License Mgmt, internal portal, Cotainer based virtualization system and a lots.

But there was no proper tools to monitor all the components at a time. As the count kept increasing , it becomes difficult to keep an eye on UP/DOWN time of all.

So I decided to deploy Nagios Monitoring system in the Data Center and developed many plugins to use.

I have opensourced few of the plugins, which I thought can help other people in world, those may facing these kind of challenges.

Also I posted them on Nagios Exchange on 4 years ago and now they are huge success. They each are downloaded 50k+ times  and I received many thanks from many people from around the world and feel happy.

They can be found from here: https://exchange.nagios.org/directory/Owner/divyaimca/1

Posted in ARTICLES, Container, DevOps, FOSS, Monitoring, Operations, Programming, Virtualization | Tagged , , , , | Leave a comment

Chef Recipe: Oracle DB 11gR2 EE silent deploy

Chef provides a lot of flexibility and greater choice for infrastructure automation and I prefer it over others.

We should design our recipe in such a way that the our recipes without being modified can be used in any environment by maximizing the use of  attributes.

I was working on a deployment project on Linux x86-64 platform, where I had to automate all the infra components. Oracle 11g R2 EE is one of them. I will share the cookbook  here that can help many other. The recipes written here are used for silent installation of the DB using a response file after pulling the media files from a remote system.

Also the recipes are made idempotent, so that rerunning the cookbook again and again never do any damage. It automatically sets an attribute for DB installed / DB running in chef server after a successful compile -> run of the recipes.

Also the username/passwords are pulled stored and pulled from Encrypted Databag to make it more secure.

Here is the cookbook : https://github.com/kumarprd/Ora11gR2-EE-Silent-Install-Chef-Recipe

The recipes involved use below steps in sequence :

  1. setupenv.rb (It create the environment that will be used by rest of the recipes)
  2. oradb.rb (It checks the default attributes to fresh install/patch install and go further for any operations)
  3. install_oradb.rb ( Install the oracle database in ideompotent manner and sets the attributes in the server)
  4. create_schema.rb (This is application specific, but I will provide the template that can be modifed)

NOTE : Here create an encryoted databag with below json props  which are accessed inside recipes.

Follow  my other post : https://thegnulinuxguy.wordpress.com/2016/08/09/chef-create-encrypted-data-bag-and-keep-secrets/

{

“id”: “apppass”,
“ora_db_passwd”: “dbpass”,
“oracle_pass”: “orapass”

}

Any issue/suggestion are welcome.

Posted in ARTICLES, DevOps, HOWTO, Operations, Private Cloud, Programming, Public Cloud, TUTORIALS | Tagged , , , | Leave a comment