Skip to content

Instantly share code, notes, and snippets.

# Complete Guide: Creating a Custom Foreman Plugin with REST API
=======================================================
Table of Contents:
-----------------
1. Directory Structure
2. Plugin Files
3. API Implementation
4. Database
5. Installation
Foreman Custom API for MCO Tasks
================================
1. Enhanced Controller Logic (app/controllers/foreman_mco_tasks/tasks_controller.rb):
module ForemanMcoTasks
class TasksController < ApplicationController
# Skip CSRF token verification for API calls
skip_before_action :verify_authenticity_token, only: [:execute]
#!/bin/bash
## Assigned Variable
DOMAIN_HOME=
ADMIN_SERVER_LOG=/tmp/admin.log
NODEMANAGER_LOG=/tmp/nodemgr.log
WL_HOME=
SERVER_LOG=
@kkarthee
kkarthee / v2.sh
Created September 30, 2024 01:38
# Set WebLogic environment variables
export DOMAIN_HOME=/weblogic/Oracle/Middleware/Oracle_Home/user_projects/domains/dlpuatapp_domain/ # Change this to your domain path
export WL_HOME=/weblogic/Oracle/Middleware/Oracle_Home/oracle_common/common/ # Change this to your WebLogic installation path
# Paths to logs
ADMIN_SERVER_LOG=$DOMAIN_HOME/servers/AdminServer/logs/AdminServer.log
NODEMANAGER_LOG=$DOMAIN_HOME/servers/logs/NodeManager.log
MANAGED_SERVER1_LOG=$DOMAIN_HOME/logs/ManagedServer1.log
MANAGED_SERVER2_LOG=$DOMAIN_HOME/logs/ManagedServer2.log
#!/bin/sh
#
# nodemgr Oracle Weblogic NodeManager service
#
# chkconfig: 345 85 15
# description: Oracle Weblogic NodeManager service
# The script needs to be saved as /etc/init.d/nodemgr and then issue chkconfig –add nodemgr as root
### BEGIN INIT INFO
# Provides: nodemgr
import subprocess
import shlex
def fetch_processes(command):
proc = {}
"""Fetches process information using the specified command.
Args:
command: The command to execute (e.g., "ps aux").
GLOBAL]
[DEV]
CONSOLE_USER_NAME=weblogic
CONSOLE_PASSWORD=weblogic11
NODE_MANAGER_IP=192.168.1.40
NODE_MANAGER_PORT=5301
DOMAIN_NAME=domainName
DOMAIN_PATH=/dir0/dir1/dir2/domainName
@kkarthee
kkarthee / wls.py
Created September 17, 2024 16:12
check port and process details
import argparse
from pprint import pprint as pp
# from running_process import running_process
# import get_running_process
from get_running_process import get_running_process
### Argumnets where we passing the values as part of script )
arg_parser = argparse.ArgumentParser( description='This script helps to perform the given action on Weblogic node')
arg_parser.add_argument('--action',choices = ['running-proc','start','stop','restart','check'], required = True, help='Mention what action need to perform using this script')
arg_parser.add_argument('--env',choices = ['PROD','DEV'], required = True, help='Mention the environment name ')
args = arg_parser.parse_args()
@kkarthee
kkarthee / get_running_process.py
Created September 17, 2024 16:09
fetch all the process and port details using python
import psutil
from pprint import pprint as pp
def get_running_process(proc_name,cmd_line):
import psutil
# """
# Gets a list of all running processes on the server.
#
# Returns:
@kkarthee
kkarthee / tmux.conf
Created May 8, 2020 02:20 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000