{"id":91726,"date":"2020-08-17T19:42:14","date_gmt":"2020-08-17T17:42:14","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi"},"modified":"2020-08-17T19:42:14","modified_gmt":"2020-08-17T17:42:14","slug":"inventarizacziya-raid-massivov-lsi-v-glpi","status":"publish","type":"post","link":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi","title":{"rendered":"Inventory of LSI RAID arrays in GLPI","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/515154\/\"><img decoding=\"async\" alt=\"Inventory of LSI RAID arrays in GLPI\" src=\"\/wp-content\/uploads\/2020\/08\/3926fbb818865d1d1aa48fe97b1af2bc.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><br \/>\nIn my work, I often experience obsessions regarding the lack of information about infrastructure. As the number of servers I manage increases, this becomes a real torment. Even when I was an admin in small organizations, I always wanted to know where everything was located, where it was plugged in, who was responsible for which piece of hardware or service, and most importantly, to document changes throughout. When you arrive in a new place and face an incident, a lot of time is spent searching for this information. Next, I will share what I encountered at RuVDS and how I resolved the issue mentioned in the title. <br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Background<\/h2>\n<p>\nAs an enterprise admin, I had little experience working in a data center, but I caught a glimpse of RackTables. It clearly displayed the rack with all the servers, UPSs, switches, and all the connections between them. RuVDS did not have a similar system, only Excel\/paper files with information about the servers, some of their components, rack numbers, etc. With this approach, it is very challenging to track changes and keep an eye on smaller components. The most critical and frequently replaced consumable for servers is disks. It is vital to maintain up-to-date information about the status of disks and their strategic reserves. If a disk fails in a RAID array and there is no quick replacement, it could ultimately lead to fatal consequences. Therefore, we need a system to monitor the location of disks and their status to understand what we may be lacking and which specific models need to be purchased.<\/p>\n<p>GLPI came to the rescue, an open-source product designed to improve the operations of IT departments and bring them up to ITIL standards. It includes equipment inventory and rack management, a knowledge base, a service desk, document management, and much more. GLPI has many plugins, including FusionInventory and OCS Inventory, which allow for automatic data collection about computers and other devices through agent installation and SNMP. You can read more about the installation of GLPI and its plugins in other articles, best of all \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/glpi-install.readthedocs.io\/en\/latest\">the official documentation.<\/a><\/noindex>. It can be installed on our hosting with a ready-made template <noindex><a rel=\"nofollow\" href=\"https:\/\/ruvds.com\/ru-rub\/marketplace\/lamp#order\">LAMP<\/a><\/noindex>.<\/p>\n<p>However, after deploying the agent, we will open the computer components in GLPI and see this:<\/p>\n<p><img decoding=\"async\" alt=\"Inventory of LSI RAID arrays in GLPI\" src=\"\/wp-content\/uploads\/2020\/08\/4acc211c12487f961e198edfcdca8b6f.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nThe problem is that none of the plugins can see information about physical disks in LSI RAID arrays. I saw how this issue was solved for monitoring in Zabbix using a PowerShell script. <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/datazon\/zabbix-lsi-raid\/blob\/master\/lsi-raid.ps1\">lsi-raid.ps1<\/a><\/noindex> I decided to write a similar one for transferring information to GLPI.<br \/>\nData about the disks in the array can be obtained using utilities from the controller manufacturer; in the case of LSI, this is StorCLI. From it, you can get data in JSON format, parse it, and pass it to the GLPI API. We will link the disks to the computers already created by FusionInventory. When the script is run again, it will update the disk data and add new ones. The script Send-RAIDtoGLPI.ps1 is located <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/ChaoticNeural\/Send-RAIDtoGLPI\">here on GitHub.<\/a><\/noindex>Next, I will explain how to use it.<\/p>\n<h2>What is required<\/h2>\n<p><\/p>\n<ol>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/glpi-project.org\/ru\/download-ru\">GLPI<\/a><\/noindex> version 9.5.1 (this version was tested)<\/li>\n<li>Plugin <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/fusioninventory\/fusioninventory-for-glpi\/releases\">FusionInventory<\/a><\/noindex> and an agent for Windows<\/li>\n<li>Windows 2012 R2 (or higher) as the host system, or a management VM with the controller passed through, PowerShell version 4 or above.<\/li>\n<li>Installed MegaRAID driver.<\/li>\n<li>PowerShell module \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/J-C-P\/PSGLPI\">PSGLPI <\/a><\/noindex><\/li>\n<li>An account in GLPI with an Admin profile for API authorization, with generated UserToken and AppToken.<\/li>\n<\/ol>\n<p>\nAn important point. In GLPI, for some reason, there are 2 different entities for the disk model, but there is no property for \"media type.\" Therefore, to record the property for HDD and SSD, I decided to use the dropdown list \"Hard Disk Models\" (front\/devicemodel.php?itemtype=DeviceHardDriveModel). For the script to function, these values must exist in the GLPI database; otherwise, it cannot record disk model data. Therefore, you need to enter HDD first, then SSD, into this empty list so that the IDs of these elements in the database become 1 and 2. If there are others, then replace in this line of the Send-RAIDtoGLPI.ps1 script after HDD and SSD the corresponding IDs instead of 1 and 2: <\/p>\n<pre><code class=\"powershell\">deviceharddrivemodels_id = switch ($MediaType) { \"HDD\" { \"1\" }; \"SSD\" { \"2\" }; default { \"\" } }<\/code><\/pre>\n<p>\nIf you don't want to deal with this or you're using this dropdown list differently, you can simply remove this line from the script. <\/p>\n<p>You also need to add statuses for the disks in \"Element Statuses\" (front\/state.php). I added the statuses \"MediaError\" (there was at least one read error to the disk) and \"OK\"; the line in the script where their IDs are passed, \"2\" for \"OK\" and \"1\" for \"MediaError:\",<\/p>\n<pre><code class=\"powershell\">states_id = switch ($MediaError) { 0 { \"2\" }; { $_ -gt 0 } { \"1\" } }<\/code><\/pre>\n<p>\nThese statuses are necessary for convenience; if you do not need these properties, you can also delete this line entirely.<\/p>\n<p>In the script, don't forget to specify the variables for your setup. $GlpiCreds should contain the URL to the GLPI API server, UserToken, and AppToken.<\/p>\n<h2>What\u2019s in the script<\/h2>\n<p>\nDue to cumbersome JSON parsing and a series of if-statements, the script is poorly readable; hence, I will describe its logic here.<\/p>\n<p>Upon the first run on the host, the script will go through all controllers and look for disks in the GLPI database by their serial numbers. If it doesn\u2019t find them, it will search for the model. If the model is not found either, it will add the new disk model to GLPI and record the disk in the database.<\/p>\n<p>With each new run, the script will attempt to detect new disks, but it cannot remove absent ones, so this will have to be done manually.<\/p>\n<h2>Deployment example<\/h2>\n<p>\nIn the script repository, there is a script Deploy-Send-RAIDtoGLPI.ps1, which will download a ZIP archive with the necessary files from our GLPI server and deploy them on each host.<\/p>\n<p>After copying the files, the script will install the FusionInventory agent to run as a daily task and create a similar task for our script. After successful implementation, we will finally be able to see the disks in the 'Components' section of the computer in GLPI.<\/p>\n<h2>Result<\/h2>\n<p>\nNow, by logging into GLPI and going to the menu 'Settings' -&gt; 'Components' -&gt; 'Hard Disks', we can click on the disk models and check their quantities to determine what we need to purchase.<\/p>\n<p><img decoding=\"async\" alt=\"Inventory of LSI RAID arrays in GLPI\" src=\"\/wp-content\/uploads\/2020\/08\/a51546ba78716f8174a6fbf29632c77d.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<noindex><a rel=\"nofollow\" href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=gen&amp;utm_content=raidlsiglpi#order\"><img decoding=\"async\" alt=\"Inventory of LSI RAID arrays in GLPI\" src=\"\/wp-content\/uploads\/2020\/08\/352649653a9adc6b179b6c752948077b.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><br \/>\n<br \/>Source: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/515154\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u0412 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u044f \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u044b\u0442\u044b\u0432\u0430\u044e \u043e\u0431\u0441\u0435\u0441\u0441\u0438\u0438 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0431 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u0430 \u043f\u0440\u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0438 \u043f\u0430\u0440\u043a\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u044d\u0442\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0443\u044e \u043f\u044b\u0442\u043a\u0443. \u0414\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u044f \u0430\u0434\u043c\u0438\u043d\u0438\u043b \u0432 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044f\u0445, \u043c\u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0437\u043d\u0430\u0442\u044c, \u0447\u0442\u043e \u0433\u0434\u0435 \u0441\u0442\u043e\u0438\u0442, \u043a\u0443\u0434\u0430 \u0432\u043e\u0442\u043a\u043d\u0443\u0442\u043e, \u043a\u0442\u043e \u0438\u0437 \u043b\u044e\u0434\u0435\u0439 \u0437\u0430 \u043a\u0430\u043a\u0443\u044e \u0436\u0435\u043b\u0435\u0437\u043a\u0443 \u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442, \u0438 \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":91727,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-91726","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47\u0418\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f RAID-\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 LSI \u0432 GLPI | ProHoster\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-08-17T17:42:14+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-08-17T17:42:14+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47RAID Array Inventory LSI in GLPI | ProHoster","description":"","canonical_url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"en_US","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47\u0418\u043d\u0432\u0435\u043d\u0442\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f RAID-\u043c\u0430\u0441\u0441\u0438\u0432\u043e\u0432 LSI \u0432 GLPI | ProHoster","og:url":"https:\/\/prohoster.info\/en\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-08-17T17:42:14+00:00","article:modified_time":"2020-08-17T17:42:14+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"91726","title":null,"description":null,"keywords":null,"keyphrases":{"focus":[],"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 12:22:22","updated":"2026-08-11 12:50:10","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/91726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/comments?post=91726"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/posts\/91726\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media\/91727"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/media?parent=91726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/categories?post=91726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/en\/wp-json\/wp\/v2\/tags?post=91726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}