Skip to main content

Posts

Introduction to Sensu

Introduction to Sensu Sensu is a monitoring framework. Sensu Server The Sensu server schedules and publishes check execution requests to client subscriptions (via a Publish/Subscribe model), and provides a scalable event processing platform for processing check results and monitoring events. Sensu Clients  Sensu clients are monitoring agents, which are installed and run on every system (e.g. server, container, etc) that needs to be monitored. The client is responsible for registering the system with Sensu. Sensu check Sensu checks are commands executed by the Sensu client which monitor a condition (e.g. is Nginx running?) or collect measurements (e.g. how much disk space do I have left?). Sensu named aggregate Sensu named aggregates are collections of check results. Sensu events A Sensu Event is created every time a check result is processed by the Sensu server. Sensu Silencing Silencing is used to prevent handlers from being triggered based on the check ...

Install PyCharm

Install PyCharm In this tutorial we will learn how to install  PyCharm  on Ubuntu. Download WebStorm Download PyCharm from official site  https://www.jetbrains.com/pycharm/download/#section=linux Extract PyCharm Navigate terminal to the downloaded folder and run following command. tar -xvzf <downloaded-file-name> Navigate to the <PyCharm-version/bin> and following command ./pycharm.sh Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Install WebStorm

Install WebStorm In this tutorial we will learn how to install WebStorm on Ubuntu. Download WebStorm Download WebStorm from official site  https://www.jetbrains.com/webstorm/ Extract WebStorm Navigate terminal to the downloaded folder and run following command. tar -xvzf <downloaded-file-name> Navigate to the <WebStorm-version/bin> and following command ./webstorm.sh Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Node.js Events

Node.js Events Every action on a computer is an event. Node.js object can fire an event like readStream object fires events when opening and closing a file. var fs = require('fs'); var rs = fs.createReadStream('./demo.txt'); rs.on('open', function () { console.log('The file is open'); }); Events Module Node.js has a built-in module, called "Events", where you can create-, fire-, and listen for- your own events. All event properties and methods of event module are an instance of an EventEmitter object. EventEmitter Object var events = require('events'); var eventEmitter = new events.EventEmitter(); //Create an event handler: var myEventHandler = function () { console.log('I hear a scream!'); } //Assign the event handler to an event: eventEmitter.on('scream', myEventHandler); //Fire the 'scream' event: eventEmitter.emit('scream'); ...

Node.js URL Module

Node.js URL Module In Node.js  URL module used splits up a web address into readable parts. Include Node.js URL Module var url = require('url'); Parse an address with url.parse() function. Example var url = require('url'); var adr = 'http://localhost:8080/home.htm?year=2019&month=january'; var q = url.parse(adr, true); console.log(q.host); //returns 'localhost:8080' console.log(q.pathname); //returns '/home.htm' console.log(q.search); //returns '?year=2019&month=january' var qdata = q.query; //returns an object: { year: 2019, month: 'january' } console.log(qdata. january); //returns 'january' Node.js File Server Create two file named home.html and contact.html home.html <!DOCTYPE html> <html> <body> <h1>Rozgardesh</h1> <p>Education for everyone</p> </body> </html> contact.html ...

Number system

Number system (Basic) 1. Addition : The mother of all calculation. Performing addition is no big deal for anyone but doing it at a pace of 5 to 10 times faster, which is required in competitive exams like CAT is surely a heck of work.  Following method also called as number-line method discussed below enables doing addition without carry-over and with proper practice increases addition capacity multi folds. Suppose we have to add 78 and 86,  #How to progress? Start with addition of two 2 digit numbers, then try adding multiple 2 digit number and finally multiple digits numbers.  2. Subtraction : As subtraction is extension of addition, the trick is just an extension of method discussed above. Suppose we have to subtract 38 from 72, treat it as what we have to add to 38 to get 72. Again number line system comes to rescue.                First we find the number which have to be added to 38 toe...

Node.js Send Email

Node.js Send Email Node.js Nodemailer Module The Nodemailer module allowed you to send an email. Download and Install Nodemailer npm install nodemailer Import nodemailer module npm install upper-case Send an Email var nodemailer = require('nodemailer'); var transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'youremail@gmail.com', pass: 'yourpassword' } }); var mailOptions = { from: 'youremail@gmail.com', to: 'myfriend@yahoo.com', subject: 'Sending Email using Node.js', text: 'That was easy!' }; transporter.sendMail(mailOptions, function(error, info){ if (error) { console.log(error); } else { console.log('Email sent: ' + info.response); } }); Please write comments if you find anything incorrect, or you want to share more information about the topic disc...

Node.js NPM

Node.js NPM What is NPM? NPM is a package manager for Node.js packages which hosts thousands of free packages. A package in Node.js contains all the files you need for a module. Download a Package Open terminal and run npm install package-name. npm install upper-case Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.   

UUID Lua

UUID Lua In this post, we will write a UUID generator in lua programming language. local function getUUID() local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' return string.gsub(template, '[xy]', function (c) local v = (c == 'x') and random(0, 0xf) or random(8, 0xb) return string.format('%x', v) end) end Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Node.js HTTP Module

Node.js HTTP Module In this tutorial, we will learn about Node.js HTTP module and understand how out code working that we have written in  Getting started with node.js . Node.js has a built-in module called HTTP, which allows Node.js to transfer data over the http. To include the HTTP module, use the require() function. var http = require('http'); Node.js as a Web Server The HTTP module can create an HTTP server that listens to server ports and gives a response back to the client. we used createServer() method to create an HTTP server. var http = require('http'); //create a server object: http.createServer(function (req, res) { res.write('Hello World!'); //write a response to the client res.end(); //end the response }).listen(3000); //the server object listens on port 3000 Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.