Giter Club home page Giter Club logo

scripts's Introduction

Scripts

This project provides API endpoints to get my often-used scripts.

Hosted on HEROKU:

Endpoints:

Script Endpoint: https://scripts.mahirchavda.com/<script_name>

Currently available script_names are:


  • returns the bash commands to install miniconda

Example to install miniconda

curl https://scripts.mahirchavda.com/install_miniconda | bash
  • returns the alias for often used splunk cli commands

To configure the alias run below command in your linux shell:

curl 'https://scripts.mahirchavda.com/splunk_alias' >> ~/.bashrc && source ~/.bashrc

Splunk cli commands and it's alias

Purpose Splunk CLI command Splunk alias
Restart Splunk /opt/splunk/bin/splunk restart rr
Start/Stop/Restart Splunk /opt/splunk/bin/splunk start/stop/restart sp start/stop/restart
cd into the Splunk apps folder cd /opt/splunk/etc/apps app
cd into the Splunk log folder cd /opt/splunk/var/log/splunk log
cd into Splunk modinput folder cd /opt/splunk/var/lib/splunk/modinputs modinput
To just clean eventdata /opt/splunk/bin/splunk clean eventdata -f sclean
To clean all the indexed eventdata; we have to perform below steps:
1) stop splunk
2) clean indexes data
3) start splunk
1) /opt/splunk/bin/splunk stop
2) /opt/splunk/bin/splunk clean eventdata -f
3) /opt/splunk/bin/splunk start
ssclean
To clean all the indexed eventdata, remove logs and remove modinputs; we have to perform below steps:
1) stop splunk
2) clean indexes data
3) cd into log folder and remove all files
4) cd into modinput folder and remove all files
5) start splunk
1) /opt/splunk/bin/splunk stop
2) /opt/splunk/bin/splunk clean eventdata -f
3) cd /opt/splunk/var/log/splunk && rm -rf *
4) cd /opt/splunk/var/lib/splunk/modinputs && rm -rf *
5) /opt/splunk/bin/splunk start
sssclean
1) Stop Splunk
2) Navigate to the Splunk log folder
3) Delete all files and folder
4) Navigate to the Splunk modinput folder
5) Delete all files and folder
6) Clean all the indexed data
7) Navigate to the Splunk apps folder
8) Remove Splunk_TA_cisco-ucs app
9) Start Splunk
1) /opt/splunk/bin/splunk stop
2) cd /opt/splunk/var/log/splunk
3) rm -rf *
4) cd /opt/splunk/var/lib/splunk/modinputs
5) rm -rf *
6) /opt/splunk/bin/splunk clean eventdata -f
7) cd /opt/splunk/etc/apps
8) rm -rf Splunk_TA_cisco-ucs
9) /opt/splunk/bin/splunk start
sp stop && log && rm -rf * && modinput && rm -rf * && sclean && app && rm -rf Splunk_TA_cisco-ucs && sp start

The splunk_alias endpoint also supports two parameters: splunk_home and alias_suffix

param default value description
splunk_home "/opt/splunk" specify splunk home path
alias_suffix "" specify suffix if you have mulitple splunk installed and you want to configure splunk alias for both the splunk

Example:

$ curl 'https://scripts.mahirchavda.com/splunk_alias?splunk_home=/opt/splunk2&alias_suffix=2' >> ~/.bashrc && source ~/.bashrc

API Response:

### START splunk_alias
# Make Splunk CLI Commands Shorter
sp2_home="/opt/splunk2"
export sp2_home
alias sp2="$sp2_home/bin/splunk"
alias log2="cd $sp2_home/var/log/splunk"
alias modinput2="cd $sp2_home/var/lib/splunk/modinputs"
alias app2="cd $sp2_home/etc/apps"
alias rr2="sp2 restart"
alias sclean2="sp2 clean eventdata -f"
alias ssclean2="sp2 stop && sclean2 && sp2 start"
alias sssclean2="sp2 stop && sclean2 && log2 && rm -rf * && modinput2 && rm -rf * && sp2 start"
### END splunk_alias

scripts's People

Contributors

mahirchavda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.