Posts

Sending Alert Mail on Shutdown and Boot up!

Hello!  In this time, I want to run an custom application as a service on my LINUX and want to run with specific user to follow some security policies. Can customize your actionable scripts with this if  your are working on systemd related machines. Need to be running Postfix service before the demonstration! So let me into demonstration about sending system shutdown and startup alert mail to system administrator. I intend this to let system admin know as a proof of machine power state in an incident.  Firstly, must have actionable script or application that you want to run. demo use mail command as a service. I have two scripts. one for system up and one or system down. startupmail.sh was as follow: #!/bin/bash DATE=$(date '+%Y-%m-%d %H:%M:%S') $(mail -s "$HOSTNAME - System Start" exampleuser@example.com <<< "$HOSTNAME was started at $DATE") shutdownmail.sh was as follow: #!/bin/bash DATE=$(date '+%Y-%m-%d %H:%M:%S'

Using Zabbix Inventory Script for AWX Ansible Tower Inventory

Image
Hello! Have a nice day. Today I am going to show you how to use Zabbix Server as Inventory Source for Ansible AWX Tower. As you know Ansible Tower allow you to set not only static inventory but also dynamic inventory. Dynamic Inventories executable programs that collect information from some external source and output the inventory in JSON format. Now, I will use Zabbix Monitoring Server as my external source to fetch inventory. As prerequisites,   we need   Ansible Tower or AWX Ansible Tower   Zabbix Server   And need to install Zabbix-api module.   Zabbix-api can download  Here . $pip install zabbix-api-version.tar.gz As first Step, we are going to fetch zabbix.py which is dynamic inventory script contributed for Ansible project.  Copy and paste the script in TowerUI/Inventory Scripts/CREATE INVENTORY SCRIPT /CUSTOM SCRIPT https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/zabbix.py Then update self value and save INVENTORY SCRIPT a

How to read EMAIL from GMAIL API

Image
Today ကျနော် email တေကို gmail api ကနေ လှမ်းဖတ်မယ့် အကြောင်းလေး sharing လုပ်ပေးချင်ပါတယ်။ Gmail API ကတော့ gmail feature ကို application မှာထည့်သုံးလို့ရအောင် လုပ်ပေးပါတယ်။ Integration လုပ်တဲ့အခါ process တခုပီးလို့ progress တခုအနေနဲ့ mail ပို့ပီး notify လုပ်တာ သို့ email ကနေ information တခုခု လိုချင်တဲ့အခါမျိးမှာ သုံးတတ် ကြပါတယ်။ ပထမဆုံး အဆင့် အနေနဲ့ Gmail API  နဲ့တွဲအလုပ်လုပ်နိုင်ဖို့  client secret key ရှိရပါမယ်။ အောက်မှာ key ထုတ်ပုံအဆင့်ဆင့် ကို လေ့လာကြည့်ပါ့မယ် ခင်ဗျာ။ Generating client credentials to access GMAIL API google developer console မှာ ကျနေယ် စမ်းမယ့် integration program အတွက် project အရင်ဆောက်ကပါတယ်။ please click /SELECT/+NEW PROJECT အဲ့နောက် Gmail API service ကိုထည့်ဖို့ + ENABLE APIS AND SERVICES ကိုသွားပါတယ်။ ပီးတော့ Gmail API ကို ENABLE လုပ်ပါတယ်။ နောက် ကျနော့် Integration program နဲ့လှမ်းချိတ်ဖို့ client secret key ထုတ်ပါတယ်ခင်ဗျာ။ အဲ့ key ကတဆင့် Gmail API ကို authentication လုပ်ပီး ကျနော် လိုချင်တာနေ လှမ်ခိုင်းပါမယ်။ Please click from Credentials Me

Time to leave Google and Duck Duck Go waves to you

Image
Hello, nice to meet you again. This time, i just want to share my knowledge to you guys.         Yes, I am a tech guy. I daily works around with tech.  Google — Yes, i admit it — One of my teacher who finds me a lot of information to me.        After many time spending with Google, I found myself my search and related words are automatically popping and recommending when i typed something in search box. They are tracking me, they recommend me places and food based on my location.  Uh — — — this is not good lah. 😂 Then, one day one of my co-workers recommend me to use Duck Duck Go . At first i thought the name is so funny and interesting, then I started using it. Wow — — it’s good enough lah. 🙋 Like their quote — ‘DuckDuckGo — Privacy, simplified. ’ It is so simple and duck duck go doesn’t track your search and it saves your privacy and security.       After using around 2 months, I prefer it because Duck Duck Go does not track your history in orde

cisco csr1000v ios upgrade or downgrade

Image
Good Morning! Today Let me share about upgrading or downgrading ios using ansible. Original idea credit to eanylin ( https://github.com/eanylin ). I follow rule for ios upgrade guide from cisco ( https://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/configuration/b_CSR1000v_Configuration_Guide/b_CSR1000v_Configuration_Guide_chapter_01001.html ) and add some intelligence twisted code to each four roles. Hope you like it.  Please check this out 😉 and enjoy! https://github.com/tproximus/cisco-csr1000v-ios-upgrade-downgrade Have a nice day!

How to create Slack Webhooks

Image
Today let me show you how to generate a slack webhook. Slack webhooks is  a simple way to post messages from external sources into Slack. My steps to get slack webhook were as follow: Step1) I created slack app by merging one of my created slack workspace at this URL: https://api.slack.com/apps Step2) go to “Incoming Webhooks” to create webhook. Step3) active incoming webhooks Step4) create new webbook to workspace or merge webhook to channel Step5) Then select a channel from your workspace. Step6)finally got webhook url to work with slack api. Step7) can sent test message to your channel by using curl. Note: TDK572UAW/BLGRR1X6X/C0etNQsdetn06OH3qE9rqsPx used to push slack notification via Ansible slack module $curl -X POST -H 'Content-type: application/json' --data '{"text":"Hello, World!"}' https://hooks.slack.com/services/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 PS: I del

Python3 - Basic Knowledge of using Dictionary

Image
<Zawgyi> Hello all again  ပါ😃  စာမ ေရးတာၾကာပီဆိုေတာ့ အရင္ဆံုး Draftထဲက အက်န္ေလးရွင္းေပါ့ ဒီတ ေခါက္ ေၿပာမွာက ေတာ့ အခုခ်ိနိမွာ dataေတြမ်ားလာပီ အဲ့လိုပဲ တဖက္မွာ ကိုယ့္ရဲ႕ systemမွာ appတခု script ျဖစ္ျဖစ္မွာ Data ေတြကို ဘယ္လို structureက်က် သိမ္းမလဲဆိုတာ စဥ္းစားစရာျဖစ္လာပီ ကိုယ္က လက္ရွိ Python နဲ႔က်င္လည္ေနတာ့ ဒီမွာ dataေတြကို ဘယ္လို structureက်က်သိမ္းႏိုင္လဲ ေျပာျပ သြားပါမယ္..... Python မွာ mainly အေနနဲ. data structure 4မ်ိဴး ရွိပီး - list, dictionary, tuples and sets! ဒီtopic မွာတော့ dictionary ကိုဘယ္လို သံုးပီး Dictionary, List  ဘယ္လို ကြာၿခားလဲရယ္ ရွင္းျပသြားပါ့မယ္ How to use and declare and access Dictionary           ဒီ topic မွာ dictionary ႀကီးကို စာနဲ႔ ရွင္းျပတာထက္ ပိုျမင္ေအာင္ exampleေလးနဲ႔ေပ့ါ ကိုယ္ေတြ dictionary ၾကည့္ရင္ alphabetနဲ႔ရွာၾကတယ္ေလ. တနည္းအားျဖင့္ ဒါက keyေပါ့ keyဆိုတ့ဲ alphabet နဲ႔ရွာမွ သူ႔ရဲ႕ value- wordရဲဲ့ meaning ကိုသိတာေလ          အဲ့လိုပါပဲ python မွာလည္း data ေတြသိမ္းတဲ့ အခါမွာ သူ႔အတဲြနဲ႔သူ ျပန္ပီး Analysis လုပ္တဲ့အခါ တူရာ keywordနဲ႔ ျပန္ဆဲြ