====== Cacti+NUT ====== Для сбора статистики вы можете использовать кактус для этого нужно следующее:\\ 1. Скачать скрипт cacti-nut.0.5.tar_.gz (новая версия cacti-nut.0.6.tar_.gz) и распаковать. Скопируйте файл scripts/ss_nut_ups_status.php в директорию cacti/scripts/\\ Скопируйте файл resource/nut_ups_status.xml в директорию cacti/resource/script_server/ 2. Импортировать шаблон из архива Console > Import Templates > Views [cacti_data_query_nut_ups_statistics.xml] 3. Создать данные. В разделе Console > Devices > [сервер с NUT] и на панели Associated Data Queries добавляем Data Query: NUT — UPS Statistics > Add. В добавленной строчке в столбце status должны увидеть: Success [2 Items, 1 Row] 4. Создать график для этих данных на странице параметров устройств строка Create Graphs for this Host. Там мы есть Data Query [NUT — UPS Statistics] в строке которой расположены наши UPS. Отмечаем галочкой нужный и выбираем graph type: * **UPS Load Capacity** — уровень загруженности UPS. * **UPS Power Signal** — входящее напряжение и частота. * **UPS Temperature** — температура UPS. **Script Input and Output** In some cases you may want to execute the script file manually for debugging purposes. The parameters to the script use a fixed structure that is optimized for use with the Cacti poller, but also allows for human interaction. In particular, the script uses three parameter groups, with the exact structure depending on the output that is desired. The first parameter group provides a NUT protocol "bundle" of the following values, separated by colon characters: In those cases where a default value is adequate (such as the NUT port number), the value can be omitted. * //hostname//: The domain name or IP address of the target device. This value is mandatory. * //port number//: The TCP port number for the NUT upsd daemon on the target device. If a value is not specified, the default value of "3493" will be used. * //timeout//: The number of seconds to wait for the NUT session to be established. If a value is not specified, the Cacti configuration will be read for a locally-defined default value. Taken as a whole, a valid NUT bundle for the localhost device on the default port number and a default timeout would be "localhost::". The next parameter identifies the type of Cacti data that is being requested. Cacti uses "index" queries to enumerate all of the entries for a data query template, and then uses various kinds of "query" queries to obtain extended information about those entries (such as the full name of each indexed entry). Separately, the Cacti poller uses "get" queries to fetch the readings for each specific entry (again, keyed by index value). Note that he index and query operations are typically only performed when the device entry is being created or modified, and the get operations provide the actual readings to the poller. This script parameter must be one of those query types, with any remaining parameters providing any necessary supplemental data. Specifically the request parameters are one of the following: * //index//: This request asks for a list of UPS device identifiers. No additional input data is needed. The response data is provided as a series of index values, with each UPS being enumerated on a separate response line. * //query //: This request asks for the specified field data associated with each UPS device. The response data is provided as "index:data" pairs, where the index value is the primary device identifier, and the data value is the requested field data as available. * //get //: This request asks for the specified field data associated with the specified UPS device. The requested data is provided by itself with no other accompanying information. The field names that can be used in "query" or "get" requests are as follows: * //ups.device//: The index value for the UPS device(s). * //ups.description//: The human-friendly name for the UPS device(s). * //input.voltage//: The input voltage for the UPS. * //input.frequency//: The input line frequency for the UPS. * //battery.voltage//: The battery voltage for the UPS. * //battery.charge//: The level of the battery charge, as a percentage. * //ups.temperature//: The temperature of the UPS or sometimes the battery. * //ups.load//: The demand on the UPS as a percentage. You must know the index value that has been assigned to a device before you can ask for details about that specific device. To do this, you can use the "query ups.description" request to get a list of UPS devices and their descriptions, and then use the "get " request to get information about the desired UPS. The full command lines for these requests, using example data from above, are shown below: $ php ss_nut_ups_status.php hostname:: query ups.description SMART2200RMXL2U:Tripp-Lite SMART2200RMXL2U $ php ss_nut_ups_status.php hostname:: get ups.load SMART2200RMXL2U 23 Ссылки:\\ http://www.ignix.ru/book/freebsd/daemon/network_ups_tools\\ http://www.eric-a-hall.com/software/cacti-nut/