2020年6月23日 星期二

Get disk usage via snmpwalk

Reference:
[網管應用] Windows系統的snmp測試工具 - snmpwalk
Install or configure SNMP for Windows
Windows 透過 snmp 監控系統資源的方法
Linux系統監控常用到的SNMP OID
How do you get snmpwalk to return numeric oids instead of MIB resolutions?

安裝 snmpwalk
for Linux: yum install yum install net-snmp-utils
for Windows: 從這裡下載 https://www.snmpsoft.com/cmd-tools/snmp-walk/

Windows server 設定 snmp service
Install or configure SNMP for Windows

Linux 設定 snmp service
yum install net-snmp
vi /etc/snmp/snmpd.conf
增加一行 view    systemview    included   .1
將 disk / 10000 的 # 拿掉
service snmpd restart

Windows Disk usage 指令
snmpwalk -v2c -c public hostname .1.3.6.1.2.1.25.2

Linux Disk Usage 指令
snmpwalk -v 1 -c public hostname .1.3.6.1.4.1.2021.9.1

2020/7/4 update:
Reference: snmpwalk parameter

snmpwalk 執行後,查出一部分資料就Timeout: No Response from。(如下圖)
加上 -t 10 減少 timeout 狀況。
Ex: snmpwalk -v2c -t 10 -c public hostname .1.3.6.1.2.1.25.2



2020年6月20日 星期六

excel odbc 驅動程式管理員 找不到資料來源名稱且未指定預設的驅動程式

Error:
odbc 驅動程式管理員 找不到資料來源名稱且未指定預設的驅動程式


Cause:
沒有設定Database。並不是驅動程式問題。

Solution:
SQL Server Native Client 11.0 ODBC Driver connection strings

Driver=SQL Server;Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;





2020年6月15日 星期一

outlook 開啟附檔 沒有回應

Reference:
「Outlook not responding」錯誤或在開啟檔案或傳送電子郵件時 Outlook 發生凍結

狀況:
Outlook 開啟附檔時,顯示 沒有回應,卡住幾分鐘後附檔才打開。

解法:
調整 Outlook 增益集。
感覺卡住像是在檢查病毒,所以先把防毒的 Add-on 關閉測試,一猜就中!
重開 Outlook 再測試附檔已經不會卡住了。


HTC Desire 12S 沒聲音

這一陣子常漏接訊息,發現是手機會變成收到訊息或來電沒聲音。

送修手機很麻煩,找到網路上的解法:
插耳機,等手機出現耳機符號在拔除,就會恢復。

試過這方法的確有效,但是要隨身攜帶耳機很麻煩。

找到另一方法:
在 LINE 開一個自己一人的群組,沒聲音時進群組開通話,退出後就有聲音了。

2020年6月14日 星期日

Linux ntpdate 手動更新系統時間

ntpdate <timeserver>
hwclock -w

CentOS 7 開機自動執行

Reference:
解決 CentOS 7 開機不啟動 rc.local
設定 CentOS 7 開機時自動執行重啟網卡指令

systemctl enable rc-local.service
systemctl start rc-local.service
systemctl status rc-local.service

chmod +x /etc/rc.d/rc.local

將要開機自動執行的指令寫在 /etc/rc.d/rc.local

Solaris 9 修改 IP, Hostname

Reference:
How to change hostname in Solaris 8, 9 and 10

edit files:
/etc/hosts
/etc/nodename
/etc/hostname.<nic card>    Ex: hostname.le0

2020年6月6日 星期六

Redhat 3 轉虛擬機

Reference:
Solved: Linux Red Hat P2V problem. Cannot boot after conversion. Solution below in attachment
轉載(Centos Linux Rescue 修復方式)
Virtual machine does not boot after being converted from a physical Red Hat machine (1002402)

原作者的圖文操作步驟

Linux Red Hat 3 Physical To Virtual Conversion – Vmware

1. On the machine you will be performing the conversion open VMware vCenter Converter Standalone Client.
After several attempts with various versions, my preference for P2Ving old Linux servers is 4.0.1


2. Specify the source machine to be virtualized. Add the IP and account credentials ensuring you select Linux.

3. Add the IP address, username and password of the ESX host your physical server will be virtualized to.

4. Choose the name and the Datastore as required.


5. Here you can modify disk settings, quantity of CPU’s, network cards, advanced options and most importantly, the VMware Helper Settings.
After playing around with the disk settings, I saved over 80GB by reducing the size of the disks to a more reasonable level. Also don’t worry about the conversion time. It’ll be much quicker than shown here.

6. Add a helper on the same vlan as the VM will reside. I don’t use auto as I can’t get it to work.

7. Time to read through the summary of your settings for the conversion then select ‘Finish’.

8. The job then moves into the ‘Running’ state


9. Open the vSphere Client, navigate to the vDatacenter the ESX host you selected reside in and open the ‘Console’ of the VM. You can see the creation process up to a certain point. Important if it is going to fail to know where about in the process.
10. Once it has completed the P2V process, open the ‘Edit Settings’ choice.

Go to ‘Boot Options’ and choose to enter the ‘BIOS Settings’ on start up. You may choose to disable networking (under the Hardware tab) temporarily. Advisable if this VM is to be the physical server’s replacement with same IP even though in ‘Linux Rescue’ it asks if you want to enable networking I don’t want any conflicts with the physical production server that is still running.

11. Power on the VM

12. The VM will boot into Bios. Change the boot settings from below to have ‘CD-Rom Drive’ above ‘Hard Drive’
This will allow you to boot to the OS ISO to start the ‘Linux Rescue’ process.

13. Choose the ‘Exit’ tab and ‘Exit Saving Settings’

14. Choose the CD\DVD Drive option and connect to the location of your Linux OS ISO\Disk. I prefer to make an ISO of the physical disk and add it to a Datastore.


15. Highlight the OS and click ‘OK’

16. Once at the initial screen type ‘linux rescue’ and press enter.

17. As stated earlier, I choose ‘No network connection’. I don’t want a conflict with the running physical server. It is not needed to get the server working as a VM.

18. Choose ‘Continue’

19. Once it is finished you will see the below message, just select ‘OK’.

20. You can now mount the image with the following command. "chroot /mnt/sysimage"

21. Run ‘kudzu’ to scan for hardware changes and remove old hardware.



You will want to ‘remove configuration’ for all the old physical devices.

22. Now you will have obtained access to the command line.
Time to check the name and version of your Linux OS.
View the contents of /lib/modules as below then run the following command to rebuild the ramdisk installer:
Mkinitrd –v –f initrdxxxx.img xxxx
i.e. I used the following: mkinitrd –v –f initrd2.4.9-e.34smp.img 2.4.9-e.34smp



23. Once complete you will need to view/edit your grub.conf.
I made a copy of the original and left it in the /boot/grub folder prior to modifying it.

24. On the four servers I have successfully converted the same occurred on all of them.
All the entries in the grub.conf were (hd0,2) whereas they needed to be changed to (hd0,1) which I did in VI.


25. Save the modified file and shutdown the VM.
Disconnect the Linux ISO from the VM and restart the VM.
If you have been successful, you’ll see the following screen. I booted 3rd one down successfully.

26. After the server goes through its initialisation phase you will be taken to the normal command prompt.

27. Login as per normal. You may need to make some changes to the system or have a DBA/Apps guy ensure any of their installed components are working correctly. Apart from that, you’re done! Congratulations 