Skip to content

Instantly share code, notes, and snippets.

View ingmarioalberto's full-sized avatar

SysAdminMarioAlberto ingmarioalberto

View GitHub Profile
@ingmarioalberto
ingmarioalberto / lvgen.sh
Last active August 21, 2022 02:59
generate lvm and add to etc/fstab
#!/bin/bash
die () {
if [ -z "$1" ]
then
echo "something went very wrong..."
else
echo "NOK:${1}"
fi
exit 1
}
@ingmarioalberto
ingmarioalberto / netstat-map.sh
Last active March 10, 2023 20:43
Grabs via netstat incoming outgoing and local connections
#!/bin/bash
FLAGFILE=/tmp/go-ahead.txt
echo 1 >${FLAGFILE}
while [ 1 ]
do
FECHORA="$(date +'%Y-%m-%d')"
LOG="/var/log/${FECHORA}.netstat.txt"
INC="/var/log/${FECHORA}.netstat-inc.txt"
OUT="/var/log/${FECHORA}.netstat-out.txt"
LOC="/var/log/${FECHORA}.netstat-loc.txt"
@ingmarioalberto
ingmarioalberto / netstat-anal.sh
Last active March 10, 2023 00:06
Prints a summary of inbound, outbound and local connections with netstat-map output
#!/bin/bash
usage () {
echo "$0 <incoming-netstat-log> <outgoing-netstat-log> <local-netstat-log> [machine-tag]"
echo "example:"
echo "$0 *.netstat-inc.txt *.netstat-out.txt *.netstat-loc.txt"
echo "$0 *.netstat-inc.txt *.netstat-out.txt *.netstat-loc.txt machine-name-or-something "
exit 0
}
@ingmarioalberto
ingmarioalberto / homolog.sh
Created October 4, 2022 20:17
Filter out homolog IP address, -i = invert
#!/bin/bash
HOMO="\([0-9]\.\|[1]\{,1\}[0-9]\{2\}\.\|2[0-4][0-9]\.\|25[0-5]\.\)\{3\}\([0-9]\|[1]\{,1\}[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)"
LAN10="10\(\.[0-9]\|\.[1]\{,1\}[0-9]\{2\}\|\.2[0-4][0-9]\|\.25[0-5]\)\{3\}"
LAN172="172\.\(1[6-9]\|2[0-9]\|3[01]\)\.\([0-9]\.\|[1]\{,1\}[0-9]\{2\}\.\|2[0-4][0-9]\.\|25[0-5]\.\)\([0-9]\|[1]\{,1\}[0-9]\{2\}\|2[0-4][0-9]\|25[0-5]\)"
LAN192168="192.168\(\.[0-9]\|\.[1]\{,1\}[0-9]\{2\}\|\.2[0-4][0-9]\|\.25[0-5]\)\{2\}"
LANSELF="127.0.0.1"
LANWEIRD="169.254.169.254"
case ${1} in
"-i")
@ingmarioalberto
ingmarioalberto / TLF_LFS162x.txt
Last active December 1, 2022 18:35
Introduction to DevOps and Site Reliability Engineering
TLF (LFS162x) (Prof. Gourav Shah)
Introduction to DevOps and Site Reliability Engineering
DevOps = Developer & Operations (Areas)
SRE = Site Reliability Engineer
---
Needs: Bridge Gap between ( Faster Dev vs Waterfall practices )
DevOps via:
( Modern principles
Practices
Automation tools ) --PATH--> Ops into Agile Area => Faster software delivery.
https://developers.facebook.com/docs/whatsapp/on-premises/overview
BSP: Business Solution Provider
WhatsApp Business Platform On-Premises API
Requirements:
- Display name:
1. how to set it up: https://www.facebook.com/business/help/338047025165344/
2. the formatting guidelines: https://www.facebook.com/business/help/757569725593362
3. updating it: https://www.facebook.com/business/help/378834799515077
@ingmarioalberto
ingmarioalberto / gist:dc5b78c3a49d0b51d1d82beece82c945
Created November 18, 2022 00:33
nmtui allow manage ethernet ubuntu (device is strictly unmanaged)
Append except:type:ethernet at the end of the line unmanaged-devices...etc
systemctl restart NetworkManager
@ingmarioalberto
ingmarioalberto / gist:69049495f6c1a619f1718002aafcd6c2
Created December 31, 2022 07:34
todo... nagios ILO monitor
curl --location --insecure -u xxx:yyyy --silent --connect-timeout 10 X GET "https://10.1.1.1/redfish/v1/Systems/1/" | jq '.["Oem"]["Hpe"]["AggregateHealthStatus"]'
>>
{
"AgentlessManagementService": "Ready",
"BiosOrHardwareHealth": {
"Status": {
"Health": "OK"
}
},
"FanRedundancy": "Redundant",
zdump -v America/Mexico_City | grep $(date +"%Y")
America/Mexico_City Sun Apr 4 07:59:59 2021 UT = Sun Apr 4 01:59:59 2021 CST isdst=0 gmtoff=-21600
America/Mexico_City Sun Apr 4 08:00:00 2021 UT = Sun Apr 4 03:00:00 2021 CDT isdst=1 gmtoff=-18000
America/Mexico_City Sun Oct 31 06:59:59 2021 UT = Sun Oct 31 01:59:59 2021 CDT isdst=1 gmtoff=-18000
America/Mexico_City Sun Oct 31 07:00:00 2021 UT = Sun Oct 31 01:00:00 2021 CST isdst=0 gmtoff=-21600
-------------------
To remove DST settings you have to know your time shift and reverse it, so for example
for America/Mexico_City being it: -6
```
# rm -f /etc/localtime && ln -s /usr/share/zoneinfo/Etc/GMT+6 /etc/localtime
@ingmarioalberto
ingmarioalberto / gist:e72a3df85a809c52a0296a7ecadb7aff
Created March 22, 2023 18:16
subscription-manager refresh shows a Traceback and "Error updating system data on the server" check: /var/log/rhsm/rhsm.log etc
Something lik:
Traceback (most recent call last):
File "/sbin/subscription-manager", line 9, in <module>
load_entry_point('subscription-manager==1.24.26', 'console_scripts', 'subscription-manager')()
File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 86, in main
return managercli.ManagerCLI().main()
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2989, in main
ret = CLI.main(self)
File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
return cmd.main()