@@ -485,7 +485,6 @@ process.stdin.on('end', () => {
485485 getHEADFromAPI ( ) ,
486486 getTagInfoFromAPI ( ) ,
487487 getPluginInfoFromAPI ( ) ,
488- getConfigFromAPI ( ) ,
489488 getConfigFromInspectAPI ( ) ,
490489 getPoolStatsFromAPI ( ) ,
491490 getDiskUsageFromAPI ( ) ,
@@ -497,12 +496,10 @@ process.stdin.on('end', () => {
497496
498497 let statusMessages = [ ] ;
499498
500- let configinfo = infoData [ 6 ] ;
501-
502499 //////////////////////////////////////////////////////////////
503500 // get postgres version, cannot be part of Promise.all(), because we need the DSN.
504501 // DSN is in the response from getConfigFromInspectAPI()
505- const dsn = infoData [ 7 ] . Config . Fylr . DB . DSN
502+ const dsn = infoData [ 6 ] . Config . Fylr . DB . DSN
506503 result . postgres_version = await getPostgresVersion ( dsn ) ;
507504
508505 //////////////////////////////////////////////////////////////
@@ -515,7 +512,7 @@ process.stdin.on('end', () => {
515512
516513 //////////////////////////////////////////////////////////////
517514 // check mysql-backups, a successfull backup from yesterday is wanted
518- result . sqlbackups = infoData [ 11 ] ;
515+ result . sqlbackups = infoData [ 10 ] ;
519516
520517 //////////////////////////////////////////////////////////////
521518 // email-configs
@@ -524,38 +521,38 @@ process.stdin.on('end', () => {
524521 //////////////////////////////////////////////////////////////
525522 // notifications?
526523 let notifications = false ;
527- if ( configinfo ?. system ?. config ?. notification_scheduler ?. active ) {
528- if ( configinfo . system . config . notification_scheduler . active = true ) {
529- notifications = true ;
530- }
524+ let notificationsObject = infoData [ 6 ] . BaseConfigList . find ( obj => obj . Name === "notification_scheduler" ) ;
525+ if ( notificationsObject ?. Values ?. active ?. ValueBool == true ) {
526+ notifications = true ;
531527 }
532528 result . email . notifications = notifications ;
533529
534530 //////////////////////////////////////////////////////////////
535531 // Email-Server
536532 let email_server = '' ;
537- if ( configinfo ?. system ?. config ?. email_server ?. server_addr ) {
538- email_server = configinfo . system . config . email_server . server_addr ;
533+ let emailServerObject = infoData [ 6 ] . BaseConfigList . find ( obj => obj . Name === "email_server" ) ;
534+ if ( emailServerObject ?. Values ?. server_addr ?. ValueText ) {
535+ email_server = emailServerObject . Values . server_addr . ValueText ;
539536 }
540537 result . email . email_server = email_server ;
541538
542539 //////////////////////////////////////////////////////////////
543540 // Admin-Emails
544541 let maskedEmails = [ ] ;
545- if ( configinfo ?. system ?. config ?. email ?. admin_emails ) {
546- let adminEmails = configinfo . system . config . email . admin_emails ;
547- adminEmails = adminEmails . filter ( emailObj => emailObj . email . length > 0 ) ;
548- maskedEmails = adminEmails . map ( email => {
549- email = email . email ;
550- let maskedEmail = '' ;
551- for ( let i = 0 ; i < email . length ; i ++ ) {
552- maskedEmail += i % 2 === 0 ? email [ i ] : '*' ;
542+ let maskedEmailsObject = infoData [ 6 ] . BaseConfigList . find ( obj => obj . Name === " email" ) ;
543+
544+ if ( maskedEmailsObject ?. Values ?. admin_emails ?. ValueTable [ 0 ] ?. email ?. ValueText ) {
545+ let adminEmailAdress = maskedEmailsObject . Values . admin_emails . ValueTable [ 0 ] . email . ValueText ;
546+ let emailChars = adminEmailAdress . split ( '' ) ;
547+ for ( let i = 0 ; i < emailChars . length ; i ++ ) {
548+ if ( i % 2 !== 0 ) {
549+ emailChars [ i ] = '*' ;
553550 }
554- return maskedEmail ;
555- } ) ;
556- } else {
557- console . log ( 'Admin emails do not exist.' ) ;
551+ }
552+ let maskedEmail = emailChars . join ( '' ) ;
553+ maskedEmails = [ maskedEmail ] ;
558554 }
555+
559556 result . email . adminEmails = maskedEmails ;
560557
561558 //////////////////////////////////////////////////////////////
@@ -564,19 +561,23 @@ process.stdin.on('end', () => {
564561 let janitorActive = false ;
565562 let janitorEscalate = false ;
566563 let eventDeletionEnabled = true ;
567- if ( configinfo ?. system ?. config ?. janitor ) {
564+
565+ let janitorObject = infoData [ 6 ] . BaseConfigList . find ( obj => obj . Name === "janitor" ) ;
566+
567+ if ( janitorObject ?. Values ) {
568568 // janitor enabled?
569- if ( configinfo . system . config . janitor . active == true ) {
569+ if ( janitorObject ?. Values ?. active ?. ValueBool == true ) {
570570 janitorActive = true ;
571571 } else {
572572 janitorEscalate = true ;
573573 }
574574 // check if all events have a small deletion daylimit
575- for ( const eventType in configinfo . system . config . janitor . events ) {
576- eventConfigVal = configinfo . system . config . janitor . events [ eventType ] ;
577- if ( eventConfigVal == null || eventConfigVal > 10 || eventConfigVal < 1 ) {
578- janitorEscalate = true ;
579- eventDeletionEnabled = false ;
575+ if ( janitorObject ?. Values ?. events ?. ValueForm ) {
576+ for ( const [ eventType , eventVal ] of Object . entries ( janitorObject . Values . events . ValueForm ) ) {
577+ if ( eventVal . ValueInt == null || eventVal . ValueInt > 10 || eventVal . ValueInt < 1 ) {
578+ janitorEscalate = true ;
579+ eventDeletionEnabled = false ;
580+ }
580581 }
581582 }
582583 }
@@ -587,18 +588,20 @@ process.stdin.on('end', () => {
587588
588589 //////////////////////////////////////////////////////////////
589590 // Loglevel
591+
590592 let logLevel = '' ;
591- if ( configinfo ?. system ?. config ?. logging ?. level ) {
592- logLevel = configinfo . system . config . logging . level ;
593+
594+ let LogLevelInfo = infoData [ 6 ] ?. Config ?. Fylr ?. Logger ?. Level ;
595+ if ( LogLevelInfo ) {
596+ logLevel = LogLevelInfo ;
593597 }
594598 result . logLevel = logLevel ;
595599
596-
597- result . purge = { } ;
598600 //////////////////////////////////////////////////////////////
599601 // allow purge?
602+ result . purge = { } ;
600603
601- let purgeInfo = infoData [ 7 ] . BaseConfigList . find ( obj => obj . Name === "purge" ) ;
604+ let purgeInfo = infoData [ 6 ] . BaseConfigList . find ( obj => obj . Name === "purge" ) ;
602605 purgeInfo = purgeInfo . Values ;
603606 let allowPurge = false ;
604607 if ( purgeInfo ?. allow_purge ?. ValueBool ) {
@@ -621,21 +624,25 @@ process.stdin.on('end', () => {
621624 //////////////////////////////////////////////////////////////
622625 // objectstore
623626 let objectstore = false ;
624- if ( configinfo ?. system ?. config ?. objectstore ?. uid ) {
627+ let objectStoreObject = infoData [ 6 ] . BaseConfigList . find ( obj => obj . Name === "objectstore" ) ;
628+
629+ if ( objectStoreObject ?. Values ?. uid ?. ValueText && objectStoreObject ?. Values ?. server ?. ValueText ) {
625630 objectstore = { } ;
626- objectstore . uid = configinfo . system . config . objectstore . uid ;
627- if ( configinfo ?. system ?. config ?. objectstore ?. instance ) {
628- objectstore . instance = configinfo . system . config . objectstore . instance ;
631+ objectstore . server = objectStoreObject . Values . server . ValueText ;
632+ objectstore . uid = objectStoreObject . Values . uid . ValueText ;
633+ if ( objectStoreObject ?. Values ?. instance ?. ValueText ) {
634+ objectstore . instance = objectStoreObject . Values . instance . ValueText ;
629635 }
630636 }
637+
631638 result . objectstore = objectstore ;
632639
633640
634641 //////////////////////////////////////////////////////////////
635642 // license
636643 result . license = { }
637644
638- let licenseObject = infoData [ 7 ] . BaseConfigList . find ( obj => obj . Name === "license" ) ;
645+ let licenseObject = infoData [ 6 ] . BaseConfigList . find ( obj => obj . Name === "license" ) ;
639646 licenseObject = licenseObject . Values . license . ValueJSON ;
640647
641648 var licenseDomains = licenseObject . domains ;
@@ -773,11 +780,11 @@ process.stdin.on('end', () => {
773780 // objecttypes stat
774781 result . statistics = { } ;
775782 result . statistics . objecttypes = { } ;
776- if ( infoData [ 10 ] ) {
777- if ( infoData [ 10 ] [ 'IndexedByTableNameRead' ] ) {
778- Object . keys ( infoData [ 10 ] [ 'IndexedByTableNameRead' ] ) . forEach ( function ( key ) {
779- if ( infoData [ 10 ] [ 'IndexedByTableNameRead' ] [ key ] . Count ) {
780- result . statistics . objecttypes [ key ] = infoData [ 10 ] [ 'IndexedByTableNameRead' ] [ key ] . Count ;
783+ if ( infoData [ 9 ] ) {
784+ if ( infoData [ 9 ] [ 'IndexedByTableNameRead' ] ) {
785+ Object . keys ( infoData [ 9 ] [ 'IndexedByTableNameRead' ] ) . forEach ( function ( key ) {
786+ if ( infoData [ 9 ] [ 'IndexedByTableNameRead' ] [ key ] . Count ) {
787+ result . statistics . objecttypes [ key ] = infoData [ 9 ] [ 'IndexedByTableNameRead' ] [ key ] . Count ;
781788 }
782789 } ) ;
783790 }
@@ -791,23 +798,23 @@ process.stdin.on('end', () => {
791798 result . file_stats . size = 0 ;
792799
793800 // from pool
794- if ( infoData [ 8 ] ) {
795- if ( infoData [ 8 ] . PoolStatsSubpools ) {
796- result . file_stats . count = infoData [ 8 ] . PoolStatsSubpools . files . count ;
797- result . file_stats . size = infoData [ 8 ] . PoolStatsSubpools . files . size ;
801+ if ( infoData [ 7 ] ) {
802+ if ( infoData [ 7 ] . PoolStatsSubpools ) {
803+ result . file_stats . count = infoData [ 7 ] . PoolStatsSubpools . files . count ;
804+ result . file_stats . size = infoData [ 7 ] . PoolStatsSubpools . files . size ;
798805 }
799806 }
800807
801808 // from objecttype
802- if ( infoData [ 9 ] . length > 0 ) {
809+ if ( infoData [ 8 ] . length > 0 ) {
803810 let otCount = 0 ;
804811 let otSize = 0 ;
805- for ( let i = 0 ; i < infoData [ 9 ] . length ; i ++ ) {
806- if ( infoData [ 9 ] [ i ] . OtStats ) {
807- if ( infoData [ 9 ] [ i ] . OtStats . files ) {
808- if ( infoData [ 9 ] [ i ] . OtStats . files . size ) {
809- var size = infoData [ 9 ] [ i ] . OtStats . files . size ;
810- var count = infoData [ 9 ] [ i ] . OtStats . files . count ;
812+ for ( let i = 0 ; i < infoData [ 8 ] . length ; i ++ ) {
813+ if ( infoData [ 8 ] [ i ] . OtStats ) {
814+ if ( infoData [ 8 ] [ i ] . OtStats . files ) {
815+ if ( infoData [ 8 ] [ i ] . OtStats . files . size ) {
816+ var size = infoData [ 8 ] [ i ] . OtStats . files . size ;
817+ var count = infoData [ 8 ] [ i ] . OtStats . files . count ;
811818 if ( count ) {
812819 otCount += count ;
813820 }
@@ -1016,8 +1023,8 @@ process.stdin.on('end', () => {
10161023 }
10171024
10181025 // check opensearch diskstatus
1019- const openSearchWatermarkConfig = infoData [ 12 ] . defaults . cluster . routing . allocation . disk . watermark ;
1020- const openSearchDiskStat = infoData [ 13 ] . nodes . fs ;
1026+ const openSearchWatermarkConfig = infoData [ 11 ] . defaults . cluster . routing . allocation . disk . watermark ;
1027+ const openSearchDiskStat = infoData [ 12 ] . nodes . fs ;
10211028
10221029 // used disk in %
10231030 const usedDiskInPercent = Math . ceil ( 100 - ( openSearchDiskStat . available_in_bytes / openSearchDiskStat . total_in_bytes * 100 ) )
0 commit comments