Могу ли я опросить операционную систему Linux через интерфейс SQL?

366
lucid_dreamer

Например, для crontab. Я не хочу разбирать это. Я хочу выполнить SQL-запрос против (как минимум) jdbc-совместимого соединения (автоматически предоставляется Linux, которое возвращает именно это).

Но я имею в виду - не только для crontab. Чем больше тем лучше. приборы, услуги. Я понимаю, что кое-что из этого в конечном итоге подкреплено файлами в файловой системе, но мне все равно, я бы хотел, чтобы реляционная абстракция сверху была бесплатной, теперь :-).

Я считаю, что файлы разбора строк для информации утомительны, и я бы предпочел старый добрый sql, чтобы получить информацию, которая мне нужна.

Есть ли что-нибудь, даже связанное с этим, уже?

Иначе это плохая идея? Если да, то почему?

1
Целая система? Нет. НО есть множество сервисов и комбинаций сервисов, которые используют dbs для всего бэкэнда, либо что-то внутреннее и обеспечивающее интерфейс запросов (ldap-серверы), либо фактически используют некоторый продукт db, такой как mysql - для обычного веб-хостинга таким образом, проверить ispconfig ivanivan 6 лет назад 0
Пожалуйста, отмените этот вопрос. То, что я спросил, очень ясно (и полезно - такого вопроса нет на SU); см. ответ от "Майка Фицпатрика". lucid_dreamer 6 лет назад 0

3 ответа на вопрос

2
Mike Fitzpatrick

Have a look at osquery which provides an SQL interface to many system areas, including crontab. It is cross-platform and free.

From the osquery website:

osquery allows you to easily ask questions about your Linux, Windows, and macOS infrastructure. Whether your goal is intrusion detection, infrastructure reliability, or compliance, osquery gives you the ability to empower and inform a broad set of organizations within your company.

Обратите внимание, что [нет интерфейса jdbc] (https://github.com/facebook/osquery/issues/1927), он использует анализатор SQLite SQL и его нельзя использовать для изменения чего-либо, только для запросов. lucid_dreamer 6 лет назад 0
Также интересны [швейцар] (https://archive.is/xPCZA) и [Zentral] (https://archive.is/8BJY7). lucid_dreamer 6 лет назад 0
0
BillThor

The closest interface I can think of for this would be through the SMTP protocol.

I can't think of any way to securely implement an interface that could be queried using SQL.

There are programs that can store log records in a a database. It you are looking to query log data, look for log analysis tools.

Вы имели в виду snmp (статус службы и т. Д.), А не smtp (почта?) ivanivan 6 лет назад 1
0
davidgo

This is a bad idea - it would seem to me to actually border on non-sensical, as the information held by Linux is, for the most part, not amenable to a relational database representation.

You talk about finding string parsing of files difficult - but its unclear what you mean here. Certainly most artifacts in Linux can be accessed as files, however there are front-end tools to work with and manipulate these.

Tangenially related - WinFS - seems to have been an attempt to make a database filesystem by Microsoft, which appears to have never come to fruition. the Wikipedia entry is an interesting read, but even should this exist it would not be a full interface to an OS, rather an interface to a filesystem.

I was unable to find any projects which do it under Linux, but I posit it would theoretically be possible to create a Linux shell which (possibly in combination with FUSE). I did find a project names GLSCube - which would have seen something analogous [ for the handling of files ] - although not SQL based - but it appears to have been stillborn.

Так что насчет OSQuery? lucid_dreamer 6 лет назад 1

Похожие вопросы