{"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\/no\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi","title":{"rendered":"RAID-array inventory LSI 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=\"RAID-array inventory LSI in GLPI\" src=\"\/wp-content\/uploads\/2020\/08\/3926fbb818865d1d1aa48fe97b1af2bc.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><br \/>\nIn my work, I often feel obsessed with the lack of information about infrastructure, and as the number of serviced servers increases, it becomes a real torture. Even when I was administering in small organizations, I always wanted to know what was where, where everything was plugged in, who was responsible for which hardware or service, and most importantly \u2013 to record changes in all of this. When you arrive at a new place and encounter some incident, a lot of time goes into searching for this information. Next, I will share my experiences at RuVDS and how I solved the problem outlined in the title. <br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Bakgrunn<\/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 presented the rack with all servers, UPS, switches, and all the connections between them. RuVDS did not have such a system; only Excel\/paper files with information about servers, some of their components, rack numbers, etc. With this approach, it's very difficult to track changes and small components. Yet, the most important and frequently replaced consumable for servers is hard drives. It is crucial to maintain up-to-date information about hard drive conditions and their strategic inventory. If a drive fails in a RAID array and there is no quick replacement, it can lead to disastrous consequences. Therefore, we really need a system that tracks the location of drives and their status to understand what we might be lacking and which specific models need to be purchased.<\/p>\n<p>GLPI came to the rescue, an open-source product developed to enhance the operations of IT departments and bring them closer to ITIL ideals. It includes not only inventory management of equipment and rack management but also a knowledge base, service desk, document management, and much more. GLPI has many plugins, including FusionInventory and OCS Inventory, which allow for automatic collection of information about computers and other devices by installing agents and using SNMP. You can read more about installing GLPI and plugins in other articles, preferably \u2013 <noindex><a rel=\"nofollow\" href=\"https:\/\/glpi-install.readthedocs.io\/en\/latest\">den offisielle dokumentasjonen<\/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>Men etter deployering av agenten, \u00e5pner vi datakomponentene i GLPI og ser dette:<\/p>\n<p><img decoding=\"async\" alt=\"RAID-array inventory LSI in GLPI\" src=\"\/wp-content\/uploads\/2020\/08\/4acc211c12487f961e198edfcdca8b6f.png\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nProblemet er at ingen av pluginene kan se informasjon om de fysiske diskene i LSI RAID-arrays. Etter \u00e5 ha sett hvordan dette har blitt l\u00f8st for overv\u00e5kning i Zabbix med et PowerShell-skript, <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/datazon\/zabbix-lsi-raid\/blob\/master\/lsi-raid.ps1\">lsi-raid.ps1<\/a><\/noindex> besluttet jeg \u00e5 skrive et lignende skript for \u00e5 overf\u00f8re informasjonen til GLPI.<br \/>\nInformasjonen om diskene i arrayet kan hentes fra verkt\u00f8yene fra kontrollertilbyderen, i tilfellet LSI er det StorCLI. Fra dette verkt\u00f8yet kan vi f\u00e5 data i JSON-format, parse dem og sende dem til GLPIs API. Vi vil knytte diskene til datamaskinene som allerede er opprettet av FusionInventory. Ved gjentatt kj\u00f8ring vil skriptet oppdatere diskdata og legge til nye. Selve skriptet Send-RAIDtoGLPI.ps1 ligger <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/ChaoticNeural\/Send-RAIDtoGLPI\">her p\u00e5 GitHub<\/a><\/noindex>. Videre vil jeg forklare hvordan man bruker det.<\/p>\n<h2>Hva som er n\u00f8dvendig<\/h2>\n<p><\/p>\n<ol>\n<li><noindex><a rel=\"nofollow\" href=\"https:\/\/glpi-project.org\/ru\/download-ru\">GLPI<\/a><\/noindex> versjon 9.5.1 (denne ble testet med)<\/li>\n<li>Plugin <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/fusioninventory\/fusioninventory-for-glpi\/releases\">FusionInventory<\/a><\/noindex> og agent for Windows<\/li>\n<li>Windows 2012 R2 (og nyere) som verts-system, eller i en management-VM med kontrollelementet tilkoblet, PowerShell versjon 4 eller h\u00f8yere<\/li>\n<li>Installert MegaRAID-driver<\/li>\n<li>Modul for PowerShell \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/J-C-P\/PSGLPI\">PSGLPI <\/a><\/noindex><\/li>\n<li>Bruker i GLPI med Admin-profil for autentisering via API, generert UserToken og AppToken<\/li>\n<\/ol>\n<p>\nEt viktig poeng. I GLPI finnes det merkelig nok 2 forskjellige entiteter for diskmodellen, men det finnes ingen attributt for \u00ablagringstype\u00bb. Derfor har jeg besluttet \u00e5 bruke nedtrekkslisten \u00abModeller av harddisker\u00bb (front\/devicemodel.php?itemtype=DeviceHardDriveModel) for \u00e5 registrere egenskapene HDD og SSD. For skriptet er det n\u00f8dvendig \u00e5 ha disse verdiene i GLPI-databasen, ellers kan det ikke registrere informasjonen om diskmodellen. Derfor m\u00e5 vi f\u00f8rst legge til HDD, deretter SSD, slik at IDene for disse elementene i databasen blir henholdsvis 1 og 2. Hvis det er andre, kan du erstatte IDene i denne linjen av skriptet Send-RAIDtoGLPI.ps1 etter HDD og SSD med de tilsvarende IDene: <\/p>\n<pre><code class=\"powershell\">deviceharddrivemodels_id = switch ($MediaType) { \"HDD\" { \"1\" }; \"SSD\" { \"2\" }; default { \"\" } }<\/code><\/pre>\n<p>\nHvis du ikke vil bry deg med det eller bruker denne nedtrekkslisten p\u00e5 en annen m\u00e5te, kan du bare fjerne denne linjen fra skriptet. <\/p>\n<p>Det er ogs\u00e5 n\u00f8dvendig \u00e5 legge til status for diskene i \u00abElementstatuser\u00bb (front\/state.php). Jeg la til statusene \u00abMediaError\u00bb (det har v\u00e6rt en eller flere feil ved disktilgang) og \u00abOK\u00bb, linjen i skriptet der IDene deres sendes, \u00ab2\u00bb for \u00abOK\u00bb og \u00ab1\u00bb for \u00abMediaError\u00bb:<\/p>\n<pre><code class=\"powershell\">states_id = switch ($MediaError) { 0 { \"2\" }; { $_ -gt 0 } { \"1\" } }<\/code><\/pre>\n<p>\nDisse statusene er n\u00f8dvendige for enkelhetens skyld; hvis du ikke trenger disse egenskapene, kan du ogs\u00e5 fjerne denne linjen.<\/p>\n<p>I skriptet m\u00e5 du huske \u00e5 angi variablene til dine. $GlpiCreds m\u00e5 inneholde URL-en til GLPI API-serveren, UserToken og AppToken.<\/p>\n<h2>Hva i skriptet<\/h2>\n<p>\nP\u00e5 grunn av omfattende JSON-parsing og lange if-setninger, er skriptet vanskelig \u00e5 lese, s\u00e5 jeg vil beskrive logikken her.<\/p>\n<p>Ved f\u00f8rste kj\u00f8ring p\u00e5 verten, g\u00e5r skriptet gjennom alle kontrollerne og leter etter disker i GLPI-databasen basert p\u00e5 serienumre. Hvis den ikke finner noe, leter den etter modellen. Hvis den heller ikke finner modellen, legger den til den nye diskmodellen i GLPI og registrerer disken i databasen.<\/p>\n<p>Ved hver ny kj\u00f8ring vil skriptet pr\u00f8ve \u00e5 oppdage nye disker, men det er ikke i stand til \u00e5 fjerne manglende disker, s\u00e5 det m\u00e5 gj\u00f8res manuelt.<\/p>\n<h2>Eksempel p\u00e5 distribusjon<\/h2>\n<p>\nI skriptets repository finnes det et skript Deploy-Send-RAIDtoGLPI.ps1, som vil laste ned en ZIP-arkiv med n\u00f8dvendige filer fra v\u00e5r GLPI-server og distribuere dem p\u00e5 hver vert.<\/p>\n<p>Etter kopiering av filene, vil skriptet installere FusionInventory-agenten med oppstart som en daglig oppgave og opprette en lignende oppgave for v\u00e5rt skript. Etter vellykket implementering kan vi endelig se diskene i \u00abKomponenter\u00bb-delen av datamaskinen i GLPI.<\/p>\n<h2>Resultatet<\/h2>\n<p>\nN\u00e5, n\u00e5r vi g\u00e5r til GLPI i menyen \u00abInnstillinger\u00bb -&gt; \u00abKomponenter\u00bb -&gt; \u00abHarddisker\u00bb, kan vi klikke p\u00e5 diskmodellene for \u00e5 se hvor mange vi har, slik at vi kan forst\u00e5 hva vi trenger \u00e5 kj\u00f8pe.<\/p>\n<p><img decoding=\"async\" alt=\"RAID-array inventory LSI 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=\"RAID-array inventory LSI in GLPI\" src=\"\/wp-content\/uploads\/2020\/08\/352649653a9adc6b179b6c752948077b.png\" style=\"display:block;margin: 0 auto;\" \/><\/a><\/noindex><br \/>\n<br \/>Kilde: <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.5.1 - 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\/no\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.5.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"nn_NO\" \/>\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\/no\/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\udd47 Inventarisering av RAID-mengder LSI i GLPI | ProHoster","description":"","canonical_url":"https:\/\/prohoster.info\/no\/blog\/administrirovanie\/inventarizacziya-raid-massivov-lsi-v-glpi","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"nn_NO","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\/no\/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\/no\/wp-json\/wp\/v2\/posts\/91726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/comments?post=91726"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/posts\/91726\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/media\/91727"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/media?parent=91726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/categories?post=91726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/no\/wp-json\/wp\/v2\/tags?post=91726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}