> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orbitflare.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getHealth

> Düğümün mevcut sağlık durumunu döndürür

## Parametreler

Bu metod herhangi bir parametre almaz.

## Yanıt

<ResponseField name="result" type="string">
  Aşağıdaki durum değerlerinden biri:

  * `"ok"`: Düğüm sağlıklı ve güncel
  * `"behind"`: Düğüm belirli sayıda slot gerisinde
  * `"unknown"`: Düğüm sağlığı belirlenemiyor
</ResponseField>

## Kod Örnekleri

### Temel İstek

```bash theme={null}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getHealth"
}'
```

### Alternatif HTTP GET İsteği

```bash theme={null}
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY/health
```

### web3.js Kullanımı

```typescript theme={null}
import { Connection } from '@solana/web3.js';

const connection = new Connection('https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY');

const health = await connection.getHealth();
console.log('Node health:', health);

// Example: Check if node is healthy
const isHealthy = health === 'ok';
if (!isHealthy) {
  console.warn('Node is not healthy:', health);
}
```

## Notlar

1. Bu metod genellikle yük dengeleyici sağlık kontrolleri için kullanılır
2. `/health` HTTP GET uç noktası aynı bilgiyi sağlar
3. Bir düğüm, en son küme slotundan `HEALTH_CHECK_SLOT_DISTANCE` slottan fazla gerideyse "behind" olarak kabul edilir
4. "unknown" durumu genellikle düğümün başlatıldığını veya sorun yaşadığını gösterir

## En İyi Uygulamalar

1. Temel sağlık izleme için bu uç noktayı kullanın
2. Sağlık durumuna göre devre kesiciler uygulayın
3. Belirli sağlık metrikleri için daha ayrıntılı metodlar kullanmayı düşünün:
   * Yazılım sürümü için `getVersion`
   * Slot ilerlemesi için `getSlot`
   * Blok yüksekliği için `getBlockHeight`
4. Sağlık kontrolleri için uygun zaman aşımı değerleri belirleyin
5. Tüm olası yanıt değerlerini yönetin

## Yaygın Hatalar

| Kod    | Mesaj               | Çözüm                                               |
| ------ | ------------------- | --------------------------------------------------- |
| -32601 | Method not found    | Bir Solana RPC düğümüne bağlı olduğunuzu doğrulayın |
| -32603 | Internal error      | Düğüm sorun yaşıyor olabilir                        |
| 503    | Service Unavailable | Düğüm istekleri işlemeye hazır değil                |

## Kullanım Senaryoları

1. **Yük Dengeleyici Yapılandırması**
   ```nginx theme={null}
   location /health {
     proxy_pass http://backend;
     proxy_next_upstream error timeout http_503;
   }
   ```

2. **Sağlık İzleme**
   ```typescript theme={null}
   async function monitorHealth(endpoint: string) {
     const connection = new Connection(endpoint);
     try {
       const health = await connection.getHealth();
       if (health !== 'ok') {
         alertNodeUnhealthy(endpoint, health);
       }
     } catch (error) {
       alertNodeError(endpoint, error);
     }
   }
   ```

3. **İstemci Taraflı Yük Dengeleme**
   ```typescript theme={null}
   async function getHealthyEndpoint(endpoints: string[]) {
     for (const endpoint of endpoints) {
       const connection = new Connection(endpoint);
       try {
         const health = await connection.getHealth();
         if (health === 'ok') {
           return endpoint;
         }
       } catch (error) {
         continue;
       }
     }
     throw new Error('No healthy endpoints available');
   }
   ```

4. **Sistem Durum Panosu**
   ```typescript theme={null}
   interface NodeStatus {
     endpoint: string;
     health: string;
     lastChecked: Date;
   }

   async function updateDashboard(nodes: NodeStatus[]) {
     for (const node of nodes) {
       const connection = new Connection(node.endpoint);
       try {
         node.health = await connection.getHealth();
       } catch (error) {
         node.health = 'error';
       }
       node.lastChecked = new Date();
     }
     renderDashboard(nodes);
   }
   ```
