#!/usr/bin/env php $sensor_data) { $discovery_data .= " $sensor: data:$sensor_data"; } } if (file_exists($discovery_file) === false) { if (file_put_contents($discovery_file, $discovery_data)) { c_echo("New discovery file $discovery_file has been created"); } else { c_echo("Failed to create new discovery file $discovery_file"); } } else { c_echo("$discovery_file already exists, here's the data we would have added:"); c_echo($discovery_data); } } else { c_echo(" Info: You can use to build the yaml files for a new OS. Usage: -h Is the device ID or hostname of the device in LibreNMS detected as generic -o This is the OS name, i.e ios, nxos, eos -t This is the OS type, i.e network, power, etc -v The vendor name in lower case, i.e cisco, arista Example: ./scripts/new-os.php -h 44 -o new-eos "); exit(1); } function get_user_input($msg) { c_echo($msg . ' '); $handle = fopen("php://stdin", "r"); $line = fgets($handle); return trim($line); }