Friday, October 25, 2019

Solaris Server SNMP

Monitoring Solaris Server services using custom OID's

Assumption: SNMP server side configuration is completed

# vi /etc/sma/snmp/snmpd.conf
exec pscheduler_snmpd /bin/bash /usr/bin/Scheduler_snmpd.sh
 

Place the scripts under /usb/bin/
# cat /usr/bin/Scheduler_snmpd.sh
count=`ps -ef | grep BBL |egrep -i 'CHECK1|CHECK2'|wc -l` > /dev/null
if [ $count -eq 2 ]
then
   echo "1"
else
   echo "0"
fi


Set the permission of the script to  (would prefer only execute permission)
#chmod 777 /usr/bin/Scheduler_snmpd.sh

Restart the SNMP service on the Solaris server by running command
 #svcsadm restart sma




 












 


 




Tuesday, September 17, 2019

Power shell to access Internet behind a proxy server with authentication

  • $Creds=Get-Credential
  •  $proxy = New-Object System.Net.WebProxy
  • $proxy.Address = [uri]"http://xxx.xxx.xxx.xxx:xx"
  • $proxy.Credentials = $Creds
  • [System.Net.WebRequest]::DefaultWebProxy = $proxy
  • Invoke-WebRequest -Uri "https://google.com" -UseBasicParsing

Useful links to refer.
  1. http://woshub.com/using-powershell-behind-a-proxy/
  2. https://stackoverflow.com/questions/38005341/the-response-content-cannot-be-parsed-because-the-internet-explorer-engine-is-no 

Monday, July 08, 2019

Custom Monitoring using SNMP Script for a specific service. - The script is written to avoid false alerts generated due to custom monitoring. 

This will trigger multiple SNMP monitoring attempts (3 times) before calling the failure.



a=0
while [ $a -lt 3 ]
do
   snmpwalk -v2c -c 'XXXXXsecretkeyXXXXXXX' | grep "customvalue" >> /dev/null
   if [ $? = 0 ]; then
        echo "80"
        exit
   else
        sleep 3
        a=`expr $a + 1`
   fi
        echo "0"
done
-