Skip to content

Instantly share code, notes, and snippets.

View DanielBorgesOliveira's full-sized avatar
🎯
Focusing

Daniel Borges de Oliveira DanielBorgesOliveira

🎯
Focusing
View GitHub Profile
<?php
function valueToSQL($value) {
switch (gettype($value)) {
case 'string':
return "'" . $value . "'";
case 'boolean':
return $value ? '1' : '0';
case 'integer':
if (is_finite($value)) return $value;
case 'double':
#!/usr/bin/python3
import requests
class telegram():
def __init__(
self,
TelegramToken,
TelegramChatID,
):
@DanielBorgesOliveira
DanielBorgesOliveira / check_zm_monitors.py
Created August 21, 2022 03:50
Nagios plugin to monitor if the zoneminder monitors are online.
#!/usr/bin/python3
# https://zoneminder.readthedocs.io/en/stable/api.html
# https://www.digitalocean.com/community/tutorials/how-to-create-nagios-plugins-with-python-on-ubuntu-12-10
import requests
import json
import sys
import argparse
@DanielBorgesOliveira
DanielBorgesOliveira / how_to_force_a_disk_to_reallocate_bad_sectors.md
Created August 24, 2022 02:11 — forked from rmi1974/how_to_force_a_disk_to_reallocate_bad_sectors.md
How to force a disk to reallocate bad sectors #disk #health #commandlinefu

How to force a disk to reallocate bad sectors

Courtesy of [How to force a disk to reallocate bad sectors][1].

Sometimes a hard disk is hinting on an upcoming failure. Some disks start to make unexpected sounds, others are silent and only cause some noise in your syslog. In most cases the disk will automatically reallocate one or two damaged sectors and you should start planning on buying a new disk while your data is safe. However, sometimes the disk won’t automatically reallocate these sectors and you’ll have to do that manually yourself. Luckily, this doesn’t include any rocket science.

A few days ago, one of my disks reported some problems in my syslog while rebuilding a RAID5-array:

Jan 29 18:19:54 dragon kernel: [66774.973049] end_request: I/O error, dev sdb, sector 1261069669