Sunday, January 20, 2019

HP Server logical drive creation - Logical Drive 06 failed



1)hpssacli ctrl all show config |grep -i failed

[root@server1 ~]# hpssacli ctrl all show config |grep -i failed
      logicaldrive 3 (2.7 TB, RAID 0, Failed)
      physicaldrive 1I:1:11 (port 1I:box 1:bay 11, SATA, 3 TB, Failed)
      logicaldrive 6 (2.7 TB, RAID 0, Failed)------------------------------------------------>need to fix this
[root@server1 ~]#


2) hpssacli ctrl slot=0 ld 6 show
[root@server1 ~]# hpssacli ctrl slot=0 ld 6 show

Smart Array P420i in Slot 0 (Embedded)

   array F

      Logical Drive: 6
         Size: 2.7 TB
         Fault Tolerance: 0
         Heads: 255
         Sectors Per Track: 32
         Cylinders: 65535
         Strip Size: 256 KB
         Full Stripe Size: 256 KB
         Status: Failed
         Caching:  Enabled
         Unique Identifier: 600508B1001CF0EFCDFA07B1FBB2832C
         Disk Name: /dev/sdf
         Mount Points: /data/5 2.7 TB
         OS Status: LOCKED
         Logical Drive Label: A4AD5B765001438026531CB0  D8C8
         Drive Type: Data
         LD Acceleration Method: Controller Cache

[root@server1 ~]#



3)hpssacli ctrl slot=0 ld 6 modify reenable forced

4) hpssacli ctrl slot=0 ld 6 show

5)umount /data/5

6)fsck.ext4 -fy /dev/sdf1

7)dumpe2fs -h /dev/sdf1 | grep -e state -e checked

8)mount /data/5

9)df -Th /data/5

10) hpssacli ctrl slot=0 ld 6 show

Friday, January 18, 2019

CIFS mount on linux server


This the following step use mount cifs on linux server.


1) Create fstab entry

//<servername>/<path/ /<mount-point>   cifs _netdev,gid=,uid=,credentials=/root/.password,sec=ntlmsspi 0 0


2) Create /root/.password file

[root@test ~]# cat /root/.password
username=testuser
password=2pass02dd

Check_MK downtime Powershell script

This for Check_MK downtime bash script from command line

#Set downtime for check_mk hosts
#Powershell -noprofile -executionpolicy bypass -file .\set_downtime_check_mk.ps1 ##Cmd to run script
#create file servername.txt and write all the hostname that need to set downtime

param(
        [Parameter(Mandatory=$true,HelpMessage="Number of minutes for downtime",Position=2)]
            $Duration,
        [string]$NagiosURL="http://example.com/checkmk/check_mk/view.py"         
       
    )


$Comment = "Powereshell+Automated+Downtime"
$Servers = Get-Content -Path servername.txt
$i = 0

Foreach($Server in $Servers){

#These are needed attributes for issuing the commands, but they don't actually show up anywhere else.

$NagiosCommand= "?_do_confirm=Yes&_do_actions=yes&_transid=-1&view_name=hoststatus&site=&_ack_sticky=on&_ack_otify=off&output_format=JSON&_username=<username>&_secret=<token>&_down_comment=$Comment&_down_from_now=From+now+for&_down_minutes=$Duration&host=$Server"

$Uri = "$NagiosURL$NagiosCommand"
$i = $i +1

$request = Invoke-WebRequest -Uri $Uri
    #Determine if the command executed properly
    $Success = Select-String -InputObject $request.Content -Pattern "MESSAGE: Successfully sent 1 commands" -SimpleMatch
    if($Success){
         Write-Host "$i)Passed: $Server Downtime command successfully submitted" -ForegroundColor Green
    }else{
         Write-Host "$i)Failed: $Server Downtime command Failed" -ForegroundColor Red
    }
 
}

Create rpm and deb using fpm

Create rpm and deb using fpm  fpm -s dir -t rpm -n unbound-exporter -v 1.0 --prefix /usr/bin unbound_exporter   fpm -s dir -t rpm -n unbound...